I have a container with a masked bitmap. The scaling and rotation of this container changes at runtime, and I need to draw a masked bitmap, but I can’t find the corresponding matrix calculations for this.
My code works correctly to reflect position, scale, offset to center without rotation. When turning, the angle is correct, but the positioning is incorrect - I believe it, because the dimensions change when the rectangle is rotated.
Can someone help me figure out how to compensate for this in positioning - here is some code:
// Adjust the transformation matrix to account for the position of the container var tMatrix:Matrix = _imgContainer.transform.matrix; //Offset for container tMatrix.translate(this.x,this.y); //Offset for bounds centering tMatrix.translate(-_imgContainer.width/2,-_imgContainer.height/2); // Compensate for rotation // ???? var result_bitmap:BitmapData = new BitmapData(_maskedImg.width,_maskedImg.height,true,0x00FFFFFF); result_bitmap.lock(); result_bitmap.draw(_maskedImg,tMatrix,null,null,null,true); result_bitmap.unlock();
Thanks in advance for any help you can provide -
b
EDIT: Sorry, if I do not explain it correctly, let me try again with the image for support. I have a masked bitmap in a container that I use as a source to draw a new bitmap. This container can be scaled / rotated at runtime by the user before capturing. To do this, I pass the drawing method a transformation matrix based on the container matrix and adjust the values of tx and ty to account for a non-zero start (due to centering). Until this moment, it works fine and captures what I expect.
However - after this container is rotated, the Grab POSITION will now turn off again - presumably due to resizing, so the tx / ty offsets are now incorrect for the new container sizes. I just need to compensate for this, but I can’t figure out how to do it.
Does anyone have any experience with a transformation matrix that can help? Thanks again for that!

