I am creating a game for android and I would like the sprites to have the look of an old NES game. I have some 12×12 pixel images and would like them to keep their pixelated look as they are scaled up.
Please view the following link
https://i.stack.imgur.com/kPQPn.jpg
One image is a screenshot of the image as it looks in an editor. This is how I would like it to look in game. The other image is what it actually looks like blown up in game (blurry).
The image is imported as a Drawable and I’m calling Drawable.draw(Canvas canvas) on it.
I’ve read up on the problem and found some info here (Android: drawable resolutions). I believe it’s either that anti aliasing or some kind of interpolation needs to be disabled but I cannot figure out how to do this with a Drawable.
I did however find out that it is possible with Bitmaps but my game requires lots of sprite re-scaling and, although I found this Resize Bitmap in Android I do not think re-scaling bitmaps is a good idea.
I am new Android and no where near a professional programmer so please shed some light on me.
In my app I had to do the exact same thing!
And I used pixel-sized images to save space, and a Matrix to handle rotation and scaling (though that’s your choice).
Hope this helps, good luck!
EDIT:
also if you’re using the
createScaledBitmap, or any similar functions, make sure you passfalsefor any filtering parameters.