stencillib
A stencil is a Blitz object, numbered from 0, that marks the pixels of
a bitmap’s foreground: a mask of one bitplane, set wherever the bitmap
has a colour other than 0. Stencil makes one from a bitmap, and
SBlit draws a shape as Blit does and adds it to the stencil at the
same time. The buffered blitting commands of the bblitlib library use
the stencil: after the shapes are drawn with BBlit, ShowStencil
draws the foreground over them again, so that they move behind it.
Stencil 0,0
SBlit 0,1,100,50Based on the stencillib guide by Acid Software.
Library number 122. It manages Stencil objects, by default at most 5 (the compiler options set the maximum).
Commands
SBlit
Draws a shape into the used bitmap as Blit does, at X,Y minus the shape’s handle, and adds the shape’s pixels to the stencil at the same position.
Statement. Help text: Stencil#,Shape#,X,Y[,Excessonoff]
2 forms:
.w, .w, .w, .w.w, .w, .w, .w, .w
The shape needs a cookie. Excessonoff sets the bitplanes of the
bitmap beyond the shape’s depth: bit 0 for the first of them, bit 1
for the next and so on, each set to 1 or cleared to 0 under the
shape. With runtime error checking, a stencil that has not been made
is the error “Uninitialized Stencil”, a shape without a cookie “Shape
does not have a cookie cut”.
SBlitMode
The blitter mode (the value of the BLTCON0 register) with which SBlit draws a shape; the start value is $FCA, as for BlitMode. The stencil is always added to in the same way.
Statement. Help text: BLTCON0
Arguments: .w
Stencil
Makes a stencil from a bitmap, set at every pixel that is not colour 0 in any of its bitplanes. An old stencil of the object is freed first.
Statement. Help text: Stencil#,BitMap#
Arguments: .w, .w
The stencil covers the whole bitmap, also one of more than 1024 lines or wider than 1024 pixels.