(Preview)
Package | spark.filters |
Class | public class ColorMatrixFilter |
Inheritance | ColorMatrixFilter ![]() ![]() ![]() |
Implements | IBitmapFilter |
Language Version: | ActionScript 3.0 |
Product Version: | Flex 4 |
Runtime Versions: | Flash Player 10, AIR 1.5 |

The <s:ColorMatrixFilter>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:ColorMatrixFilter Properties matrix="[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]" />
More examples
Related API Elements
Public Properties
Property | Defined By | ||
---|---|---|---|
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | |
matrix : Object
A comma delimited list of 20 doubles that comprise a 4x5 matrix applied to the
rendered element. | ColorMatrixFilter |
Public Methods
Method | Defined By | ||
---|---|---|---|
ColorMatrixFilter(matrix:Array = null)
Constructor. | ColorMatrixFilter | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | |
Returns a copy of this filter object. | ColorMatrixFilter | ||
![]() |
Dispatches an event into the event flow. | EventDispatcher | |
![]() |
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | |
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Propagates a change event when the filter has changed. | BaseFilter | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Removes a listener from the EventDispatcher object. | EventDispatcher | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
![]() |
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Public Constants
Property Detail
matrix | property |
matrix:Object
Language Version: | ActionScript 3.0 |
Product Version: | Flex 4 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
A comma delimited list of 20 doubles that comprise a 4x5 matrix applied to the rendered element. The matrix is in row major order -- that is, the first five elements are multipled by the vector [srcR,srcG,srcB,srcA,1] to determine the output red value, the second five determine the output green value, etc.
The value must either be an array or comma delimited string of 20 numbers.
The default value is [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0].
Implementation
public function get matrix():Object
public function set matrix(value:Object):void
Constructor Detail
ColorMatrixFilter | () | Constructor |
Method Detail
clone | () | method |
public function clone():BitmapFilter
Language Version: | ActionScript 3.0 |
Product Version: | Flex 4 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Returns a copy of this filter object.
ReturnsBitmapFilter — A new ColorMatrixFilter instance with all of the same
properties as the original one.
|
Examples How to use this example
ColorMatrixFilterExample.mxml
<?xml version="1.0"?> <!-- filters/examples/ColorMatrixFilterExample .mxml --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="createFilters()"> <fx:Script><![CDATA[ import spark.filters.*; import flash.filters.BitmapFilterQuality; import flash.filters.BitmapFilterType; private var myGreenMatrixFilter:ColorMatrixFilter; private var myBlueMatrixFilter:ColorMatrixFilter; private var myRedMatrixFilter:ColorMatrixFilter; public function createFilters():void { var greenMatrix:Array = new Array(); greenMatrix = greenMatrix.concat([0, 0, 0, 0, 0]); // red greenMatrix = greenMatrix.concat([0, 1, 0, 0, 0]); // green greenMatrix = greenMatrix.concat([0, 0, 0, 0, 0]); // blue greenMatrix = greenMatrix.concat([0, 0, 0, 1, 0]); // alpha var blueMatrix:Array = new Array(); blueMatrix = blueMatrix.concat([0, 0, 0, 0, 0]); // red blueMatrix = blueMatrix.concat([0, 0, 0, 0, 0]); // green blueMatrix = blueMatrix.concat([0, 0, 1, 0, 0]); // blue blueMatrix = blueMatrix.concat([0, 0, 0, 1, 0]); // alpha var redMatrix:Array = new Array(); redMatrix = redMatrix.concat([1, 0, 0, 0, 0]); // red redMatrix = redMatrix.concat([0, 0, 0, 0, 0]); // green redMatrix = redMatrix.concat([0, 0, 0, 0, 0]); // blue redMatrix = redMatrix.concat([0, 0, 0, 1, 0]); // alpha myGreenMatrixFilter = new ColorMatrixFilter(greenMatrix); myBlueMatrixFilter = new ColorMatrixFilter(blueMatrix); myRedMatrixFilter = new ColorMatrixFilter(redMatrix); greenImage.filters = [myGreenMatrixFilter]; blueImage.filters = [myBlueMatrixFilter]; redImage.filters = [myRedMatrixFilter]; } ]]></fx:Script> <s:VGroup> <s:VGroup> <s:Label text="Original Image"/> <mx:Image id="originalImage" source="@Embed(source='assets/Nokia_6630.png')"/> </s:VGroup> <s:VGroup> <s:Label text="Green Matrix Image"/> <mx:Image id="greenImage" source="@Embed(source='assets/Nokia_6630.png')"/> </s:VGroup> <s:VGroup> <s:Label text="Blue Matrix Image"/> <mx:Image id="blueImage" source="@Embed(source='assets/Nokia_6630.png')"/> </s:VGroup> <s:VGroup> <s:Label text="Red Matrix Image"/> <mx:Image id="redImage" source="@Embed(source='assets/Nokia_6630.png')"/> </s:VGroup> </s:VGroup> </s:Application>
Wed Nov 21 2018, 06:34 AM -08:00