views:

16

answers:

0

I know how to rotate a BlackBerry Bitmap image an arbitrary angle with drawTexturePath. But, The Rotation Anchor is at the top-top left of the image. How do I move the Anchor to the center of the image?

This code uses Graphics.drawTexturedPath to rotate around top-left corner:

int[] x = new int[] {0, width, width, 0};
int[] y = new int[] {0, 0, height, height};
int angle32 = Fixed32.toFP(angleDegrees);
int dux = Fixed32.cosd(angle32);
int dvx = -Fixed32.sind(angle32);
int duy = Fixed32.sind(angle32);         
int dvy = Fixed32.cosd(angle32);       
graphics.drawTexturedPath(x, y, null, null, 0, 0, dvx, dux, dvy, duy, bitmapImage);

How do I modify this code to rotate around the center of the image with drawTexturedPath (http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/ui/Graphics.html#drawTexturedPath)?

FYI, a similar post describes other 2D afine transformations with drawTexturedPath including skew and some 3D effects here: "BlackBerry - image 3D transform" (http://stackoverflow.com/questions/1212651/blackberry-image-3d-transform).

-Thanks in advance, David Pixelmonks.com