0
votes

I'm writing an application that displays large bitmaps in tiles like Google Maps does. A server sends bitmaps that I draw into a scaled/translated canvas. I want this bitmaps to be drawn anti-aliased, but if I enable anti aliasing on the canvas, the edged of the bitmaps are mixed up with the background (none/black) and produce ugly dark lines between the tiles. Is there a way to tell Android not to antialias the edges of the bitmap on drawing? Or what other soulutions exist for that problem?

2

2 Answers

1
votes

You don't enable anti-aliasing on the canvas, you enable it on the Paint object you provide to Canvas.drawBitmap(). So the solution here, I believe, is to use two different Paint objects, the first with AA off for drawing bitmaps, and the second with AA on for drawing everything else.

You may still be interested in using Paint.setDither() or Paint.setFilterBitmap() to affect how the bitmaps are drawn.

0
votes

Let me answer the question on my own: I got confused because I thought antialiasing was the feature I needed. In fact, setting antialias to false and bitmapfiltering to true on the Paint-object solved the problem. Antialiaising set to true made the ugly lines between the tiles. Thanks!