0

I'm working with the matrix and canvases for the first time and haven't been able to find a tutorial on this. I have been able to achieve good results with rotating a Bitmap only or skewing a Bitmap.

Currently I am able to rotate the image using:

Matrix.rotate(amount);

There are some other details to keep the shape centered around it's location as it rotates but that is not the main focus of my question.

What I want to do now is have the image rotate while being skewed into a different shape. Imagine, for example, how a spinning wheel looks when looking at it from any direction but exactly side on.

Music Monkey
  • 340
  • 4
  • 15

1 Answers1

1

Please go through this link. May be this helps you

http://android-er.blogspot.in/2010/07/rotate-bitmap-image-using-matrix.html

try this as well

Android: How to rotate a moving animated sprite based on the coordinates of its destination

Community
  • 1
  • 1
Devangi Desai
  • 1,355
  • 12
  • 17
  • Those are both great but the focus is more on skewing and rotation at the same time. What happens is mine ends up looking like a football that turns around. It may be where I decide to skew the image that is the problem. Currently the process is: 1. image scaled 2. Apply to matrix 3. matrix skewed 4. matrix rotated 5. Repeat. Should i be skewing the image before applying it to the matrix? Or skewing the matrix after rotation? – Music Monkey Oct 27 '12 at 14:07
  • I think first you should rotate image and skew it. Matrix matrix = new Matrix(); matrix.postScale(curScale, curScale); matrix.postRotate(curRotate); matrix.postSkew(curSkewX, curSkewY); – Devangi Desai Oct 27 '12 at 14:16
  • I'll try that. I notice you suggest that I create the matrix every time. Is that intentional? If i don't do that will the matrix stay skewed? – Music Monkey Oct 27 '12 at 14:19
  • yes you need to create matrix everytime, please try once doing this. – Devangi Desai Oct 27 '12 at 14:24