Total Directory: http://blog.csdn.net/iloveas2014/article/details/38304477
4.3.4 embodiment of colormatrixfilter-cross-Channel operations
Using colormatrixfilter for colortransform is a bit cool, not reflecting the essence of the matrix-resource restructuring and layout strategy. Therefore, we should focus on multi-channel scheduling.
The most typical example is grayscale processing. Do you still remember the grayscale topic in Chapter 1? I mentioned a famous psychology formula:
Gray = r * 0.299 + G * 0.587 + B * 0.114
For any gray type, the RGB value meets the r = G = B = gray (gray value) formula. It can be seen that resultr, resultg, and resultb are equal to Gray:
Resultr = srcr * 0.299 + srcg * 0.587 + SRCB * 0.114 + srcalpha * 0 + 0
Resultg = srcr * 0.299 + srcg * 0.587 + SRCB * 0.114 + srcalpha * 0 + 0
Resultb = srcr * 0.299 + srcg * 0.587 + SRCB * 0.114 + srcalpha * 0 + 0
In the matrix formula
We use this matrix to test the effect (Figure 4.26 ):
Figure 4.26 grayscale matrix effect
The channel is evenly allocated to R, G, and B, so that only brightness is retained. This is incomparable to colortransform.
In the basics of Image Processing in ActionScript 3.0, you can find more interesting color matrices such as grayscale coloring. Of course, colormatrixfilter has limited coloring capabilities, so I will introduce more powerful HSB mixing in subsequent chapters.
Next, let's discuss the class that matches flash IDE's Color Filter adjustment-adjustcolor, let's see how this magic class cleverly converts RGB to an HSB pattern that better fits the human sensory system through matrix multiplication.
Image programming in actionscript3 games)