[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-17 Thread bob
I thought you were using an image of an arrow? I would put a breakpoint here: screenW = w; Make sure screenW and screenH are getting set correctly. On Saturday, September 15, 2012 12:42:36 AM UTC-5, Haris wrote: Hai bob thanks for your reply... I made the change as you said... *

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-17 Thread Haris
Yes, I am using arrow as my image Here I changed my image circular to show the extend of variation...I am getting the same result for arrow.Anyway I will try as you said.. Thanks On Monday, 17 September 2012 19:42:28 UTC+5:30, bob wrote: I thought you were

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-14 Thread bob
Yes, I ran it. It works fine if you make the change I told you to make: *change this:* * * *Y = initialY;* * * *to this:* * * * Y = (int) (screenH /2) - (arrowH / 2) ;* On Thursday, September 13, 2012 11:57:24 PM UTC-5, Haris wrote: Hai bob, have you run my code..? On Monday, 10

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-14 Thread Haris
Hai bob thanks for your reply... I made the change as you said... * Y = (int) (screenH /2) - (arrowH / 2) ;* But still the same results. And here is some screen shot of my results at central position left and right

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-13 Thread bob
If you want the image in the center of the screen, change this: Y = initialY; to this: * Y = (int) (screenH /2) - (arrowH / 2) ;* On Thursday, September 13, 2012 12:43:56 AM UTC-5, Haris wrote: Hai here is my full code... package com.motionsensor; import java.util.List;

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-13 Thread Haris
Hai bob, have you run my code..? On Monday, 10 September 2012 18:48:32 UTC+5:30, Haris wrote: Hai all I am trying an application like rotating image with motion sensorMy problem is that the image does not rotate about centre properlyAnd my angle range is 0 to 90 and 0 to -90..

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-12 Thread bob
Well, for one thing, this is not right: canvas.rotate(angle, X + getWidth() 1, Y + getHeight() 1); You should be calling getWidth and getHeight on the bitmap. Something like this: canvas.rotate(angle, X + resizedBitmap.getWidth()/2, Y + resizedBitmap.getHeight()/2); On Tuesday, September

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-12 Thread Haris
Hai bob thanks for reply. I made the above change in my code but still the same resultAnd my image get distorted it's edges while rotation.. On Wednesday, 12 September 2012 20:04:12 UTC+5:30, bob wrote: Well, for one thing, this is not right: canvas.rotate(angle, X + getWidth()

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-12 Thread Haris
Hai here is my full code... package com.motionsensor; import java.util.List; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-10 Thread bob
I think you should be doing something like this: canvas.setMatrix(matrix); On Monday, September 10, 2012 8:18:32 AM UTC-5, Haris wrote: Hai all I am trying an application like rotating image with motion sensorMy problem is that the image does not rotate about centre

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-10 Thread lbendlin
canvas.save(Canvas.MATRIX_SAVE_FLAG); canvas.rotate(angle, getWidth() 1, getHeight() 1); super.dispatchDraw(canvas); canvas.restore(); On Monday, September 10, 2012 9:18:32 AM UTC-4, Haris wrote: Hai all I am trying an application like rotating image with motion

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-10 Thread bob
canvas.save(Canvas.MATRIX_SAVE_FLAG); canvas.rotate(angle, *X + *getWidth() 1, *Y +* getHeight() 1); super.dispatchDraw(canvas); canvas.restore(); On Monday, September 10, 2012 2:22:15 PM UTC-5, lbendlin wrote: canvas.save(Canvas.MATRIX_SAVE_FLAG); canvas.rotate(angle, getWidth() 1,

[android-developers] Re: Rotate image around it's centre problem with matrix rotation

2012-09-10 Thread Haris
Hai thanks for the replys I changed my code like matrix.postScale(scaleWidth, scaleHeight); matrix.postRotate(angle, X+centrex , Y+centrey ); canvas.setMatrix(matrix); Bitmap resizedBitmap = Bitmap.createBitmap(arrow, 0, 0, arrow.getWidth(),