use of jp.co.cyberagent.lansongsdk.gpuimage.GPUImageFilter in project LanSoEditor_advance by LanSoSdk.
the class Demo3LayerFilterActivity method initView.
private void initView() {
findViewById(R.id.id_filterLayer_demo_next).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mplayer != null) {
mplayer.stop();
mplayer.release();
mplayer = null;
}
drawPadView.stopDrawPad();
filterExecute();
}
});
listFilterView = (HorizontalListView) findViewById(R.id.id_filterlayer_filterlist);
listFilterView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
if (filterLayer != null) {
GPUImageFilter filter = filterList.getFilter(getApplicationContext(), arg2);
currrentFilterName = filterList.getName(arg2);
filterLayer.switchFilterTo(filter);
}
}
});
drawPadView = (DrawPadView) findViewById(R.id.id_filterLayer_demo_view);
skbarFilterAdjuster = (SeekBar) findViewById(R.id.id_filterLayer_demo_seek1);
skbarFilterAdjuster.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (mFilterAdjuster != null) {
mFilterAdjuster.adjust(progress);
}
}
});
skbarFilterAdjuster.setMax(100);
findViewById(R.id.id_filterLayer_demo_selectbtn).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
selectFilter();
}
});
findViewById(R.id.id_filterdemo_saveplay).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (SDKFileUtils.fileExist(dstPath)) {
Intent intent = new Intent(Demo3LayerFilterActivity.this, VideoPlayerActivity.class);
intent.putExtra("videopath", dstPath);
startActivity(intent);
} else {
Toast.makeText(Demo3LayerFilterActivity.this, "目标文件不存在", Toast.LENGTH_SHORT).show();
}
}
});
findViewById(R.id.id_filterdemo_saveplay).setVisibility(View.GONE);
}
use of jp.co.cyberagent.lansongsdk.gpuimage.GPUImageFilter in project LanSoEditor_advance by LanSoSdk.
the class BeautyManager method addBeauty.
/**
* 增加美颜
*
* @param camlayer
*/
public void addBeauty(CameraLayer camlayer) {
if (camlayer != null) {
isTuneBeauting = true;
ArrayList<GPUImageFilter> filters = new ArrayList<GPUImageFilter>();
beautyTuneFilter = new LanSongBeautyTuneFilter();
filters.add(beautyTuneFilter);
// 设置亮度;
camlayer.setBeautyBrightness(1);
String bmpStr = CopyFileFromAssets.copyAssets(mContext, "lansongbeauty.png");
if (bmpStr != null) {
mlookupFilter = new GPUImageLookupFilter(0.22f);
Bitmap bmp = BitmapFactory.decodeFile(bmpStr);
mlookupFilter.setBitmap(bmp);
filters.add(mlookupFilter);
} else {
Log.e(TAG, "无法获取lansongbeauty图片文件");
}
camlayer.switchFilterList(filters);
} else {
Log.e(TAG, "add beauty error. camlayer is null");
}
}
use of jp.co.cyberagent.lansongsdk.gpuimage.GPUImageFilter in project LanSoEditor_advance by LanSoSdk.
the class Demo3LayerFilterActivity method filterExecute.
private void filterExecute() {
mProgressDialog = new ProgressDialog(Demo3LayerFilterActivity.this);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.setMessage("正在后台处理:");
mProgressDialog.setCancelable(false);
videoOneDo = new VideoOneDo(getApplicationContext(), mVideoPath);
GPUImageFilter filter = FilterLibrary.getFilterList().getFilter(getApplicationContext(), currrentFilterName);
videoOneDo.setFilter(filter);
videoOneDo.setOnVideoOneDoProgressListener(new onVideoOneDoProgressListener() {
@Override
public void onProgress(VideoOneDo v, float percent) {
if (mProgressDialog != null) {
percent = percent * 100;
mProgressDialog.setMessage("正在后台处理:" + percent + " %");
}
}
});
videoOneDo.setOnVideoOneDoCompletedListener(new onVideoOneDoCompletedListener() {
@Override
public void onCompleted(VideoOneDo v, String dstVideo) {
if (mProgressDialog != null) {
mProgressDialog.cancel();
mProgressDialog = null;
}
dstPath = dstVideo;
findViewById(R.id.id_filterdemo_saveplay).setVisibility(View.VISIBLE);
videoOneDo.release();
videoOneDo = null;
}
});
if (videoOneDo.start()) {
mProgressDialog.show();
} else {
Toast.makeText(getApplicationContext(), "后台运行失败,请查看打印信息", Toast.LENGTH_SHORT).show();
}
}
Aggregations