User Guide

BitmapData (flash.display.BitmapData) 321
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 - The input bitmap image to use. The source
image can be a different BitmapData object, or it can refer to the current BitmapData object.
sourceRect:flash.geom.Rectangle - A rectangle that defines the area of the source image
to use as input.
destPoint:flash.geom.Point - The point within the destination image (the current
BitmapData object) that corresponds to upper-left corner of the source rectangle.
redArray:Array [optional] - If redArray is not null, red = redArray[source red
value] else red = source rect value
.
greenArray:Array [optional] - If greenArray is not null, green = greenArray[source
green value] else green = source green value.
blueArray:Array
[optional] - If blueArray is not null, blue = blueArray[source blue
value] else blue = source blue value
.
alphaArray:Array [optional] - If alphaArray is not null, alpha = alphaArray[source
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);