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
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
Feedback