Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you need to crop a rectangle with rotation, you can use <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/BitmapData.html#draw()" rel="noreferrer"><code>draw</code></a> method as suggested by <em>shortstick</em> to crop the red area as shown below:</p> <p><a href="http://axly.org/_tmp/stackoverflow/crop_sample.png" rel="noreferrer">alt text http://axly.org/_tmp/stackoverflow/crop_sample.png</a></p> <pre><code>var crop_rect:Rectangle = new Rectangle(0,0,64,57);//size of the segment to copy var crop_point:Point = new Point(40,50);//relative position of the crop from the top/left corner of the image var crop_angle:Number = Math.PI / 12;//angle of the crop relative to image in radians (clockwise) //transformation [tx,ty] parameters representing shift after rotation var dA:Number = Math.atan(crop_point.y / crop_point.x) - crop_angle; var tX:Number = crop_point.length * Math.cos(dA); var tY:Number = crop_point.length * Math.sin(dA); var scaleMatrix:Matrix = new Matrix(Math.cos( - crop_angle),Math.sin( - crop_angle), - Math.sin( - crop_angle),Math.cos( - crop_angle), - tX, - tY); var colorTransform:ColorTransform = new ColorTransform();//no colour transformation needed //copy selected segment after rotation and shift to match the size of the crop var result_bitmap = new BitmapData(crop_rect.width,crop_rect.height); result_bitmap.draw(source_img, scaleMatrix , colorTransform, null, crop_rect, true); var result_img:Bitmap = new Bitmap(result_bitmap); </code></pre> <p>The result is below: <a href="http://axly.org/_tmp/stackoverflow/crop_result.png" rel="noreferrer">alt text http://axly.org/_tmp/stackoverflow/crop_result.png</a> Hope that is what you were looking for, otherwise please give more details and, even better, a visual sample.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload