Search in sources :

Example 1 with CanvasLayer

use of com.lansosdk.box.CanvasLayer in project LanSoEditor_advance by LanSoSdk.

the class ExecuteTwoVideoLayerDemoActivity method addCanvasLayer.

/**
 * 增加一个CanvasLayer,
 */
private void addCanvasLayer() {
    mCanvasLayer = mDrawPad.addCanvasLayer();
    if (mCanvasLayer != null) {
        mCanvasLayer.setClearCanvas(false);
        mShowHeart = new ShowHeart(ExecuteTwoVideoLayerDemoActivity.this, mCanvasLayer.getPadWidth(), mCanvasLayer.getPadHeight());
        mCanvasLayer.addCanvasRunnable(new CanvasRunnable() {

            @Override
            public void onDrawCanvas(CanvasLayer pen, Canvas canvas, long currentTimeUs) {
                // TODO Auto-generated method stub
                mShowHeart.drawTrack(canvas);
            }
        });
    }
}
Also used : Canvas(android.graphics.Canvas) CanvasRunnable(com.lansosdk.box.CanvasRunnable) ShowHeart(com.example.advanceDemo.view.ShowHeart) CanvasLayer(com.lansosdk.box.CanvasLayer)

Example 2 with CanvasLayer

use of com.lansosdk.box.CanvasLayer in project LanSoEditor_advance by LanSoSdk.

the class ExecuteVideoLayerActivity method addCanvasLayer.

/**
 * 增加一个CanvasLayer,
 */
private void addCanvasLayer() {
    mCanvasLayer = mDrawPad.addCanvasLayer();
    if (mCanvasLayer != null) {
        mCanvasLayer.setClearCanvas(false);
        mShowHeart = new ShowHeart(ExecuteVideoLayerActivity.this, mCanvasLayer.getPadWidth(), mCanvasLayer.getPadHeight());
        mCanvasLayer.addCanvasRunnable(new CanvasRunnable() {

            @Override
            public void onDrawCanvas(CanvasLayer pen, Canvas canvas, long currentTimeUs) {
                // TODO Auto-generated method stub
                mShowHeart.drawTrack(canvas);
            }
        });
    }
}
Also used : Canvas(android.graphics.Canvas) CanvasRunnable(com.lansosdk.box.CanvasRunnable) ShowHeart(com.example.advanceDemo.view.ShowHeart) CanvasLayer(com.lansosdk.box.CanvasLayer)

Example 3 with CanvasLayer

use of com.lansosdk.box.CanvasLayer in project LanSoEditor_advance by LanSoSdk.

the class VideoOneDo method addCanvasLayer.

/**
 * 增加Android的Canvas类图层.
 */
private void addCanvasLayer() {
    if (textAdd != null) {
        canvasLayer = drawPad.addCanvasLayer();
        canvasLayer.addCanvasRunnable(new CanvasRunnable() {

            @Override
            public void onDrawCanvas(CanvasLayer layer, Canvas canvas, long currentTimeUs) {
                Paint paint = new Paint();
                paint.setColor(Color.RED);
                paint.setAntiAlias(true);
                paint.setTextSize(20);
                canvas.drawText(textAdd, 20, 20, paint);
            }
        });
    }
}
Also used : Canvas(android.graphics.Canvas) CanvasRunnable(com.lansosdk.box.CanvasRunnable) Paint(android.graphics.Paint) CanvasLayer(com.lansosdk.box.CanvasLayer)

Example 4 with CanvasLayer

use of com.lansosdk.box.CanvasLayer in project LanSoEditor_advance by LanSoSdk.

the class ExecuteCanvasLayerActivity method addCanvasLayer.

private void addCanvasLayer() {
    mCanvasLayer = mDrawPad.addCanvasLayer();
    if (mCanvasLayer != null) {
        mCanvasLayer.setClearCanvas(false);
        mShowHeart = new ShowHeart(this, mCanvasLayer.getPadWidth(), mCanvasLayer.getPadHeight());
        mCanvasLayer.addCanvasRunnable(new CanvasRunnable() {

            @Override
            public void onDrawCanvas(CanvasLayer layer, Canvas canvas, long currentTimeUs) {
                // TODO Auto-generated method stub
                mShowHeart.drawTrack(canvas);
            }
        });
    }
}
Also used : Canvas(android.graphics.Canvas) CanvasRunnable(com.lansosdk.box.CanvasRunnable) ShowHeart(com.example.advanceDemo.view.ShowHeart) CanvasLayer(com.lansosdk.box.CanvasLayer)

Example 5 with CanvasLayer

use of com.lansosdk.box.CanvasLayer in project LanSoEditor_advance by LanSoSdk.

the class CanvasLayerDemoActivity method addCanvasLayer.

private void addCanvasLayer() {
    if (mDrawPadView == null)
        return;
    mCanvasLayer = mDrawPadView.addCanvasLayer();
    if (mCanvasLayer != null) {
        /**
         * 在绘制一帧的时候, 是否清除上一帧绘制的 内容.
         */
        mCanvasLayer.setClearCanvas(false);
        mShowHeart = new ShowHeart(CanvasLayerDemoActivity.this, mCanvasLayer.getPadWidth(), mCanvasLayer.getPadHeight());
        /**
         * 这里增加两个 CanvasRunnable
         * CanvasRunnable是把当前的一段代码放到 DrawPad线程中运行的一个类. 类似GLSurfaceView的queueEvent
         */
        mCanvasLayer.addCanvasRunnable(new CanvasRunnable() {

            @Override
            public void onDrawCanvas(CanvasLayer layer, Canvas canvas, long currentTimeUs) {
                Paint paint = new Paint();
                paint.setColor(Color.RED);
                paint.setAntiAlias(true);
                paint.setTextSize(50);
                canvas.drawText("蓝松短视频演示之<任意绘制>", 20, mCanvasLayer.getPadHeight() - 200, paint);
            }
        });
        /**
         * 增加另一个CanvasRunnable
         */
        mCanvasLayer.addCanvasRunnable(new CanvasRunnable() {

            @Override
            public void onDrawCanvas(CanvasLayer layer, Canvas canvas, long currentTimeUs) {
                // TODO Auto-generated method stub
                mShowHeart.drawTrack(canvas);
            }
        });
    // 以下是测试:Canvas图层的移动缩放旋转.
    // mCanvasLayer.setScale(0.5f);
    // mCanvasLayer.setRotate(60);
    // mCanvasLayer.setPosition(mCanvasLayer.getPadWidth()-mCanvasLayer.getLayerWidth()/4,mCanvasLayer.getPositionY()/4);
    }
}
Also used : Canvas(android.graphics.Canvas) CanvasRunnable(com.lansosdk.box.CanvasRunnable) Paint(android.graphics.Paint) ShowHeart(com.example.advanceDemo.view.ShowHeart) CanvasLayer(com.lansosdk.box.CanvasLayer)

Aggregations

Canvas (android.graphics.Canvas)5 CanvasLayer (com.lansosdk.box.CanvasLayer)5 CanvasRunnable (com.lansosdk.box.CanvasRunnable)5 ShowHeart (com.example.advanceDemo.view.ShowHeart)4 Paint (android.graphics.Paint)2