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

Macros

#define BM   ((struct bb_bitmap *)blitz_string)

Functions

void _bitmapchk (void)
void _bitloadchk (void)
void bitmaplib_sbchk (void)
void cbchk (void)
void cludgechk (void)
void shchk (void)
void _usechk (void)
void extbitmap (void)
void _bitmap (UWORD w, UWORD h, UWORD d, WORD usedoff)
 BitMap BitMap#,Width,Height,Depth: a new bitmap in chip memory.
void _bitload (const UBYTE *name, struct bb_bitmap *bm)
 LoadBitMap BitMap#,Filename$: load an ILBM into the bitmap.
void _bitload2 (const UBYTE *name, APTR pal, struct bb_bitmap *bm)
 LoadBitMap BitMap#,Filename$,Palette#: LoadBitMap, first the palette (palettelib +3, a0 = name, a1 = palette).
void doscbitmap (UBYTE **scr, WORD usedoff)
 ScreensBitMap Screen#,BitMap#: the bitmap of a screen (borrowed, isreal = 1).
void docopybitmap (struct bb_bitmap *src)
 CopyBitMap Src BitMap#,Dest BitMap#: a copy of the source bitmap in own chip memory.
void doshbitmap (const struct bb_shape *shape, WORD usedoff)
 ShapesBitMap Shape#,BitMap#: a bitmap on the planes of a shape (borrowed, isreal = 1).
void _cludgebitmap (UWORD w, UWORD h, UWORD d, ULONG mem, WORD usedoff)
 CludgeBitMap BitMap#,Width,Height,Depth,Memory: a bitmap in memory of the program (borrowed, isreal = 1).
