Collage FX Studio
PhotoMagic Studio
Photo Card Workshop
Magic Animator

Flex ColorMatrixFilter class brightness adjusting

The ColorMatrixFilter class lets you apply a 4 x 5 matrix transformation on the RGBA color and alpha values of every pixel in the input image to produce a result with a new set of RGBA color and alpha values.  You can apply the filter to any display object (that is, objects that inherit from the DisplayObject class), such as MovieClip, SimpleButton, TextField, and Video objects, as well as to BitmapData objects. Here is the example to adjusting brightness of a picture.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" layout="vertical"
 creationComplete="transformImage()"   verticalScrollPolicy="off" horizontalScrollPolicy="off">

    private var demoImage:Class;

   private function transformImage():void
    var matrix:Array = new Array();
    matrix = matrix.concat([1, 0, 0, 0, 30]); // red
    matrix = matrix.concat([0, 1, 0, 0, 30]); // green
    matrix = matrix.concat([0, 0, 1, 0, 30]); // blue
    matrix = matrix.concat([0, 0, 0, 1, 0]);  // alpha
    var cmf:ColorMatrixFilter = new ColorMatrixFilter(matrix);    
    var filtersArray:Array = new Array();
    modifiedImage.filters = filtersArray;
 <mx:HBox width="420" height="200">
    <mx:Label text="Original Image"/>
    <mx:Image source="{demoImage}" width="200" height="160"/>
   <mx:Label text="Modified Image"/>
   <mx:Image id="modifiedImage" source="{demoImage}" width="200" height="160"/>

Comment: 0 | Read times: -
Announce commentary
Your name
Validation code Code