In our games, we often see some image effects, such as translucent effects. It is not difficult to achieve this translucent effect. We need to understand the operation of image pixels.
Don't be afraid. In fact, bitmap in Android provides us with the basic method for Pixel operations.
We can use the getpixels () method to obtain the pixel of the image and put it in an array. Then we can operate on this array. Finally, set the array to bitmap through the setpixels () method.
In Android, each image pixel is displayed by a 4-byte integer. The maximum byte is used as the alpha channel to achieve transparency and opacity control. · 255 represents completely opacity, 0 indicates completely transparent; the next byte is the red channel, and 255 indicates that it is completely a red envelope. And so on. The next two bytes implement the green and blue channels accordingly..