Search in sources :

Example 1 with SubLayer

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

the class CameraSubLayerDemo2Activity method onClick.

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    switch(v.getId()) {
        case R.id.id_fullrecord_cancel:
            this.finish();
            break;
        case R.id.id_fullrecord_ok:
            stopDrawPad();
            playVideo();
            break;
        case R.id.id_fullrecord_frontcamera:
            if (mCamLayer != null) {
                if (mDrawPadCamera.isRunning() && CameraLayer.isSupportFrontCamera()) {
                    // 先把DrawPad暂停运行.
                    mDrawPadCamera.pausePreview();
                    mCamLayer.changeCamera();
                    // 再次开启.
                    mDrawPadCamera.resumePreview();
                }
            }
            break;
        case R.id.id_fullrecord_flashlight:
            if (mCamLayer != null) {
                mCamLayer.changeFlash();
            }
            break;
        case R.id.id_fullrecord_filter:
            selectFilter();
            break;
        case R.id.id_camera_sublayer_add:
            if (mCamLayer != null) {
                SubLayer layer = mCamLayer.addSubLayer();
                subLayerAngle += 10;
                layer.setRotate(subLayerAngle);
                subLayerArray.add(layer);
                tvSubLayerHint.setText("演示增删多个子图层,个数:" + subLayerArray.size());
            }
            break;
        case R.id.id_camera_sublayer_delete:
            if (mCamLayer != null && subLayerArray.size() > 0) {
                int index = subLayerArray.size() - 1;
                SubLayer layer = subLayerArray.get(index);
                mCamLayer.removeSubLayer(layer);
                subLayerArray.remove(index);
                subLayerAngle -= 10;
                tvSubLayerHint.setText("演示增删多个子图层,个数:" + subLayerArray.size());
            }
            break;
        default:
            break;
    }
}
Also used : SubLayer(com.lansosdk.box.SubLayer)

Example 2 with SubLayer

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

the class CameraSubLayerDemo1Activity method startDrawPad.

/**
 * Step2: 开始运行 Drawpad线程.
 */
private void startDrawPad() {
    if (mDrawPadCamera.setupDrawpad()) {
        mCamLayer = mDrawPadCamera.getCameraLayer();
        // 容器开始预览
        mDrawPadCamera.startPreview();
        // 增加一个子图层;
        SubLayer layer1 = mCamLayer.addSubLayer();
        SubLayer layer2 = mCamLayer.addSubLayer();
        SubLayer layer3 = mCamLayer.addSubLayer();
        SubLayer layer4 = mCamLayer.addSubLayer();
        // 左上角为0,0;, 设置每个子图层中心点的位置
        int x1 = layer1.getPadWidth() / 4;
        int y1 = layer1.getPadHeight() / 4;
        int x2 = layer2.getPadWidth() / 4;
        int y2 = layer2.getPadHeight() * 3 / 4;
        int x3 = layer3.getPadWidth() * 3 / 4;
        int y3 = layer3.getPadHeight() / 4;
        int x4 = layer4.getPadWidth() * 3 / 4;
        int y4 = layer4.getPadHeight() * 3 / 4;
        layer1.setPosition(x1, y1);
        layer2.setPosition(x2, y2);
        layer3.setPosition(x3, y3);
        layer4.setPosition(x4, y4);
        // 第一个增加一个边框
        // layer1.setVisibleRect(0.02f,0.98f,0.02f,0.98f);  //这里0.02和0.98, 是为了上下左右边框留出0.02的边框;
        // layer1.setVisibleRectBorder(0.02f, 1.0f, 0.0f, 0.0f, 1.0f);  //设置边框;
        // 增加不同的滤镜来显示效果
        layer1.switchFilterTo(new IF1977Filter(mContext));
        layer2.switchFilterTo(new IFAmaroFilter(mContext));
        layer3.switchFilterTo(new IFEarlybirdFilter(mContext));
        layer4.switchFilterTo(new IFNashvilleFilter(mContext));
    // 增加滤镜, 应该从当前图层就可以增加滤镜!!!!
    } else {
        Log.i(TAG, "建立drawpad线程失败.");
    }
}
Also used : IFAmaroFilter(jp.co.cyberagent.lansongsdk.gpuimage.IFAmaroFilter) SubLayer(com.lansosdk.box.SubLayer) IFEarlybirdFilter(jp.co.cyberagent.lansongsdk.gpuimage.IFEarlybirdFilter) IF1977Filter(jp.co.cyberagent.lansongsdk.gpuimage.IF1977Filter) IFNashvilleFilter(jp.co.cyberagent.lansongsdk.gpuimage.IFNashvilleFilter)

Aggregations

SubLayer (com.lansosdk.box.SubLayer)2 IF1977Filter (jp.co.cyberagent.lansongsdk.gpuimage.IF1977Filter)1 IFAmaroFilter (jp.co.cyberagent.lansongsdk.gpuimage.IFAmaroFilter)1 IFEarlybirdFilter (jp.co.cyberagent.lansongsdk.gpuimage.IFEarlybirdFilter)1 IFNashvilleFilter (jp.co.cyberagent.lansongsdk.gpuimage.IFNashvilleFilter)1