Skip to content


Bitmap Data CopyChannel Method

Transfers data from one channel of another BitmapData object or the current BitmapData object into a channel of the current BitmapData object.

package
{
	import flash.display.Sprite;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.geom.Rectangle;
	import flash.geom.Point;

	public class CopyChannel extends Sprite
	{
		public function CopyChannel()
		{
			var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x336699);
			var rect:Rectangle = new Rectangle(0, 0, 200, 200);
			var pt:Point = new Point(10, 10);

			bmd.copyChannel(bmd, rect, pt, 1, 4); // the 1 and 4 represent BitmapDataChannel.RED, BitmapDataChannel.BLUE respectively

			var bm:Bitmap = new Bitmap(bmd);
			this.addChild(bm);
		}
	}
}

Posted in Actionscript 3.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.