Image programming in actionscript3 games)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.