You can use this method for a variety of effects such as general palette mapping (taking one
channel and converting it to a false color image). You can also use this method for a variety of
advanced color manipulation algorithms, such as gamma, curves, levels, and quantizing.
Availability: ActionScript 1.0; Flash Player 8
Parameters
sourceBitmap:flash.display.BitmapData
image can be a different BitmapData object, or it can refer to the current BitmapData object.
sourceRect:flash.geom.Rectangle
to use as input.
destPoint:flash.geom.Point
BitmapData object) that corresponds to upper-left corner of the source rectangle.
[optional] - If
redArray:Array
value] else red = source rect value
[optional] - If
greenArray:Array
green value] else green = source green value.
[optional] - If
blueArray:Array
value] else blue = source blue value
[optional] - If
alphaArray:Array
alpha value] else alpha = source alpha value
Example
The following example shows how to use a palette map to convert solid red to green, and solid
green to red in a single BitmapData object.
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00FF0000);
var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth()); mc.attachBitmap(myBitmapData,
this.getNextHighestDepth());
myBitmapData.fillRect(new Rectangle(51, 0, 50, 80), 0x0000FF00);
mc.onPress = function() {
var redArray:Array = new Array(256);
var greenArray:Array = new Array(256);
- The input bitmap image to use. The source
- A rectangle that defines the area of the source image
- The point within the destination image (the current
is not
redArray
null
.
is not
greenArray
is not
blueArray
null
.
is not
alphaArray
BitmapData (flash.display.BitmapData)
,
red = redArray[source red
,
null
green = greenArray[source
,
blue = blueArray[source blue
,
null
alpha = alphaArray[source
.
321
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?