| 套件 | spark.filters |
| 類別 | public class ColorMatrixFilter |
| 繼承 | ColorMatrixFilter BaseFilter EventDispatcher Object |
| 實作 | IBitmapFilter |
| 語言版本: | ActionScript 3.0 |
| 產品版本: | Flex 4 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
隱藏 MXML 語法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]"
/>
更多範例
相關 API 元素
公用屬性
| 屬性 | 定義自 | ||
|---|---|---|---|
![]() | constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | |
| matrix : Object
A comma delimited list of 20 doubles that comprise a 4x5 matrix applied to the
rendered element. | ColorMatrixFilter | ||
公用方法
| 方法 | 定義自 | ||
|---|---|---|---|
ColorMatrixFilter(matrix:Array = null)
Constructor. | ColorMatrixFilter | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。 | EventDispatcher | |
Returns a copy of this filter object. | ColorMatrixFilter | ||
![]() |
會將事件傳送到事件流程。 | EventDispatcher | |
![]() |
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。 | EventDispatcher | |
![]() |
指出物件是否有已定義的指定屬性。 | Object | |
![]() |
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | |
![]() |
Propagates a change event when the filter has changed. | BaseFilter | |
![]() |
指出指定的屬性是否存在,以及是否可列舉。 | Object | |
![]() |
會從 EventDispatcher 物件移除偵聽程式。 | EventDispatcher | |
![]() |
為迴圈作業設定動態屬性的可用性。 | Object | |
![]() |
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | |
![]() |
會傳回指定之物件的字串形式。 | Object | |
![]() |
會傳回指定之物件的基本值。 | Object | |
![]() |
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。 | EventDispatcher | |
屬性詳細資訊
matrix | 屬性 |
matrix:Object| 語言版本: | ActionScript 3.0 |
| 產品版本: | Flex 4 |
| 執行階段版本: | 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.
預設值為 [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]。
實作
public function get matrix():Object public function set matrix(value:Object):void建構函式詳細資料
ColorMatrixFilter | () | 建構函式 |
方法詳細資訊
clone | () | 方法 |
public function clone():BitmapFilter| 語言版本: | ActionScript 3.0 |
| 產品版本: | Flex 4 |
| 執行階段版本: | Flash Player 10, AIR 1.5 |
Returns a copy of this filter object.
傳回值BitmapFilter — A new ColorMatrixFilter instance with all of the same
properties as the original one.
|
範例 如何使用本範例
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>
Tue Jun 12 2018, 03:47 PM Z
顯示 MXML 語法