Saturday, August 17, 2013

[android-developers] Re: drawBitmap Flip, Scale and Translate

Anyone ?


On Saturday, August 10, 2013 9:56:24 PM UTC+5:30, decode wrote:

I have my code as below :

canvas.drawBitmap(bitmap, src, dest,p); (p is null. using default paint, src is null aswell)

src and dest are Rect

I am trying to flip the bitmap horizontally by using canvas.scale as below

            canvas.save();
            canvas.scale(-1.0f, 1.0f);
            canvas.drawBitmap(bitmap, src, dest, p);

The image just diappeared.

I am trying to use matrices. But I feel there should be some easier way around.

I want to flip the image and draw in the rect dest(positon and scaling)


Code I am trying now

    Matrix flipmatrix = new Matrix();
            flipmatrix .setScale(-1, 1);
            flipmatrix .postScale(calcScaleX, calcScaleY);
            flipmatrix .postTranslate(calcPosX,calcPosY);
            c.drawBitmap(bitmap, flipmatrix , null);



Can anyone help me with this. I am not good with matrices. I think there is a easier way out










--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate