Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we use EffectFactory Class for lower versions

For my new assignment, I wanted to use some library that can provide a "Posterize effect". I found many library like Aviary SDK and jhlabs, Yes, these are easy to use, but these making the code heavier. SO I keep searching for Android's API itself which can do the similar task. And after a lot of RnD, I finally found one my time saver class EffectsFactory which provides the same as I wanted. I applied it in my assignment also. But the bad thing it was added in API level 14, And my app should be compatible with at least API level 8.

So, My question is,

Can I use EffectsFactory class for lower version? If Yes then How?

Or, If No, Then Do we have any API in Android SDK itself which do similar to effectfactory ?

Please avoid referencing any library or NDK's open cv library.

like image 371
TheLittleNaruto Avatar asked Dec 27 '13 07:12

TheLittleNaruto


1 Answers

No, there is not an Android API that will posterize an image below API 14. Even above API 14 EffectsFactory may not work, as it says in the Android documentation:

Some effects may not be available on all platforms, so before creating a certain effect, the application should confirm that the effect is supported on this platform by calling isEffectSupported(String).

However, you could easily make a lightweight solution yourself. Posterization is a simple process. For example, the code behind JHlabs' posterize filter is less than 50 lines (and most of them are sugar). In your shoes, if using a 3rd party library was out of the question, I wouldn't hesitate to write my own.

Edit: If you happen to be posterizing images your app takes from the camera, there is also Camera.Parameters.setColorEffect(), but again this is not supported on all devices, as it says in the documentation:

For example, the application should call getSupportedColorEffects() before calling setColorEffect(String).

like image 128
Eric Simonton Avatar answered Nov 01 '22 00:11

Eric Simonton