Search code examples
graphicsprocessingscale

How to do pixel art in processing via scaling


I'd rather not recreate every draw function to use rectangles, as this seems unnecessary. I may end up using more complex draw functions like arc() and porting it to use rectangles seems like a waste of time.

Using scale() works ok, but it renders the result of the point() function as a circle. I tried putting noSmooth() in the setup() but it didn't seem to have any effect.

Ideally I'd like to have a grid of 64 X 48 pixels rendered at 640 X 480 so that each pixel is ten times as large.


Solution

  • You wouldn't have to use rect() for functions like arc(). You'd just use rect() instead of point().

    But if it really bothers you that much, consider this approach:

    • Draw everything to a 64x48 PGraphics buffer using the standard scale. This would allow you to use the point() function.
    • Then scale that PGraphics instance using the scale() or image() functions to draw it to the screen.

    More info is available in the reference.