Implementation method of Android picture color transformation

Recently, I have been working on image related applications, so there are many common operations accumulated by all parties. Generally speaking, there are many ways to realize this function, such as 1 Chroma conversion 2 Use ColorMatrix color matrix 3 Use the direct operation of pixels and so on. Today, let's review the first method. Although it is relatively single, there are few types of results.

Compared with the common image style transformation, we generally change the color, saturation, brightness, etc. here is exactly the coding idea of this way: • abstract the image operation tool class • create a bitmap object for operation • use canvas, brush paint • color matching processing, parameter control • draw bitmap and return • called by relevant methods, Get results

Let's go directly to the code. The first is the layout

Next is the related methods of the tool operation class

Then use classes

Then run the program, and you can process and transform the image by adjusting the slider.

Note: in the method of the tool class, the parameters passed in should be processed at last, instead of the bitmap declared by ourselves, otherwise we will not get our real-time image effect. Because our bitmap is only an object model for operation, what we really need to operate is our BP parameters.

Summary: there are many methods in image processing, especially the method of using pixels for images, which can present a variety of effects. Such as old photos, reliefs, negatives, etc; The use of color matrix is also a good classic operation method. These are worth learning, so that we can show more gorgeous colors and effects in our applications!

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>