Contact us

tel:15797766463

mail:business@seeshiontech.com

中文
English
中文
登录/注册

{user.username}

ID: {user.id}

VE Development document

Sticker

Update time : 2020-08-31 10:48:58

Sticker Functions

SXStickerManager

You can invoke the method of template commit to get the SXStickerManager which is used to add, delete, or modify sticker. The coordinate of the sticker, taking the top left corner of the template as the origin, refers to the coordinate in template. The coordinate is total different from the coordinate of preview SurfaceView, which need to be converted according to the scale when using touching event to manipulate the coordinate. When you pause previewing, you need to invoke SXStickerManager#setPlayer and pass the player parameter in advance if you want to refresh the image after modifying sticker.

Add sticker

You can invoke the method of SXStickerManager#addSticker to pass the path of unzipped sticker folders, and then pass sticker ID. Note that you need to pass the ID of sticker at the time when you modify the sticker. Invoking the method of SXStickerManager#getStickerAtPoint(float x, float y), you will get the sticker at certain point; (x, y) is the coordinate of template. Besides, you can invoke the method of getStickerBoundingBox to get the vertex array of sticker bounding corner box, which will be contained in float[8] and returned to you. And sticker bounding box should be scaled according to surface when displaying on interface. More details in Demo. In addition, you can invoke the method of removeSticker(String stickerId) to remove sticker.

Modify sticker

You can replace or modify sticker assets by media sticker (image or video sticker) and text sticker (which is converted into text image of which String sourcePath will be passed). Meanwhile, you can parse config.json to get the editable asset information, referencing the parsing way of standard template. The type you want to replace is determined by its order in the assets. SXStickerManager#replaceSource(String stickerId, int index, String sourcePath).

Scale, rotate and transform sticker

You can transform the whole sticker or some specified assets in sticker.

For sticker:
For assets in sticker: