Search in sources :

Example 1 with GPUImageFilter

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);
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) SeekBar(android.widget.SeekBar) Intent(android.content.Intent) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) GLSurfaceView(android.opengl.GLSurfaceView) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) DrawPadView(com.lansosdk.videoeditor.DrawPadView) HorizontalListView(com.example.advanceDemo.view.HorizontalListView) Paint(android.graphics.Paint) GPUImageFilter(jp.co.cyberagent.lansongsdk.gpuimage.GPUImageFilter) OnClickListener(android.view.View.OnClickListener)

Example 2 with GPUImageFilter

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");
    }
}
Also used : GPUImageFilter(jp.co.cyberagent.lansongsdk.gpuimage.GPUImageFilter) Bitmap(android.graphics.Bitmap) GPUImageLookupFilter(jp.co.cyberagent.lansongsdk.gpuimage.GPUImageLookupFilter) ArrayList(java.util.ArrayList) LanSongBeautyTuneFilter(jp.co.cyberagent.lansongsdk.gpuimage.LanSongBeautyTuneFilter)

Example 3 with GPUImageFilter

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();
    }
}
Also used : GPUImageFilter(jp.co.cyberagent.lansongsdk.gpuimage.GPUImageFilter) com.lansosdk.videoeditor.onVideoOneDoProgressListener(com.lansosdk.videoeditor.onVideoOneDoProgressListener) com.lansosdk.videoeditor.onVideoOneDoCompletedListener(com.lansosdk.videoeditor.onVideoOneDoCompletedListener) VideoOneDo(com.lansosdk.videoeditor.VideoOneDo) ProgressDialog(android.app.ProgressDialog)

Aggregations

GPUImageFilter (jp.co.cyberagent.lansongsdk.gpuimage.GPUImageFilter)3 ProgressDialog (android.app.ProgressDialog)1 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 Paint (android.graphics.Paint)1 GLSurfaceView (android.opengl.GLSurfaceView)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 HorizontalScrollView (android.widget.HorizontalScrollView)1 SeekBar (android.widget.SeekBar)1 OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)1 TextView (android.widget.TextView)1 HorizontalListView (com.example.advanceDemo.view.HorizontalListView)1 DrawPadView (com.lansosdk.videoeditor.DrawPadView)1 VideoOneDo (com.lansosdk.videoeditor.VideoOneDo)1 com.lansosdk.videoeditor.onVideoOneDoCompletedListener (com.lansosdk.videoeditor.onVideoOneDoCompletedListener)1 com.lansosdk.videoeditor.onVideoOneDoProgressListener (com.lansosdk.videoeditor.onVideoOneDoProgressListener)1 ArrayList (java.util.ArrayList)1