Search in sources :

Example 1 with DrawPadPictureExecute

use of com.lansosdk.videoeditor.DrawPadPictureExecute in project LanSoEditor_advance by LanSoSdk.

the class ExecuteBitmapLayerActivity method testDrawPadExecute.

private void testDrawPadExecute() {
    if (isExecuting)
        return;
    padWidth = 480;
    padHeight = 480;
    isExecuting = true;
    mDrawPad = new DrawPadPictureExecute(getApplicationContext(), 480, 480, 26 * 1000, 25, 1000000, dstPath);
    /**
     * 设置DrawPad的处理进度监听, 您可以在每一帧的过程中对ILayer做各种变化,
     * 比如平移,缩放,旋转,颜色变化,增删一个Layer等,来实现各种动画画面.
     */
    mDrawPad.setDrawPadProgressListener(new onDrawPadProgressListener() {

        // currentTimeUs是当前时间戳,单位是微妙,可以根据时间戳/(MediaInfo.vDuration*1000000)来得到当前进度百分比.
        @Override
        public void onProgress(DrawPad v, long currentTimeUs) {
            tvProgressHint.setText(String.valueOf(currentTimeUs));
        }
    });
    /**
     * 处理完毕后的监听
     */
    mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {

        @Override
        public void onCompleted(DrawPad v) {
            tvProgressHint.setText("DrawPadExecute Completed!!!");
            isExecuting = false;
            if (SDKFileUtils.fileExist(dstPath)) {
                findViewById(R.id.id_video_edit_btn2).setEnabled(true);
            }
        }
    });
    /**
     * 开始前先设置暂停标记.暂停画面的走动.比如想一次性增加多个Layer对象后,
     * 在让DrawPad执行,这样比在画面走动中获取更精确一些.
     */
    mDrawPad.pauseRecord();
    if (mDrawPad.startDrawPad()) {
        mDrawPad.addBitmapLayer(BitmapFactory.decodeFile(picBackGround), null);
        // 这里同时增加多个,只是不显示出来.
        // 1--5秒.
        addLayerToArray(R.drawable.pic1, 0, 5000);
        // 5--10秒.
        addLayerToArray(R.drawable.pic2, 5000, 10000);
        // 10---15秒
        addLayerToArray(R.drawable.pic3, 10000, 15000);
        // 15---20秒
        addLayerToArray(R.drawable.pic4, 15000, 20000);
        // 20---25秒
        addLayerToArray(R.drawable.pic5, 20000, 25000);
    } else {
        DemoUtil.showToast(getApplicationContext(), "drawpad容器执行失败,请查看打印信息");
    }
    mDrawPad.resumeRecord();
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadPictureExecute(com.lansosdk.videoeditor.DrawPadPictureExecute) com.lansosdk.box.onDrawPadProgressListener(com.lansosdk.box.onDrawPadProgressListener) com.lansosdk.box.onDrawPadCompletedListener(com.lansosdk.box.onDrawPadCompletedListener)

Aggregations

DrawPad (com.lansosdk.box.DrawPad)1 com.lansosdk.box.onDrawPadCompletedListener (com.lansosdk.box.onDrawPadCompletedListener)1 com.lansosdk.box.onDrawPadProgressListener (com.lansosdk.box.onDrawPadProgressListener)1 DrawPadPictureExecute (com.lansosdk.videoeditor.DrawPadPictureExecute)1