Learn to set the Color Shift & Grayscale in the ColorMatrixFilter with ActionScript.

Home • Members Tutorials Forum iSnapChat Contact Us 

 


Flash Tutorials

   

Color Matrix Filter with ActionScript

 

Free Flash Tutorial


Step 6    <<   Previous      Intro   1   2   3   4   5   6   7     Next   >>      

 

Step Six: Matrix Settings - Color Shift & Grayscale

If you want the amount of red in the source image to dictate the green value in the result image:

[1,0,0,0,0,   /* Red */
 1,0,0,0,0,   /* Green */
 0,0,1,0,0,   /* Blue */
 0,0,0,1,0 ]; /* Alpha Transparency */


Green is set by red value.

Here all the colors channels have been shifted to the wrong place :

[0,0,1,0,0,   /* Red */
 1,0,0,0,0,   /* Green */
 0,1,0,0,0,   /* Blue */
 0,0,0,1,0 ]; /* Alpha Transparency */


All colors have been shifter to the wrong place!


Add the blue into the red column and all color information is set by the red channel thus all colors are the same:

[1,0,0,0,0,   /* Red */
 1,0,0,0,0,   /* Green */
 1,0,0,0,0,   /* Blue */
 0,0,0,1,0 ]; /* Alpha Transparency */


All colors are set by red which gives black and white!


True Grayscale :

[.33,.33,.33,0,0,   /* Red */
 .33,.33,.33,0,0,   /* Green */
 .33,.33,.33,0,0,   /* Blue */
 0,0,0,1,0 ]; /* Alpha Transparency */


All colors are set by red which gives black and white!

         

Step 6    <<   Previous      Intro   1   2   3   4   5   6   7     Next   >>      


33853 visitors to this page since 2 April 07 •

Phil Schulz's Facebook Profile
Webwasp is Phil Schulz's baby. You are welcome to contact me or become my Facebook friend: Click here

 Top of Page HomeMembers Tutorials Forum iSnapChat Contact Us 
 All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.