Pregunta

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!

¿Fue útil?

Solución

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

paint.setFilterBitmap(false);

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top