1
votes

I'm new to Android, and I've finished a game which was meant to feature pixel art. I was going to scale up my images (imageviews and bitmaps drawn to canvas) from small pixelated png files. The thing is, I could not seem to disable anti-aliasing whatever method I tried. The image was always blurred. All my images are in one 'drawable' folder. I tried android:antialias="false" within the ImageView in the xml.

Tried the method described here: http://www.41post.com/4241/programming/android-disabling-anti-aliasing-for-pixel-art \ Tried changing the paint (paint.setAntiAlias(false)) when drawing the bitmap onto a canvas.

And even tried linking the ImageView to a xml bitmap drawable with antialias="false"

Am I missing something? In the end I had to just settle with leaving some images blurry and having the big images as big images and not resizing in the xml file.

1

1 Answers

1
votes

From the Hardware Acceleration Guide, it looks like Paint#setFilterBitmap() is always enabled and cannot be disabled when hardware acceleration is enabled. Try checking to see if your app is using hardware acceleration.

I've seen similar behavior in the emulator when enabling the "Use host GPU" option, and found that a device that didn't have the anti-aliasing behavior could be forced to have that behavior by using Paint#setFilterBitmap(true). I was not able to disable the behavior in the emulator though without disabling the host GPU option.