BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
stencillib.c File Reference
#include "blitzlib.h"
#include "blitzobj.h"
#include <proto/graphics.h>

Data Structures

struct  stencil
struct  blitstate

Macros

#define __NOLIBBASE__
#define GRAPHICS_BASE_NAME   gfx
#define SBLIT_LIBS
#define SBLIT_REGS

Functions

void dostencil (void)
void stencillib_doblit (void)
void stencillib_doblitex (void)
void stencillib_doblitmode (void)
void dofreestencil (void)
void sblitchk (void)
static void doblitmode_c (UWORD m)
 SBlitMode BLTCON0 - the blitter minterm/channels for the blit of SBlit (default $FCA).
 BLITZ_ALIAS (stencillib_doblitmode, doblitmode_c)
static void freest (struct stencil *s)
static void dofreestencil_c (void)
 Free Stencil (the object library's _free) - free the stencil's memory.
static void bigstencil (UBYTE *cb, const struct bb_bitmap *bm, UBYTE *mem)
static void makestencil (struct stencil *s, const struct bb_bitmap *bm)
void b_dostencil_c (const struct bb_bitmap *bm)
 Stencil Stencil#,BitMap# - make a stencil from a bitmap: the OR of all its planes (Blitz mode variant).
void a_dostencil_c (const struct bb_bitmap *bm, struct Library *gfx)
 Stencil Stencil#,BitMap# - Amiga mode variant: as the Blitz mode one between OwnBlitter and DisownBlitter.
BL_ALWAYS_INLINE void sblit (const struct stencil *s, const struct bb_shape *shape, const struct bb_bitmap *bm, UBYTE *cb, WORD x, WORD y, struct blitstate *st)
BL_ALWAYS_INLINE void sblitex (const struct stencil *s, const struct bb_shape *shape, const struct bb_bitmap *bm, UBYTE *cb, WORD x, WORD y, UWORD bits)
static BLITZ_ENTRYPOINT void b_doblit_c (WORD x, WORD y, const struct stencil *s, UBYTE *cb, const struct bb_bitmap *bm)
 SBlit Stencil#,Shape#,X,Y - blit a shape and add its cookie to the stencil (Blitz mode variant).
 BLITZ_EP_MARK (b_doblit_c)
static void a_doblit_c (WORD x, WORD y, const struct stencil *s, UBYTE *cb, const struct bb_bitmap *bm, struct Library *gfx)
 SBlit Stencil#,Shape#,X,Y - Amiga mode variant: as the Blitz mode one between OwnBlitter and DisownBlitter.
static BLITZ_ENTRYPOINT void b_doblitex_c (WORD x, WORD y, const struct stencil *s, UBYTE *cb, const struct bb_bitmap *bm, UWORD bits)
 SBlit Stencil#,Shape#,X,Y,Excessonoff - SBlit, then the bitmap's planes beyond the shape's depth (Blitz mode variant).
 BLITZ_EP_MARK (b_doblitex_c)
static void a_doblitex_c (WORD x, WORD y, const struct stencil *s, UBYTE *cb, const struct bb_bitmap *bm, UWORD bits, struct Library *gfx)
 SBlit Stencil#,Shape#,X,Y,Excessonoff - Amiga mode variant: as the Blitz mode one between OwnBlitter and DisownBlitter.
static void sblitchk_c (WORD x, WORD y, const struct stencil *s, const struct bb_bitmap *bm)

Variables

 SBLIT_LIBS
static UWORD bcon0 = 0xfca

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ GRAPHICS_BASE_NAME

#define GRAPHICS_BASE_NAME   gfx

◆ SBLIT_LIBS

#define SBLIT_LIBS
Value:
BLITZ_LIBS(LIB_stencillib, BL_IA0|BL_PD0, LIB_shapeslib, BL_IA3|BL_PD1, \
LIB_graphicslib, BL_IFAMIGA|BL_LA6, LIB_bitmaplib, BL_UA2, \
LIB_chipbaselib, BL_LA1)
#define BL_IA0
Definition blitzlib.h:239
#define BL_LA1
Definition blitzlib.h:198
#define BL_PD0
Definition blitzlib.h:231
#define BL_IA3
Definition blitzlib.h:242
#define BL_LA6
Definition blitzlib.h:201
#define BL_PD1
Definition blitzlib.h:232
#define BL_UA2
Definition blitzlib.h:213
#define BL_IFAMIGA
Definition blitzlib.h:187
#define BLITZ_LIBS(...)
Definition blitzlib.h:361

◆ SBLIT_REGS

#define SBLIT_REGS
Value:
WORD x BL_REG(d2), WORD y BL_REG(d3), const struct stencil *s BL_REG(a0), \
UBYTE *cb BL_REG(a1), const struct bb_bitmap *bm BL_REG(a2)
ULONG x
Definition 2dlib.c:2491
WORD y
Definition 2dlib.c:285
#define BL_REG(r)
Definition blitzlib.h:280
struct BitMap bm
Definition iffmakelib.c:162
A BitMap object, 64 bytes: a struct BitMap (+0 .. +39) and the Blitz fields behind it.
Definition blitzobj.h:87
Definition bblitlib.c:148

Function Documentation

◆ a_doblit_c()

void a_doblit_c ( WORD x,
WORD y,
const struct stencil * s,
UBYTE * cb,
const struct bb_bitmap * bm,
struct Library * gfx )
static

SBlit Stencil#,Shape#,X,Y - Amiga mode variant: as the Blitz mode one between OwnBlitter and DisownBlitter.

Parameters
xd2: x position
yd3: y position
sa0: the stencil object
cba1: the chip base
bma2: the used bitmap; a3: the shape
gfxa6: graphics.library

◆ a_doblitex_c()

void a_doblitex_c ( WORD x,
WORD y,
const struct stencil * s,
UBYTE * cb,
const struct bb_bitmap * bm,
UWORD bits,
struct Library * gfx )
static

SBlit Stencil#,Shape#,X,Y,Excessonoff - Amiga mode variant: as the Blitz mode one between OwnBlitter and DisownBlitter.

Parameters
xd2: x position
yd3: y position
sa0: the stencil object
cba1: the chip base
bma2: the used bitmap; a3: the shape
bitsd4.w: one bit per excess plane
gfxa6: graphics.library

◆ a_dostencil_c()

void a_dostencil_c ( const struct bb_bitmap * bm,
struct Library * gfx )

Stencil Stencil#,BitMap# - Amiga mode variant: as the Blitz mode one between OwnBlitter and DisownBlitter.

Fixed (#284): see the Blitz mode variant.

Parameters
bma2: the bitmap; a3: the stencil object
gfxa6: graphics.library

◆ b_doblit_c()

BLITZ_ENTRYPOINT void b_doblit_c ( WORD x,
WORD y,
const struct stencil * s,
UBYTE * cb,
const struct bb_bitmap * bm )
static

SBlit Stencil#,Shape#,X,Y - blit a shape and add its cookie to the stencil (Blitz mode variant).

Blits like blitlib's Blit (BLTCON0 from SBlitMode) at x/y minus the shape's handle, then ORs the cookie into the stencil at the same position (BLTCON0 $BFA).

Errors (debugger, sblitchk): "Uninitialized Stencil", "Shape does not have a cookie cut", "Unitialized BitMap", "Uninialized Shape", "Shape has too many BitPlanes", "Coords outside of BitMap".

Parameters
xd2: x position
yd3: y position
sa0: the stencil object
cba1: the chip base (chipbaselib)
bma2: the used bitmap; a3: the shape

◆ b_doblitex_c()

BLITZ_ENTRYPOINT void b_doblitex_c ( WORD x,
WORD y,
const struct stencil * s,
UBYTE * cb,
const struct bb_bitmap * bm,
UWORD bits )
static

SBlit Stencil#,Shape#,X,Y,Excessonoff - SBlit, then the bitmap's planes beyond the shape's depth (Blitz mode variant).

Per excess plane bit 0 of Excessonoff chooses set ($BFA) or clear ($B0A) through the cookie, then the next bit.

Errors (debugger, sblitchk): as SBlit.

Parameters
xd2: x position
yd3: y position
sa0: the stencil object
cba1: the chip base
bma2: the used bitmap; a3: the shape
bitsd4.w: one bit per excess plane

◆ b_dostencil_c()

void b_dostencil_c ( const struct bb_bitmap * bm)

Stencil Stencil#,BitMap# - make a stencil from a bitmap: the OR of all its planes (Blitz mode variant).

Frees the old stencil, allocates bytes per row * rows (CHIP, cleared) and ORs the planes into it with the blitter (A | C -> D, $DFF000 directly).

Fixed (#284): a bitmap of more than 1024 rows or 64 words is done in strips of at most 64 words by 1024 rows; the original's one blit of bltsize rows << 6 | bpr / 2 was right only up to those limits.

Parameters
bma2: the bitmap; a3: the stencil object

◆ bigstencil()

void bigstencil ( UBYTE * cb,
const struct bb_bitmap * bm,
UBYTE * mem )
static

◆ BLITZ_ALIAS()

BLITZ_ALIAS ( stencillib_doblitmode ,
doblitmode_c  )

◆ BLITZ_EP_MARK() [1/2]

BLITZ_EP_MARK ( b_doblit_c )

◆ BLITZ_EP_MARK() [2/2]

BLITZ_EP_MARK ( b_doblitex_c )

◆ doblitmode_c()

void doblitmode_c ( UWORD m)
static

SBlitMode BLTCON0 - the blitter minterm/channels for the blit of SBlit (default $FCA).

The cookie blit into the stencil keeps $BFA.

Parameters
md0.w: the BLTCON0 value (the shift is ORed in)

◆ dofreestencil()

void dofreestencil ( void )

◆ dofreestencil_c()

void dofreestencil_c ( void )
static

Free Stencil (the object library's _free) - free the stencil's memory.

Not a bug: the memory pointer stays (the width is cleared, which is what this routine and the SBlit check test). a3: the stencil object.

◆ dostencil()

void dostencil ( void )

◆ freest()

void freest ( struct stencil * s)
static

◆ makestencil()

void makestencil ( struct stencil * s,
const struct bb_bitmap * bm )
static

◆ sblit()

BL_ALWAYS_INLINE void sblit ( const struct stencil * s,
const struct bb_shape * shape,
const struct bb_bitmap * bm,
UBYTE * cb,
WORD x,
WORD y,
struct blitstate * st )

◆ sblitchk()

void sblitchk ( void )

◆ sblitchk_c()

void sblitchk_c ( WORD x,
WORD y,
const struct stencil * s,
const struct bb_bitmap * bm )
static

◆ sblitex()

BL_ALWAYS_INLINE void sblitex ( const struct stencil * s,
const struct bb_shape * shape,
const struct bb_bitmap * bm,
UBYTE * cb,
WORD x,
WORD y,
UWORD bits )

◆ stencillib_doblit()

void stencillib_doblit ( void )

◆ stencillib_doblitex()

void stencillib_doblitex ( void )

◆ stencillib_doblitmode()

void stencillib_doblitmode ( void )

Variable Documentation

◆ bcon0

UWORD bcon0 = 0xfca
static

◆ SBLIT_LIBS

SBLIT_LIBS