colorTransform (BitmapData.colorTransform method)

public colorTransform(rect:Rectangle, colorTransform:ColorTransform) : Void

Adjusts the color values in a specified area of a bitmap image by using a ColorTransform object. If the rectangle matches the boundaries of the bitmap image, this method transforms the color values of the entire image.

Availability: ActionScript 1.0; Flash Player 8

Parameters

rect:flash.geom.Rectangle - A Rectangle object that defines the area of the image in which the ColorTransform object is applied.

colorTransform:flash.geom.ColorTransform - A ColorTransform object that describes the color transformation values to apply.

Example

The following example shows how to apply a color transform operation to a BitmapData instance.

import flash.display.BitmapData;
import flash.geom.ColorTransform;

var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);

var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());

mc.onPress = function() {
    myBitmapData.colorTransform(myBitmapData.rectangle, new ColorTransform(1, 0, 0, 1, 255, 0, 0, 0));
}

See also

ColorTransform (flash.geom.ColorTransform), Rectangle (flash.geom.Rectangle)


Version 8

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00001946.html