Here are some graphics basics. More words needed.

First, initialize the framebuffer. Do it with monolith/gfx-fb-init.


An optional zoom amount can be set with monolith/gfx-zoom.

(monolith/gfx-zoom 4) # set to 4x

Set dimensions with monolith/gfx-setsize. Note that the size cannot exceed 320x200, or 64000 pixels.

(monolith/gfx-setsize 128 128)

The currently set framebuffer dimensions can be retrieved using monolith/gfx-width and monolith/gfx-height.

(print (monolith/gfx-width))
(print (monolith/gfx-height))

Pixels can be directly written to the buffer with monolith/set-pixel, it has the arguments, x, y, then, R, G, B, A for the colors.

The code below sets a red pixel at coordinate (10, 10).

(monolith/gfx-pixel-set 10 10 255 0 0 255)

Write to PNG with monolith/gfx-write-png.