public void setPasterList(List pasterList);// The `TXPaster` parameters are as follows:public final static class TXPaster {public Bitmap pasterImage; // Sticker imagepublic TXRect frame; // Sticker frame (please note that the frame coordinates here are relative to the rendering view)public long startTime; // Sticker start time in mspublic long endTime; // Sticker end time in ms}
public void setAnimatedPasterList(List animatedPasterList);// The `TXAnimatedPaster` parameters are as follows:public final static class TXAnimatedPaster {public String animatedPasterPathFolder; // Address of animated sticker imagepublic TXRect frame; // Animated sticker frame (please note that the frame coordinates here are relative to the rendering view)public long startTime; // Animated sticker start time in mspublic long endTime; // Animated sticker end time in mspublic float rotation;}
List animatedPasterList = new ArrayList<>();List pasterList = new ArrayList<>();for (int i = 0; i < mTCLayerViewGroup.getChildCount(); i++) {PasterOperationView view = (PasterOperationView) mTCLayerViewGroup.getOperationView(i);TXVideoEditConstants.TXRect rect = new TXVideoEditConstants.TXRect();rect.x = view.getImageX();rect.y = view.getImageY();rect.width = view.getImageWidth();TXCLog.i(TAG, "addPasterListVideo, adjustPasterRect, paster x y = " + rect.x + "," + rect.y);int childType = view.getChildType();if (childType == PasterOperationView.TYPE_CHILD_VIEW_ANIMATED_PASTER) {TXVideoEditConstants.TXAnimatedPaster txAnimatedPaster = new TXVideoEditConstants.TXAnimatedPaster();txAnimatedPaster.animatedPasterPathFolder = mAnimatedPasterSDcardFolder + view.getPasterName() + File.separator;txAnimatedPaster.startTime = view.getStartTime();txAnimatedPaster.endTime = view.getEndTime();txAnimatedPaster.frame = rect;txAnimatedPaster.rotation = view.getImageRotate();animatedPasterList.add(txAnimatedPaster);TXCLog.i(TAG, "addPasterListVideo, txAnimatedPaster startTimeMs, endTime is : " + txAnimatedPaster.startTime + ", " + txAnimatedPaster.endTime);} else if (childType == PasterOperationView.TYPE_CHILD_VIEW_PASTER) {TXVideoEditConstants.TXPaster txPaster = new TXVideoEditConstants.TXPaster();txPaster.pasterImage = view.getRotateBitmap();txPaster.startTime = view.getStartTime();txPaster.endTime = view.getEndTime();txPaster.frame = rect;pasterList.add(txPaster);TXCLog.i(TAG, "addPasterListVideo, txPaster startTimeMs, endTime is : " + txPaster.startTime + ", " + txPaster.endTime);}}mTXVideoEditer.setAnimatedPasterList(animatedPasterList); // Set an animated stickermTXVideoEditer.setPasterList(pasterList); // Set a static sticker
{"name":"glass", // Sticker name"count":6, // Number of stickers"period":480, // Playback period: time taken for playing back the sticker once in ms"width":444, // Sticker width"height":256, // Sticker height"keyframe":6, // Key image, which can represent the animated sticker"frameArray": [ // Set of all images{"picture":"glass0"},{"picture":"glass1"},{"picture":"glass2"},{"picture":"glass3"},{"picture":"glass4"},{"picture":"glass5"}]}
config.json
of the animated sticker and display it in the format defined in the .json file.public void setSubtitleList(List subtitleList);// The `TXSubtitle` parameters are as follows:public final static class TXSubtitle {public Bitmap titleImage; // Subtitle imagepublic TXRect frame; // Subtitle framepublic long startTime; // Subtitle start time in mspublic long endTime; // Subtitle end time in ms}public final static class TXRect {public float x;public float y;public float width;}
TextView
are used by the upper layer, please convert the control to Bitmap
first. For detailed directions, please see the sample code of the demo.initWithPreview
). For more information, please see the sample code of the demo.mSubtitleList.clear();for (int i = 0; i < mWordInfoList.size(); i++) {TCWordOperationView view = mOperationViewGroup.getOperationView(i);TXVideoEditConstants.TXSubtitle subTitle = new TXVideoEditConstants.TXSubtitle();subTitle.titleImage = view.getRotateBitmap(); // Get `Bitmap`TXVideoEditConstants.TXRect rect = new TXVideoEditConstants.TXRect();rect.x = view.getImageX(); // Get the X coordinate relative to the parent viewrect.y = view.getImageY(); // Get the Y coordinate relative to the parent viewrect.width = view.getImageWidth(); // Image widthsubTitle.frame = rect;subTitle.startTime = mWordInfoList.get(i).getStartTime(); // Set the start timesubTitle.endTime = mWordInfoList.get(i).getEndTime(); // Set the end timemSubtitleList.add(subTitle);}mTXVideoEditer.setSubtitleList(mSubtitleList); // Set the subtitle list
{"name":"boom", // Bubble subtitle name"width": 376, // Width"height": 335, // Height"textTop":121, // Top margin of text area"textLeft":66, // Left margin of text area"textRight":69, // Right margin of text area"textBottom":123, // Bottom margin of text area"textSize":40 // Font size}
Was this page helpful?