9. Set Contents

You can set downloaded contents (items, face beautifications, and bulges) through ARGear using the methods in the ARGContents class.

9.1 An Item (2D/3D Sticker, Filter, Background, ARContents, …)

The setItem function in the ARGContents class allows you to set an item on frames.

There are several types of items that can be set in ARGContents as shown below. Currently, the contents that exist in https://argear.io only can be used in ARGContents.

  • 2D Animation Sticker / Effects (BGM Support)

  • 2D Face Mask

  • Face Fun Bulge

  • Face Beautification

  • Camera Filter

  • 3D Animation Sticker

  • Realtime Segmentation

  • 3D Avatar (Blendshapes: 52)

The sample code below shows an example of how to set an item.

/**
 * @param type   contents type  : ARGContents.Type.ARGItem,  ARGContents.Type.FilterItem
 * @param path   downloaded contents path
 * @param uuid   uuid of an item
 */
argsession.contents().setItem(type, path, uuid, new ARGContents.Callback() {

    @Override
    public void onSuccess() {

    }

    @Override
    public void onError(Throwable e) {
        if (e instanceof InvalidContentsException) {
            Log.e(TAG, "InvalidContentsException");
        }
    }

});

9.2 Apply Face Beautification Effect

There are 16 face beautification effects in ARGContents such as V-line, face slim, jaw, chin, eye, eye gap, nose line, nose side, nose length, mouth size, eye back, eye corner, lip size, face skin, dark circle, and lip wrinkle. By setting these effects, your customers can transform their faces easily.

By using the setBeauty function in ARGContents class, you can easily add such functionalities without relying on the CMS module. Each face beautification type requires a float array as its input to determine how much of a face beautification effect should be applied.

The tables below describe detailed information for each type of face beautification effect.

Below is sample code of applying face beautification effects:

public float[] beautyValues = {
        10,     //VLINE
        90,     //ACE_SLIM
        55,     //JAW
        -50,    //CHIN
        5,      //EYE
        -10,    //EYE_GAP
        0,      //NOSE_LINE
        35,     //NOSE_SIDE
        30,     //NOSE_LENGTH
        -35,    //MOUTH_SIZE
        0,      //EYE_BACK
        0,      //EYE_CORNER
        0,      //LIP_SIZE
        50,     //SKIN
        0,      //DARK_CIRCLE
        0,      //MOUTH_WRINKLE
};

argsession.contents().setBeauty(beautyValues);

9.3 Face Fun Bulge

The setBulge function in ARGContents class allows you to set 6 types of face fun bulge effects.

Sample code of face fun bulge is written below.

/**
 * @param type   ARGContents.BulgeType.FUN1
 *               ARGContents.BulgeType.FUN2 
 *               ARGContents.BulgeType.FUN3 
 *               ARGContents.BulgeType.FUN4 
 *               ARGContents.BulgeType.FUN5 
 *               ARGContents.BulgeType.FUN6 
 */
argsession.contents().setBulge(type);

9.4 Remove Contents

The clear function in ARGContents class can remove all the applied contents of a specified type.

Sample code is written below.

/**
 * @param type   ARGContents.Type.ARGItem
 *                          ARGContents.Type.FilterItem 
 *                          ARGContents.Type.Beauty 
 *                          ARGContents.Type.Bulge 
 */
argsession.contents().clear(type);

Last updated