hello,

I want to draw a fliped image and try following code:

   sprite =
BitmapFactory.decodeResource(appContext.getResources(),R.drawable.spritegfx);
   Matrix temp1=new Matrix();
   temp1.preScale(-1.0f,1.0f);
   canvas.drawBitmap(sprite, temp1, null);

But it does not work. neither work for the following code:

   sprite =
BitmapFactory.decodeResource(appContext.getResources(),R.drawable.spritegfx);
   canvas.save();
   canvas.scale(-1.0f, 1.0f);
   canvas.drawBitmap(sprite, 0,0, null);
   canvas.restore();

Any idea for this problem please?

Any way, following code do work.
   sprite =
BitmapFactory.decodeResource(appContext.getResources(),R.drawable.spritegfx);
   Matrix temp1=new Matrix();
   temp1.preScale(-1.0f,1.0f);
   flipedSprite = Bitmap.createBitmap(sprite , 0, 0,
sprite .getWidth(),
                        sprite .getHeight(), temp1, false);
   canvas.drawBitmap(flipedSprite , 0,0, null);

But I just don't want to create a new bitmap for every fliped image
because there're a lot of fliped or mirrored image in my program.






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to