Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > BitmapData (flash.display.BitmapData) > merge (BitmapData.merge method) | |||
public merge(sourceBitmap:BitmapData, sourceRect:Rectangle, destPoint:Point, redMult:Number, greenMult:Number, blueMult:Number, alphaMult:Number) : Void
Performs per-channel blending from a source image to a destination image. The following formula is used for each channel:
new red dest = (red source * redMult) + (red dest * (256 - redMult) / 256;
The redMult, greenMult, blueMult, and alphaMult values are the multipliers used for each color channel. Their valid range is from 0 to 256.
Availability: ActionScript 1.0; Flash Player 8
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 instance) that corresponds to the upper-left corner of the source rectangle.
redMult:Number - A number by which to multiply the red channel value.
greenMult:Number - A number by which to multiply the green channel value.
blueMult:Number - A number by which to multiply the blue channel value.
alphaMult:Number - A number by which to multiply the alpha transparency value.
The following example shows how to merge part of one BitmapData with another.
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
var bitmapData_1:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
var bitmapData_2:BitmapData = new BitmapData(100, 80, false, 0x00FF0000);
var mc_1:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc_1.attachBitmap(bitmapData_1, this.getNextHighestDepth());
var mc_2:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc_2.attachBitmap(bitmapData_2, this.getNextHighestDepth());
mc_2._x = 101;
mc_1.onPress = function() {
bitmapData_1.merge(bitmapData_2, new Rectangle(0, 0, 50, 40), new Point(25, 20), 128, 0, 0, 0);
}
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00001960.html
Comments
joelamay said on Oct 13, 2005 at 3:55 PM :