Question

I have some very small images (20 by 20 pixels) which I am drawing using matrices onto a canvas using Canvas.drawBitmap(Bitmap, Matrix, Paint). The problem is that I am scaling these up about 5-10 times larger when I am drawing them and it is automatically re-sampling these images with smoothness. What I want is nearest-neighbour style re-sampling (so it will look pixelated) not the smoothness. I cannot find a way to change this. Also creating another whole image that is larger to store a properly re-sampled picture is not an option since I am under memory constraints. Thanks for any help!

Was it helpful?

Solution

You need to set up the paint you pass to drawBitmap, like so:

paint.setFilterBitmap(false);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top