matrix:Object
Language Version : | ActionScript 3.0 |
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
public function clone():BitmapFilter
Language Version : | ActionScript 3.0 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
Returns a copy of this filter object.
Returns | BitmapFilter — A new ColorMatrixFilter instance with all of the same
properties as the original one.
|
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- 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/c2.png')"/>
</s:VGroup>
<s:VGroup>
<s:Label text="Green Matrix Image"/>
<mx:Image id="greenImage" source="@Embed(source='assets/c2.png')"/>
</s:VGroup>
<s:VGroup>
<s:Label text="Blue Matrix Image"/>
<mx:Image id="blueImage" source="@Embed(source='assets/c2.png')"/>
</s:VGroup>
<s:VGroup>
<s:Label text="Red Matrix Image"/>
<mx:Image id="redImage" source="@Embed(source='assets/c2.png')"/>
</s:VGroup>
</s:VGroup>
</s:Application>