Use the Flash ColorMatrixFilter & learn how use the matrix settings with ActionScript.

Home • Members Tutorials Forum iSnapChat Contact Us 

 


Flash Tutorials

   

Color Matrix Filter with ActionScript

 

Free Flash Tutorial


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

 

Step Four: Matrix Settings - Multiply or Add

The values in the first four columns are multiplied with the source red, green, blue, and alpha values respectively. The fifth column value is added (offset).


To double the red place a 2 in the red row:

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


Red has been doubled.


Instead I could use the offset to add a fixed amount of red. The maximum I can add is 255:


A hint of red.

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

 


Maximum red.

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

You can also add in color by increasing the alpha channel. Maximum is 1:


A hint of red.

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

 


Maximum red.

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

         

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


33731 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.