|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Macros | |
| #define | __NOLIBBASE__ |
| #define | HANDLES(s) |
| #define | TOK_docookie ((LIB_shapeslib << 7) + 11) |
| #define | TOK_qmultiply 0xca00 /* lmullib: d0.q * d1.q */ |
| #define | TOK_qdivide 0xcb00 /* ldivlib: d0.q / d1.q */ |
Functions | |
| void | doscale (void) |
| void | doscale2 (void) |
| void | doxflip (void) |
| void | doyflip (void) |
| void | dorotate (void) |
| void | scalechk (void) |
| void | scalechk2 (void) |
| void | shapetrixlib_fchk (void) |
| void | rotchk (void) |
| static void * | globalloc (ULONG size, ULONG flags) |
| static void | globfree (void *mem, ULONG size) |
| static void | docookie (struct bb_shape *shape) |
| static ULONG | qcall (ULONG val, ULONG a, ULONG b) |
| static void | cookieit (struct bb_shape *s) |
| static void | allocshape (struct bb_shape *ns) |
| static void | makeshape (struct bb_shape *shape) |
| static UBYTE | flipbyte (UBYTE b) |
| static void | blitwait (volatile UBYTE *chip) |
| static void | xflip (struct bb_shape *s, volatile UBYTE *chip) |
| void | b_doxflip_c (volatile UBYTE *chip) |
| XFlip Shape# - mirror a shape horizontally (Blitz mode). | |
| BLITZ_ALIAS (b_doxflip, b_doxflip_c) | |
| void | a_doxflip_c (volatile UBYTE *chip, struct GfxBase *gfx) |
| XFlip Shape# in Amiga mode: OwnBlitter, flip, wait for the blitter, DisownBlitter (fixed #271: the original's wait is BTST twice without a loop). | |
| static void | doyflip_c (void) |
| YFlip Shape# - mirror a shape vertically (rows swapped plane by plane); a3 = the shape. | |
| BLITZ_ALIAS (doyflip, doyflip_c) | |
| static ULONG | mulsin (WORD val, UWORD angle) |
| static ULONG | mulcos (WORD val, UWORD angle) |
| static void | rotit (WORD x, WORD y, UWORD angle, WORD *nx, WORD *ny) |
| static void | rotit2 (WORD x, WORD y, UWORD angle) |
| static void | dorotate_c (ULONG q) |
| Rotate Shape#,Angle Ratio - rotate a shape. | |
| BLITZ_ALIAS (dorotate, dorotate_c) | |
| static void | scale (struct bb_shape *shape, ULONG xr, ULONG yr) |
| static void | doscale2_c (ULONG xr, ULONG yr) |
| Scale Shape#,X Ratio,Y Ratio - scale a shape. | |
| BLITZ_ALIAS (doscale2, doscale2_c) | |
| static void | doscale_c (ULONG xr, ULONG yr, struct bb_palette *pal) |
| Scale Shape#,X Ratio,Y Ratio,Palette# - scale a shape, the colour choice weighted by the palette. | |
| BLITZ_ALIAS (doscale, doscale_c) | |
| static void | fchk_c (void) |
| static void | sizechk (UWORD w, UWORD h) |
| static UWORD | scaled (UWORD n, ULONG ratio) |
| static void | scalechk2_c (ULONG xr, ULONG yr) |
| static void | scalechk_c (ULONG xr, ULONG yr, struct bb_palette *pal) |
| static void | rotchk_c (ULONG q) |
Variables | |
| static struct bb_shape | newshape |
| static UWORD | colvals [256] |
| static UWORD | usevals [256] |
| static ULONG | xadd |
| static ULONG | yadd |
| static ULONG | scaleall |
| static UWORD | numcols |
| static const UWORD | qrots [65] |
| static WORD | xl |
| static WORD | yl |
| static WORD | xh |
| static WORD | yh |
| #define __NOLIBBASE__ |
| #define HANDLES | ( | s | ) |
| #define TOK_docookie ((LIB_shapeslib << 7) + 11) |
| #define TOK_qdivide 0xcb00 /* ldivlib: d0.q / d1.q */ |
| #define TOK_qmultiply 0xca00 /* lmullib: d0.q * d1.q */ |
| void a_doxflip_c | ( | volatile UBYTE * | chip, |
| struct GfxBase * | gfx ) |
XFlip Shape# in Amiga mode: OwnBlitter, flip, wait for the blitter, DisownBlitter (fixed #271: the original's wait is BTST twice without a loop).
| chip | a1: the chip base ($DFF000) |
| gfx | a6: graphics.library |
|
static |
| void b_doxflip_c | ( | volatile UBYTE * | chip | ) |
XFlip Shape# - mirror a shape horizontally (Blitz mode).
a3 = the shape. First the planes are shifted right with the blitter by ebw*8-width pixels (so the image is "hard left" after the flip; one blit per plane, the same pointer as source and destination, modulo 0), then every row's bytes are mirrored and bit-reversed by the CPU; a cookie is made again if the shape had one (shapeslib +11).
The shift uses the shape's bltsize-1 words per plane. Fixed (#271): the CPU waits for the last blit before it flips the bytes (the original did not; the result depended on timing). Fixed (#274): the row count (depth x height) is a long (the original: a MULU low word). Errors: "Uninitialized Shape" (fchk, debugger only).
| chip | a1: the chip base ($DFF000, chipbaselib) |
|
static |
| BLITZ_ALIAS | ( | b_doxflip | , |
| b_doxflip_c | ) |
| BLITZ_ALIAS | ( | dorotate | , |
| dorotate_c | ) |
| BLITZ_ALIAS | ( | doscale2 | , |
| doscale2_c | ) |
|
static |
|
static |
| void dorotate | ( | void | ) |
|
static |
Rotate Shape#,Angle Ratio - rotate a shape.
a3 = the shape. angle = Quick 0..1 -> 256 steps; the new size comes from the rotated corners; every destination pixel is rotated back (rotit, sin table, rounding +$8000) and copied when it falls inside the source. The new shape (newshape, MEMF_CHIP|MEMF_CLEAR, not checked, handle 0) replaces the old one; a cookie is made again if the shape had one.
Fixed (#274): the plane steps are unsigned (the original's ADDA.w went backwards for planes of 32K and more). Errors (rotchk, debugger only): "Uninitialized Shape", "Shape too Big" (the rotated size with a plane of 64K or more with the extra word per row; fixed, #1047: the original has no check).
| q | d1: the angle as a Quick (0..1 = a full turn) |
| void doscale | ( | void | ) |
| void doscale2 | ( | void | ) |
|
static |
Scale Shape#,X Ratio,Y Ratio - scale a shape.
a3 = the shape. New size = size * ratio (lmullib $CA00, at least 1), source steps 1/ratio (ldivlib $CB00); every destination pixel takes the colour with the highest sum of "brightness" over the source pixels it covers - without a palette every colour counts 1, so the most frequent colour. The new shape replaces the old one as in Rotate.
Fixed (#273): a target size below 1 raised to 1 collects exactly the shape's row/column (the original read 1/Ratio pixels, past the shape). Fixed (#274): unsigned plane steps, the step back over all planes a long (the original: ADDA.w, the word +26). Errors (scalechk2, debugger only): "Uninitialized Shape", "Shape too Big" (the scaled size with a plane of 64K or more with the extra word per row; fixed, #1047: the original has no check).
| xr | d1: the x ratio (Quick) |
| yr | d2: the y ratio (Quick) |
|
static |
Scale Shape#,X Ratio,Y Ratio,Palette# - scale a shape, the colour choice weighted by the palette.
As doscale2_c, the brightness of a colour = r+g+b+3 of the top bytes of the palette's entries. Not a bug (#272): entries beyond the current palette keep the values of an earlier Scale (never used: the choice only compares usevals[0..numcols]).
Errors (scalechk, debugger only): "Uninitialized Palette", "Uninitialized Shape", "Shape too Big" (fixed, #1047).
| xr | d1: the x ratio (Quick) |
| yr | d2: the y ratio (Quick) |
| pal | a2: the palette object |
| void doxflip | ( | void | ) |
| void doyflip | ( | void | ) |
|
static |
YFlip Shape# - mirror a shape vertically (rows swapped plane by plane); a3 = the shape.
A cookie is made again if the shape had one (shapeslib +11). Fixed (#274): the plane steps are unsigned (the original's ADDA.w went backwards for planes of 32K and more). Errors: "Uninitialized Shape" (fchk, debugger only).
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| void rotchk | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
| void scalechk | ( | void | ) |
| void scalechk2 | ( | void | ) |
|
static |
|
static |
|
static |
| void shapetrixlib_fchk | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |