I am trying to get a partial bitmap from an object but I am getting different values from:
object.transform.matrix.tx and object.transform.matrix.ty
v/s
object.getBounds(object.parent).x and object.getBounds(object.parent).y
I am not sure which ones should I use while drawing the bitmapdata:
bitmapdata.draw(object, <matrix>);
To add the a,b,c,d components of matrix are 1,0,0,1 (or identity). So Can someone explain in which scenarios are matrix.tx and matrix.ty different from bounds coordinates?
object.transform.matrix.txis equals toobject.xif no other transformation is applied (same fory). If you draw something to the negative coordinates, thexandyproperties ofobjectdon't change.The bounding rect of the circle drawn in this example would start at
-100,-100but the object's center is still at300,300in the parent's coordinate space. NowgetBoundsrefers to the area of the object. The area's coordinates are converted to the parent's space and happen to be200,200.When are matrix translations and bounds in the parent's coordinate space different?
Almost always, they are only the same if the object's bound (in it's own coordinate space) start at
0,0.This is partly covered by the example of
getBoundsin the documentation. I can't tell you which one should use, it depends on where you need to draw the object, but you haven't mentioned the desired position.