I want to apply some sort of image filter to whatever is being displayed on the screen of an android device. The simplest example of the image filter could be a Sepia filter applied to the frame buffer just before it is displayed on the screen. And just to make sure, i want this effect system wide and not just in my app.
Asked
Active
Viewed 552 times
1 Answers
0
To make the effect system-wide, you would need to modify SurfaceFlinger to apply the filter.
In Android 5.0 "Lollipop" you can see a prototype implementation of code that modifies the output to improve the contrast for people who are color blind. See the Daltonizer code and how it's hooked into doDisplayComposition()
in SurfaceFlinger.cpp. Note this applies the effect during surface composition, and consequently disables Hardware Composer.
There's no way to do this system-wide from an app. If there were, you could wreak all sorts of havoc on the system.

fadden
- 51,356
- 5
- 116
- 166
-
In android 5.0 they are using RenderEngine to render color effects using color matrices. i am actually working on Android 4.3...i have tried a few things like modifying the buffer within onFrameAvailable() and a few other functions but nothing seemed to work...Can you point me in the right direction considering i want to do this with Android 4.3 – thunderbird Nov 13 '14 at 10:38
-
You would probably need to back-port the GLES2 support. `RenderEngine` was factored out to allow both GLES1 and GLES2 to work, but GLES1 is only used for the non-GPU-accelerated emulator. One of the motivations for the GLES2 update was to be able to do effects like you want. The alternative is to figure out how to do the effect you want in GLES1. – fadden Nov 13 '14 at 15:32
-
i have no idea about OpenGL or GLES..will definitely look into it though... what i was more interested in was some kind of unsinged char buffer on which i can directly apply any kind of filter since i have no previous knowledge about OpenGL or GLES – thunderbird Nov 14 '14 at 10:55
-
There is no such thing as a software-rendering composition buffer on modern devices. Even if there were, the performance would be pretty terrible given the pixel counts on current displays. See https://source.android.com/devices/graphics/architecture.html for the details. – fadden Nov 14 '14 at 16:34