Posts Tagged ‘Canvas’

Posts that contains code that uses that ‘Canvas’ class.

Android: Disabling anti-aliasing for pixel art

Click here to read Android: Disabling anti-aliasing for pixel art

Android is great when it comes to displaying scaled pictures in applications and games since it tries to interpolate the pixels, making the resulting image look as good as possible. That works for almost every case, however, what about pixel art? This behavior isn’t good for that because, after scaling it, the resulting image will be “smoothed out”, invalidating the handcrafted pixel placement.

There are two options in this case: use an image with the correct size and never scale it, or try to disable anything that could be aliasing the image. This post is going to describe how to do the latter. As usual, an example project is available for download at the end of the post. (more…)

Android OpenGL: Texture from Canvas

Click here to read Android OpenGL: Texture from Canvas

Another post about Android programming, although this time, it’s going to incorporate some OpenGL techniques. The code below shows how to draw a Canvas into a Bitmap, and then, load it as a OpenGL texture object. This means that it is possible to use all Canvas methods to draw into a texture, like drawCircle(), drawPoints() or drawText(). This is useful to render text to a texture and to dynamically generate textures.

So here’s the code: (more…)