Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 使用ActionScript3.0和Flex3.0选择图像的一部分来裁剪图像_Apache Flex_Actionscript 3_Flex3 - Fatal编程技术网

Apache flex 使用ActionScript3.0和Flex3.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

通过在图像上绘制矩形,将图像裁剪为选定大小。这应该在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 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,我现在就试试看。