Apache flex 使用ActionScript3.0和Flex3.0选择图像的一部分来裁剪图像
通过在图像上绘制矩形,将图像裁剪为选定大小。这应该在ActionScript 3.0和Flex 3.0中完成Apache flex 使用ActionScript3.0和Flex3.0选择图像的一部分来裁剪图像,apache-flex,actionscript-3,flex3,Apache Flex,Actionscript 3,Flex3,通过在图像上绘制矩形,将图像裁剪为选定大小。这应该在ActionScript 3.0和Flex 3.0中完成 暖RGD,您可以使用BitmapData.copyPixels()进行此操作 //create a rectangle var cropRect:Rectangle = new Rectangle(left, top, width, height); //create new bitmap data - because BitmapData's width/height are read
暖RGD,您可以使用
BitmapData.copyPixels()
进行此操作
//create a rectangle
var cropRect:Rectangle = new Rectangle(left, top, width, height);
//create new bitmap data - because BitmapData's width/height are read only
var bmpData:BitmapData = new BitmapData(cropRect.width, cropRect.height, true);
bmpData.copyPixels(image.bitmapData, cropRect, new Point(0, 0));
//assign the cropped bitmap data to the image.
image.bitmapData = bmpData;
copyPixels()
提供一个快速例程,在图像之间执行像素操作,无拉伸、旋转或颜色效果。此方法将源图像的矩形区域复制到目标BitmapData对象的目标点处相同大小的矩形区域
您可以为此使用
BitmapData.copyPixels()
//create a rectangle
var cropRect:Rectangle = new Rectangle(left, top, width, height);
//create new bitmap data - because BitmapData's width/height are read only
var bmpData:BitmapData = new BitmapData(cropRect.width, cropRect.height, true);
bmpData.copyPixels(image.bitmapData, cropRect, new Point(0, 0));
//assign the cropped bitmap data to the image.
image.bitmapData = bmpData;
copyPixels()
提供一个快速例程,在图像之间执行像素操作,无拉伸、旋转或颜色效果。此方法将源图像的矩形区域复制到目标BitmapData对象的目标点处相同大小的矩形区域
Thx Amargosh,我现在就试试看。Thx Amargosh,我现在就试试看。