I have a lot of draw operations in my custom view(compass). I decided to optimize it by drawing whole compass on a bitmap in onSizeChanged()
method, instead of just drawing it directly every time onDraw()
triggers.
Here is a part of onDraw()
method:
canvas.rotate(-heading, x, y);
canvas.drawBitmap(compassBitmap, 0f, compassBitmapY, compassBitmapPaint);
My problem is what happens after rotation. Bitmap loses its quality. Setting ANTI_ALIAS_FLAG
does not help at all. Is there any way to deal with this problem or should i get back to the "heavier" implementation?
it's impossible to rotate image without loosing it's quality, it's limited by resolution.
Each pixel position need to be recalculed, if new destination is not (int, int) pixels needs to be mixed to be closest from the original image.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.