Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
In the previous series I have made a general overview of the principles and use of color rendering in Android. Now it's time to do a detailed analysis based on a more complex implementation, which is the palette app in Photoshop
Let's take a look at the final implementation:
Figure 1
It's much more powerful than the Colorpickerdialog in API demos, and it's perfectly comparable to the palette in Photoshop.
According to this example, you can get the color you want, not just a simple hue selection, but a HSV color and transparency selection.
Here's a look at the principle of color rendering, such as the HSV color space, which I would like to introduce before:
Android Color Rendering (b) The principle of color Region division and the realization Idea
It seems to be difficult to achieve, do not worry, here to introduce an open source project Attenzione, has been very good to achieve the effect of this PS palette
Given that the current GitHub often does not go to the situation, here I will debug a good project has been uploaded, the following is;
http://download.csdn.net/detail/t12x3456/6246509
First look at the project;
Figure 2
From the very beginning, I believe we all see this project is to provide color selection in the form of preference, if need to integrate, just add to the project in the form of library .
Of course, it is very convenient to make the appropriate changes and integrate into the project according to your own needs.
Application class Features:
Alphapatterndrawable: drawable based rewrite, provides transparency for drawing
Colorpickerdialog; Color selection dialog box
Colorpickerpanelview: Color generation and setting custom view
Colorpickerpreference: Color settings
Colorpickerview: color selection Custom View
Fig. 3 Fig. 4
Figure 3 is the implementation of the Colorpickerpreference
Figure 4 is the implementation of the Colorpickerdialog, the red box selected part of the Colorpickerview, the green box is implemented by Colorpickerpanelview, the left to display the real-time color generation results, the right side of the final color settings. Where the transparency selection area is drawn using the alphapatterndrawable
At present, the open source project is an overview, the specific implementation will be detailed analysis later.
Android Faux Photoshop Palette app (i) overview