How to use btprnt in monolith.

Gradually adding things as I go.


drawbits allows one to copy janet buffers to a btprnt buffer.

(def bits @"")

(var bp (monolith/btprnt-new 64 64))

# a slightly offset black box
# offset by 1 pixel
(put bits 0 0x00)
(put bits 1 0xe)
(put bits 2 0xe)
(put bits 3 0xe)
(put bits 4 0x00)

(pp bits)

# move the slightly offset box
# to be flush against the corner
 bp bits
 @(0 0 8 4)
 0 0
 8 4
 1 1)

(monolith/btprnt-write-pbm bp "bits.pbm")


The function monolith/gfx-btprnt-stencil can be used to copy a region of a btprnt buffer to a location on a monolith framebuffer using a certain color.

It takes in 10 arguments:

The btprnt instance.

x,y: the top left starting point to draw the btprnt stencil.

w,h: the width and height of the space to draw. If these exceed the bounds of the btprnt buffer, these will be ignored.

offx, offy: the starting offset values to start reading from btprnt.

R,G,B: the color to use.

(monolith/gfx-btprnt-stencil bp 0 32 width height 0 0 0 0 0)

More information on the implementation can be found in 13. btprnt + gfx framebuffer.


Done with monolith/btprnt-rect and monolith/btprnt-rect-filled.

(monolith/btprnt-rect-filled bp @(0 0 64 64) 0 0 10 10 1)
(monolith/btprnt-rect bp @(4 4 64 64) 0 0 10 10 0)


Center Box

monolith/btprnt-centerbox creates a centered subregion from a region.


monolith/btprnt-border creates a centered subregion from a region with a specified border size.