How to rotate a drawable with anti-aliasing enabled

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-06-08T23:30:36Z Indexed on 2010/06/08 23:32 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

I need to rotate an ImageView by a few degrees. I'm doing this by subclassing ImageView and overloading onDraw()

@Override
protected void onDraw(Canvas canvas) {
    canvas.save();
    canvas.scale(0.92f,0.92f);
    canvas.translate(14, 0);
    canvas.rotate(1,0,0);
    super.onDraw(canvas);
    canvas.restore();
}

The problem is that the image that results shows a bunch of jaggies.

How can I antialias an ImageView that I need to rotate in order to eliminate jaggies? Is there a better way to do this?

© Stack Overflow or respective owner

Related posts about android

Related posts about image