use of com.marshalchen.common.uimodule.imageprocessing.filter.MultiInputFilter in project UltimateAndroid by cymcsg.
the class ImageProcessingTwoInputfilterActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
view = new FastImageProcessingView(this);
pipeline = new FastImageProcessingPipeline();
view.setPipeline(pipeline);
setContentView(view);
usingCamera = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH);
if (usingCamera) {
input = new CameraPreviewInput(view);
} else {
input = new ImageResourceInput(view, this, R.drawable.image_processing_kukulkan);
}
input2 = new ImageResourceInput(view, this, R.drawable.test_back1);
filters = new ArrayList<MultiInputFilter>();
screen = new ScreenEndpoint(pipeline);
addFilter(new MaskFilter());
addFilter(new LinearBurnBlendFilter());
//TODO fix android 2.2
addFilter(new LuminosityBlendFilter());
//TODO fix android 2.2
addFilter(new SaturationBlendFilter());
addFilter(new HueBlendFilter());
//TODO fix android 2.2
addFilter(new ColourBlendFilter());
addFilter(new NormalBlendFilter());
addFilter(new SourceOverBlendFilter());
addFilter(new SoftLightBlendFilter());
addFilter(new HardLightBlendFilter());
addFilter(new DifferenceBlendFilter());
addFilter(new ExclusionBlendFilter());
addFilter(new ScreenBlendFilter());
addFilter(new ColourDodgeBlendFilter());
addFilter(new ColourBurnBlendFilter());
addFilter(new LightenBlendFilter());
addFilter(new DarkenBlendFilter());
addFilter(new OverlayBlendFilter());
addFilter(new DivideBlendFilter());
addFilter(new SubtractBlendFilter());
//TODO fix
addFilter(new AddBlendFilter());
addFilter(new MultiplyBlendFilter());
addFilter(new DissolveBlendFilter(0.7f));
addFilter(new ChromaKeyBlendFilter(new float[] { 1.0f, 0.3f, 0.0f }, 0.4f, 0.1f));
addFilter(new AlphaBlendFilter(0.9f));
input.addTarget(filters.get(0));
input2.addTarget(filters.get(0));
pipeline.addRootRenderer(input);
pipeline.addRootRenderer(input2);
pipeline.startRendering();
final Context context = this;
view.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent e) {
if (System.currentTimeMillis() - touchTime > 100) {
pipeline.pauseRendering();
touchTime = System.currentTimeMillis();
input.removeTarget(filters.get(curFilter));
input2.removeTarget(filters.get(curFilter));
curFilter = (curFilter + 1) % filters.size();
input.addTarget(filters.get(curFilter));
input2.addTarget(filters.get(curFilter));
Toast.makeText(context, filters.get(curFilter).getClass().getSimpleName(), Toast.LENGTH_SHORT).show();
pipeline.startRendering();
view.requestRender();
}
return false;
}
});
Toast.makeText(this, "Tap the screen to change filter.", Toast.LENGTH_LONG).show();
}
Aggregations