use of jp.co.cyberagent.lansongsdk.gpuimage.IF1977Filter in project LanSoEditor_advance by LanSoSdk.
the class ExecuteFilterDemoActivity method startDrawPadExecute.
private void startDrawPadExecute() {
if (isExecuting)
return;
beforeDraw = System.currentTimeMillis();
isExecuting = true;
// 设置pad的宽度和高度.
int padWidth = mInfo.vWidth;
int padHeight = mInfo.vHeight;
if (mInfo.vRotateAngle == 90 || mInfo.vRotateAngle == 270) {
padWidth = mInfo.vHeight;
padHeight = mInfo.vWidth;
}
mDrawPad = new DrawPadVideoExecute(ExecuteFilterDemoActivity.this, videoPath, padWidth, padHeight, (int) (mInfo.vBitRate * 1.5f), new IF1977Filter(getApplicationContext()), editTmpPath);
mDrawPad.setUseMainVideoPts(true);
/**
* 设置DrawPad处理的进度监听, 回传的currentTimeUs单位是微秒.
*/
mDrawPad.setDrawPadProgressListener(new onDrawPadProgressListener() {
@Override
public void onProgress(DrawPad v, long currentTimeUs) {
drawPadProgress(v, currentTimeUs);
}
});
/**
* 设置DrawPad处理完成后的监听.
*/
mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {
@Override
public void onCompleted(DrawPad v) {
drawPadCompleted();
}
});
mDrawPad.pauseRecord();
if (mDrawPad.startDrawPad()) {
mainVideoLayer = mDrawPad.getMainVideoLayer();
// 开始恢复处理.
mDrawPad.resumeRecord();
} else {
new AlertDialog.Builder(this).setTitle("提示").setMessage("DrawPad开启错误.或许视频分辨率过高导致..").setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).show();
}
}
use of jp.co.cyberagent.lansongsdk.gpuimage.IF1977Filter 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线程失败.");
}
}
Aggregations