Palt
- Change the transparency of a color in the draw state for subsequent draw calls.
- col
-
- The number of the color to modify.
- t
-
- If
true
, treat this color as transparent. Iffalse
, treat this color as opaque.
- If
When the spr()
, sspr()
, and map()
functions copy sprite pixels onto the screen, some colors are considered transparent and are not drawn. By default, color 0 (black) is transparent, so when a sprite's pixel is this color and the sprite is drawn on top of an existing image, that pixel preserves the color underneath.
The palt()
function changes the transparency of a given color.
If called with only one argument, the transparency settings of all colors are specified simultaneously using a single 16-bit field, with set bits specifying transparent, and cleared bits specifying opaque. Bit 0 (value 1) is for color 15, bit 1 (value 2) for color 14, and so on, down to color 0.
If called without arguments, palt()
resets the transparency for all colors. The pal()
function called without arguments also resets transparency, though the opposite is not true and palt()
will not reset colors.
Examples
-- draw black pixels
palt(0, false)
-- don't draw red pixels
palt(8, true)
-- draw anything but black, orange, and yellow pixels
palt(0b1000000001100000)
-- reset transparency
palt()
-- pal() also resets transparency when it resets colors
pal()