topical media & game development
#graphic-flex-image-effects-07-source-aether-utils-ImageUtil.ax
#graphic-flex-image-effects-07-source-aether-utils-ImageUtil.ax
[swf]
[flash]
flex
package aether.utils {
import flash.display.BitmapData;
import flash.display.BitmapDataChannel;
import flash.filters.BitmapFilter;
import flash.display.DisplayObject;
import flash.geom.Point;
public class @ax-graphic-flex-image-effects-07-source-aether-utils-ImageUtil {
static public function getBitmapData(pObject:DisplayObject):BitmapData {
return ScreenCapture.drawFromObject(pObject);
}
static public function getChannelData(bitmapData:BitmapData, channel:uint):BitmapData {
var clone:BitmapData = new BitmapData(bitmapData.width, bitmapData.height);
clone.copyChannel(bitmapData, bitmapData.rect, new Point(), channel, BitmapDataChannel.RED);
clone.copyChannel(bitmapData, bitmapData.rect, new Point(), channel, BitmapDataChannel.GREEN);
clone.copyChannel(bitmapData, bitmapData.rect, new Point(), channel, BitmapDataChannel.BLUE);
return clone;
}
static public function copyChannel(source:BitmapData, dest:BitmapData, channel:uint):void {
dest.copyChannel(source, source.rect, new Point(), channel, channel);
}
static public function copyPixels(source:BitmapData, dest:BitmapData):void {
dest.copyPixels(source, source.rect, new Point());
}
static public function applyFilter(source:BitmapData, filter:BitmapFilter):void {
source.applyFilter(source, source.rect, new Point(), filter);
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.