FANDOM


fillp( [pat] )

Sets the fill pattern.

pat
A bitfield representing the fill pattern to use.

The fill pattern is part of the draw state. It affects circ(), circfill(), rect(), rectfill(), pset(), and line().

The pattern is a bitfield, a single number that represents a 4x4 pixel pattern. The bits correspond to squares in the pattern:

32768 16384 8192 4096
2048 1024 512 256
128 64 32 16
8 4 2 1

The easiest way to represent this pattern in source code is as a binary number literal:

fillp(0b0011001111001100)
 
-- A checkerboard pattern:
--     0011
--     0011
--     1100
--     1100

The default pattern is a solid fill (0b0000000000000000). You can reset the pattern by calling fillp() with no arguments.

The color parameter to the drawing functions (such as circfill()) can set two colors, to be used for the on bits (1's) and off bits (0's) of the pattern. The four lower bits of the color value are the "on" color, and the higher bits are the "off" color. For example, to draw the on bits as light blue (12, or 0xc) and the off bits as dark blue (1), set the color to 0x1c (28).

fillp(0b0011001111001100)
circfill(60, 60, 10, 0x1c)

Alternatively, you can set the pattern to make the off bits transparent (showing what is drawn underneath). To do this, add 0b0.1 to the pattern value:

rectfill(0, 0, 127, 127, 3)
fillp(0b0011001111001100.1)
circfill(60, 60, 10, 0xc)

Examples Edit

cls()
fillp()
rectfill(0,0,127,127,1)
fillp(0b0011001111001100)
circfill(40, 40, 10, 8)
fillp()
circ(40, 40, 10, 7)
 
circfill(80, 80, 10, 6)
fillp(0b0011001111001100.1)
circfill(80, 80, 10, 8)
fillp()
circ(80, 80, 10, 7)
 
fillp(0b0011011011000110)
rectfill(20, 100, 108, 120, 0xe8)
PICO-8 002

See also Edit