The deflection of solid color is introduced in "color VII in computer-Rapid Calculation of deflection of solid color.
This article expands the formula above to any color.
Color (R, G, B) how to calculate the deflection color (R', G', B ') after the ω deflection ')
The specific derivation process is not detailed in detail. It is similar to the previous article. The following describes the computing process:
Make Max the maximum values of the three components R, G, and B, and min the minimum values of the three components R, G, and B.
If max = min, the color is gray, no matter how the deflection, or the original color.
R' = r; G' = g; B '= B
If max = min, P = MAX-MIN
When G <B, ω =-ω
ω '= ω/60 × P
λ '= MAX-R + G-MIN + B-MIN + ω'
When λ '<0, set λ ''=-λ'
When λ '> 3 P, set λ ''to 6 p-λ'
Otherwise, λ ''= λ'
Deflection component of solid color
R' = 2 P-λ ''; If R' <0, R' = 0; If R'> P, R' = P;
G' = λ ''; If G'> P, G' = P;
B '= λ ''-2 p; If B' <0; then B '= 0;
If (G <B) XOR (λ '<0 or λ'> 3 P) = true, the values of G' and B 'are exchanged.
Last
R' = R' + min
G' = G' + min
B '= B' + min
(133, 44, 20) What is the color of clockwise Deflection? The answer is (20,120, 66)
(133, 44, 20) What is the color of the counterclockwise deflection? The answer is (120)