Bitmapdata rotating and incorrect widths

I have a photo that has a dynamic shape(Mask) over the top, I then want to crop the photo to the shape and resize.

Here is the code I’ve code so far


_mask.visible = false        
   _photo.mask = _mask.getShape();
 //Create a bitmapData for your mc
 var bmd:BitmapData = new BitmapData (_imageHolder.width,_imageHolder.height, true, 0xFF);
bmd.draw(_imageHolder, null, null, null, null, true);
_imageHolder.visible = false
var maskShape:Sprite = _mask.getShape();
maskShape.scaleX = maskShape.scaleY = _mask.scaleX;
maskShape.rotation = _mask.rotation;
//Create a new BitmapData for the Stripe Portion
var bmd2:BitmapData = new BitmapData(maskShape.width, maskShape.height, true, 0xFF);
            
//Copy pixels
var rect:Rectangle = new Rectangle(_mask.x-(maskShape.width/2), _mask.y-(maskShape.height/2), maskShape.width, maskShape.height)
var pt:Point = new Point(0, 0);
bmd2.copyPixels(bmd, rect, pt)

//Create a Bitmap for Bitmapdata
var croppedBitmap:Bitmap = new Bitmap(bmd2, PixelSnapping.ALWAYS);
croppedBitmap.smoothing = true;

var croppedPhoto:Photo = new Photo()
croppedPhoto.addChild(croppedBitmap);        
var maxWidth:Number = 260;
croppedPhoto.width = maxWidth;
croppedPhoto.scaleY = croppedPhoto.scaleX;
ContentManager.photo = croppedPhoto;


Works fine, but now I need to add the capability for when the Mask is rotated, at any angle. This seems to be a whole world of pain… when I correct the rotation of the cropped bitmap (croppedBitmap.rotation -= maskShape.rotation;)


//Create a Bitmap for Bitmapdatavar croppedBitmap:Bitmap = new Bitmap(bmd2, PixelSnapping.ALWAYS);
croppedBitmap.smoothing = true;
croppedBitmap.rotation -= maskShape.rotation;

I now can’t resize the image correctly…

I need to get so it resizes to a max width of 260, but now it’s resulting the cropped image being far smaller…?

Please can someone help, as I’m completely stuck…!

Thanks