Closed kdemczuk closed 10 years ago
Yes, you are missing one important thing. The brightnessFilter needs to pass its output data into the saturationFilter so that both the brightness and saturation filters are applied. There are two ways you can do this: a group filter or just simply chaining the filters. The group filter was more meant for situations where a single image process involves multiple filters (SmoothToonFilter, in the source, is a good example of when a group filter should be used). I would recommend just chaining the filters like this:
pipeline.pauseRendering();
imageIn.removeTarget(brightnessFilter);
pipeline.addFilterToDestroy(brightnessFilter);
pipeline.addFilterToDestroy(saturationFilter);
brightnessFilter = new BrightnessFilter(brighnessLevelF);
saturationFilter = new SaturationFilter(saturationLevelF);
imageIn.addTarget(brightnessFilter);
brightnessFilter.addTarget(saturationFilter);
saturationFilter.addTarget(screen);
pipeline.startRendering();
view.requestRender();
Thanks a lot for explaining it to me. I have one more question. Can I use Your library in commercial product? I haven't found anything about license in docs. Using it would be really helpful for me.
Sorry for the late response. I had to check with the company that contributed to this framework. It sounds like they are OK with anyone using it in a commericial project as long as there is a mention in the README. Just send an email to bruce@insatiablegenius.com to confirm. Thanks!
I've noticed that GroupFilter doesn't work or maybe I use it in a wrong way. I want to process image from ImageView that is set in RelativeLayout.
My GroupFilter class:
Here is my init code:
I have two buttons (plus and minus) for controlling brightness level and also two buttons for controlling saturation level. Every time I push any button, my filter method is invoked with appropriate value of brighnessLevelF and saturationLevelF (which are floats and represent levels of brightness and saturation). Method body:
It works but only brightness level is changing. Am I doing something wrong?