void _freebitmap (void)
 Free BitMap (the object's _free nullsub): free the planes of the bitmap in a3 if they are its own memory (isreal < 0).
static void setused (WORD off)
static ULONG bmbytes (UWORD rows, UWORD depth, UWORD bpr)
static void freebitmap (struct bb_bitmap *b)
static void prepxtra (struct bb_bitmap *b)
static void ext (struct bb_bitmap *b, UWORD w, UWORD h, UWORD d)
static void extbitmap_c (UWORD w, UWORD h, UWORD d)
 extbitmap (nullsub, for other libraries): allocate and set up the bitmap in a3 without freeing it first.
static void bmsize (WORD w, WORD h)
static void _bitmapchk_c (WORD w, WORD h, UWORD d)
static void cludgechk_c (WORD w, WORD h, UWORD d)
static void _usechk_c (void)
static void _bitloadchk_c (const struct bb_bitmap *b)
static void sbchk_c (const ULONG *s)
static void shchk_c (const ULONG *s)
static void cbchk_c (const struct bb_bitmap *b)

Macro Definition Documentation

◆ BM

#define BM   ((struct bb_bitmap *)blitz_string)

Function Documentation

◆ _bitload()

void _bitload ( const UBYTE * name,
struct bb_bitmap * bm )

LoadBitMap BitMap#,Filename$: load an ILBM into the bitmap.

Amiga mode only. ilbmifflib +3 ilbmbitmap (a0 = name, a1 = bitmap). Errors (debugger, _bitloadchk): "Uninitialized BitMap".

Parameters
named1: the file name
bma1: the bitmap (!libs {bitmaplib,$1180})

◆ _bitload2()

void _bitload2 ( const UBYTE * name,
APTR pal,
struct bb_bitmap * bm )

LoadBitMap BitMap#,Filename$,Palette#: LoadBitMap, first the palette (palettelib +3, a0 = name, a1 = palette).

Amiga mode only. Errors (debugger, _bitloadchk): "Uninitialized BitMap".

Parameters
named1: the file name
pala0: the palette (!libs {palettelib,$1082})
bma1: the bitmap (!libs {bitmaplib,$1180})

◆ _bitloadchk()

void _bitloadchk ( void )

◆ _bitloadchk_c()

void _bitloadchk_c ( const struct bb_bitmap * b)
static

◆ _bitmap()

void _bitmap ( UWORD w,
UWORD h,
UWORD d,
WORD usedoff )

BitMap BitMap#,Width,Height,Depth: a new bitmap in chip memory.

Becomes the used bitmap; frees the old one, isreal = -1 (own memory), then as extbitmap (fixed, #76: the size is a long product); the plane pointers beyond the depth are cleared (fixed, #80: the original left what the object held). Errors (debugger, _bitmapchk): "Illegal BitMap Depth" if the depth is 0 or more than 8 (fixed, #1040: the original raised error number 1, "No currently used object!"); "Illegal BitMap Size" for a width or height below 1 (fixed, #78: not in the original). The bitmap object comes in a3 (!libs {bitmaplib,$1380/$1381}).

Parameters
wd1.w: the width in pixels
hd2.w: the height
dd3.w: the depth
usedoffd6: offset of the used bitmap from a5 (!libs {bitmaplib,$0604}); it becomes this bitmap

◆ _bitmapchk()

void _bitmapchk ( void )

◆ _bitmapchk_c()

void _bitmapchk_c ( WORD w,
WORD h,
UWORD d )
static

◆ _cludgebitmap()

void _cludgebitmap ( UWORD w,
UWORD h,
UWORD d,
ULONG mem,
WORD usedoff )

CludgeBitMap BitMap#,Width,Height,Depth,Memory: a bitmap in memory of the program (borrowed, isreal = 1).

Becomes the used bitmap; frees the old one; the planes follow each other in the memory. No interleave check: not a bug (no visible effect, #77): +52 is cleared, the plane distance +54 stays from before. The bitmap object comes in a3 (!libs {bitmaplib,$1380/$1381}). Errors (debugger, cludgechk): "Illegal BitMap Depth" for a depth of 0 or more than 8 (fixed, #393 #74: the original had no check); "Illegal BitMap Size" for a width or height below 1 (fixed, #78).

Parameters
wd1.w: the width in pixels
hd2.w: the height
dd3.w: the depth
memd4: the memory (chip memory for display/blits)
usedoffd6: offset of the used bitmap from a5 (!libs {bitmaplib,$0604}); it becomes this bitmap

◆ _freebitmap()

void _freebitmap ( void )

Free BitMap (the object's _free nullsub): free the planes of the bitmap in a3 if they are its own memory (isreal < 0).

memlib globfree of rows * depth * bytes per row (fixed, #76: a long product, the original's MULUs kept the low word of rows * depth); isreal = 0.

◆ _usechk()

void _usechk ( void )

◆ _usechk_c()

void _usechk_c ( void )
static

◆ bitmaplib_sbchk()

void bitmaplib_sbchk ( void )

◆ bmbytes()

ULONG bmbytes ( UWORD rows,
UWORD depth,
UWORD bpr )
static

◆ bmsize()

void bmsize ( WORD w,
WORD h )
static

◆ cbchk()

void cbchk ( void )

◆ cbchk_c()

void cbchk_c ( const struct bb_bitmap * b)
static

◆ cludgechk()

void cludgechk ( void )

◆ cludgechk_c()

void cludgechk_c ( WORD w,
WORD h,
UWORD d )
static

◆ docopybitmap()

void docopybitmap ( struct bb_bitmap * src)

CopyBitMap Src BitMap#,Dest BitMap#: a copy of the source bitmap in own chip memory.

Frees the destination, allocates one MEMF_CHIP block (not cleared) and copies plane by plane. BUG(orig): (bytes per row * rows) / 2 words per plane, 0 words = 4 billion (#78: such a source is refused at its creation with runtime error checking); the size is a long product (fixed, #76). Not a bug: the used bitmap is not set (CopyBitMap is not documented to select it). Errors (debugger, cbchk): "Can't copy borrowed Bitmap" (the destination is borrowed).

Parameters
srca2: the source bitmap (!libs {bitmaplib,$1280}); the destination comes in a3 ($1381)

◆ doscbitmap()

void doscbitmap ( UBYTE ** scr,
WORD usedoff )

ScreensBitMap Screen#,BitMap#: the bitmap of a screen (borrowed, isreal = 1).

Becomes the used bitmap; frees the old one, copies the screen's struct BitMap (RastPort.BitMap, 40 bytes), then the extra fields. Errors (debugger, sbchk): "Uninitialized Screen".

Parameters
scra2: the screen object (!libs {screenslib,$1280}): its Screen; the bitmap comes in a3 ($1381)
usedoffd6: offset of the used bitmap from a5 (!libs {bitmaplib,$0604}); it becomes this bitmap

◆ doshbitmap()

void doshbitmap ( const struct bb_shape * shape,
WORD usedoff )

ShapesBitMap Shape#,BitMap#: a bitmap on the planes of a shape (borrowed, isreal = 1).

Becomes the used bitmap; frees the old one; bytes per row, rows and depth from the shape. Fixed (#79): the plane size is added unsigned (the original added it as a sign extended word: planes of 32 KB and more pointed backwards). Errors (debugger, shchk): "Uninitialized Shape".

Parameters
shapea2: the shape (!libs {shapeslib,$1280}); the bitmap comes in a3 ($1381)
usedoffd6: offset of the used bitmap from a5 (!libs {bitmaplib,$0604}); it becomes this bitmap

◆ ext()

void ext ( struct bb_bitmap * b,
UWORD w,
UWORD h,
UWORD d )
static

◆ extbitmap()

void extbitmap ( void )

◆ extbitmap_c()

void extbitmap_c ( UWORD w,
UWORD h,
UWORD d )
static

extbitmap (nullsub, for other libraries): allocate and set up the bitmap in a3 without freeing it first.

Even byte width, one MEMF_CHIP|MEMF_CLEAR block for all planes (memlib globalloc; fixed (#76): the size is a long product), then the extra fields (prepxtra). isreal is not set.

Parameters
wd1.w: the width in pixels
hd2.w: the height
dd3.w: the depth

◆ freebitmap()

void freebitmap ( struct bb_bitmap * b)
static

◆ prepxtra()

void prepxtra ( struct bb_bitmap * b)
static

◆ sbchk_c()

void sbchk_c ( const ULONG * s)
static

◆ setused()

void setused ( WORD off)
static

◆ shchk()

void shchk ( void )

◆ shchk_c()

void shchk_c ( const ULONG * s)
static