|
| void | packpbm (void) |
| void | deice (void) |
| void | iff1 (void) |
| void | unpackiff (void) |
| void | ilbmpalette (void) |
| void | ilbmpalette2 (void) |
| void | ilbmgrab (void) |
| void | ilbmloadnopal (void) |
| void | ilbmload (void) |
| void | chunkheader (void) |
| void | unpackpbm (void) |
| static void | libinit (void) |
| | init: does nothing (RTS).
|
| static void | libfinit (void) |
| | finit: does nothing (RTS).
|
| static ULONG | chunkheader_c (const UBYTE *s) |
| | ChunkHeader(a$): the first long of a string, as an IFF id.
|
| static void | unpackpbm_c (const UBYTE *src, UBYTE *dst, ULONG len, ULONG dlen) |
| | UnPackPBM sourceaddr,destaddr,length,destlength: unpacks ByteRun1 data.
|
| static ULONG | packpbm_c (const UBYTE *src, UBYTE *dst, ULONG size) |
| | PackPBM(sourceaddr,destaddr,length): packs data with ByteRun1.
|
| static int | ice_bit (struct ice *s) |
| static UWORD | ice_bits (struct ice *s, UWORD n) |
| static void | ice_normal (struct ice *s) |
| static ULONG | getinfo (const UBYTE *p) |
| static BB_BOOL | deice_c (const UBYTE *src, UBYTE *dst) |
| | DeIce(sourceaddr,destaddr): unpacks Pack-Ice 2.40 data.
|
| static const UBYTE * | walkform (const UBYTE *form, ULONG id) |
| | The chunk id of a FORM, found by walking its chunks (fixed #766).
|
| static const UBYTE * | skiprow (const UBYTE *body, UBYTE packed) |
| | Skips the mask row of a line (fixed #1112), as UnpackIFF reads a plane row: uncompressed its bytes, ByteRun1 its runs (a run past the end of the row skipped whole).
|
| static BB_BOOL | unpackiff_c (const UBYTE *src, struct BitMap *bm, ULONG lines, ULONG xy) |
| | UnpackIFF(sourceaddr,bitmap#,numlines,xy_offset): the BODY of an ILBM in memory into a bitmap.
|
| static BB_BOOL | iff1_c (const UBYTE *src, struct BitMap *bm, ULONG lines) |
| | UnpackIFF(sourceaddr,bitmap#): all lines, no offset (MOVE.w #-1,d2:MOVEQ #0,d3).
|
| static BB_BOOL | ilbmpalette2_c (const UBYTE *src, struct bb_palette *obj, LONG offset) |
| | ILBMPalette(sourceaddr,palette#,offset): the CMAP of an ILBM into a palette object.
|
| static BB_BOOL | ilbmpalette_c (const UBYTE *src, struct bb_palette *obj) |
| | ILBMPalette(sourceaddr,palette#): as with offset -1 (a new colour block).
|
| static void | ilbmgrab_c (const UBYTE *src, struct BitMap *bm, struct bb_palette *pal, ULONG lines) |
| | ILBMGrab sourceaddr,bitmap#,palette#: UnpackIFF(source,bitmap#) and ILBMPalette(source,palette#); the results are dropped.
|
| static BB_BOOL | ilbmload_c (ULONG name, struct BitMap *bm, struct bb_palette *pal) |
| | LoadIFF(filename$,bitmap,palette): loads an ILBM file into a bitmap and a palette.
|
| static BB_BOOL | ilbmloadnopal_c (ULONG name, struct BitMap *bm) |
| | LoadIFF(filename$,bitmap): as above without a palette.
|
| BB_BOOL deice_c |
( |
const UBYTE * | src, |
|
|
UBYTE * | dst ) |
|
static |
DeIce(sourceaddr,destaddr): unpacks Pack-Ice 2.40 data.
The data must start with "ICE!" (then the packed and the unpacked length); the picture flag of Pack-Ice converts Atari ST low-res bitplanes into interleaved words, by default 4000 groups of 8 bytes (a 32000-byte picture), else the count stored behind the flag. Fixed (#767): the flag and the count come from the data (Pack-Ice 2.34's decruncher), and at most the unpacked length / 8 groups are converted; the original's (2.40's) default count overwrote the bit buffer: the default was never used, the count was at least $3C00.
- Parameters
-
| src | d0: the packed data |
| dst | d1: the destination |
- Returns
- d0: BB_TRUE after unpacking, BB_FALSE without "ICE!"
LoadIFF(filename$,bitmap,palette): loads an ILBM file into a bitmap and a palette.
The file goes into a free bank of RIAmosFuncLib (NextBank from 0 on, fixed #770: the original's from 51 on needed BankLimit above 51; BLoad), UnpackIFF and (with a palette) ILBMPalette from there, then the bank is erased. Fixed (#771): the result is UnpackIFF's, BB_FALSE also when ILBMPalette fails; the original returned BB_TRUE whenever the file loaded.
- Parameters
-
| name | d0: the file name |
| bm | a0: the bitmap object (parameter 1) |
| pal | a1: the palette object (parameter 2), NULL: none |
- Returns
- d0: BB_TRUE, BB_FALSE if there is no bank, the file does not load, or UnpackIFF or ILBMPalette fails
ILBMPalette(sourceaddr,palette#,offset): the CMAP of an ILBM into a palette object.
Finds the CMAP by walking the FORM at source (fixed #766), else by the raw search of the original (5122 bytes from source, by 2 bytes: also a CMAP chunk at source itself), and writes its colours from colour offset on; offset < 0 gives the object a new colour block of the CMAP's size (the old one freed: "this information is deleted"). Fixed (#769, #991): with an offset, a palette with fewer than offset + CMAP colours (or none) grows: a new block for offset + CMAP colours, the old colours copied into it, the ones between cleared, the cycles kept (as palettelib's DecodePalette since #226); the original replaced it with a block of the CMAP's size and ignored the offset (#769), or for a palette without a block wrote the colours offset * 12 bytes into a block of the CMAP's size (#991). Fixed (#1105): a CMAP of fewer than 3 bytes is refused, the block is sized from the whole colour count; the original wrote 65536 colours for a CMAP below 3 bytes and sized the block from the low word of the CMAP length. The new block is allocated before the old one is freed.
- Parameters
-
| src | d0: the ILBM data |
| obj | a1: the palette object (parameter 1) |
| offset | d2: the first colour, < 0: a new block |
- Returns
- d0: BB_TRUE, BB_FALSE without CMAP, with a CMAP of no colour or of more than the 65535 colours of a palette, or without memory (the palette unchanged)
| BB_BOOL unpackiff_c |
( |
const UBYTE * | src, |
|
|
struct BitMap * | bm, |
|
|
ULONG | lines, |
|
|
ULONG | xy ) |
|
static |
UnpackIFF(sourceaddr,bitmap#,numlines,xy_offset): the BODY of an ILBM in memory into a bitmap.
Finds the BMHD and the BODY by walking the FORM ILBM at source (fixed #766; another FORM fails), else by the raw search of the original (BMHD 5120 bytes from source, BODY from the BMHD on, by 2 bytes), then unpacks numlines lines into the planes, each plane pointer + xy_offset. Fails without BMHD or BODY, if the bitmap has fewer planes or bytes per row than the picture, or no planes, or if the BMHD has no planes (fixed #777: the original stored 256 plane pointers into its table of 8). A row has the word-aligned width of ILBM (fixed #775: the original's width/8), its bytes counted in a word (fixed #774: the original's signed byte skipped rows of 129 bytes and more); a run is cut at the end of the row (fixed #776: the original wrote it into the next row). The BMHD's compression decides: 0 rows as they are, 1 ByteRun1, anything else fails (fixed #773: the original took every BODY as ByteRun1). With the BMHD's masking 1 the mask row behind the planes of every line is skipped (fixed #1112: the original decoded it as the next line's first plane).
- Parameters
-
| src | d0: the ILBM data (FORM) |
| bm | a1: the bitmap object (parameter 1) |
| lines | d2: the number of lines (word; < 0: the BMHD's height; at most the bitmap's) |
| xy | d3: the byte offset added to every plane |
- Returns
- d0: BB_TRUE, BB_FALSE on failure
| void unpackpbm_c |
( |
const UBYTE * | src, |
|
|
UBYTE * | dst, |
|
|
ULONG | len, |
|
|
ULONG | dlen ) |
|
static |
UnPackPBM sourceaddr,destaddr,length,destlength: unpacks ByteRun1 data.
n >= 0 copies n+1 bytes, n < 0 (not -128) repeats the next byte 1-n times, -128 is skipped; stops at the end of the source or of the destination. Fixed (#778): both limits are tested before each access, unsigned, also inside a literal run: nothing at or behind source+length is read, nothing at or behind dest+destlength written. The original tested after the access and signed.
- Parameters
-
| src | d0: the packed data |
| dst | d1: the destination |
| len | d2: the length of the packed data |
| dlen | d3: the size of the destination |
| const UBYTE * walkform |
( |
const UBYTE * | form, |
|
|
ULONG | id ) |
|
static |
The chunk id of a FORM, found by walking its chunks (fixed #766).
From the first chunk behind the FORM type up to the end of the FORM (its length); a chunk of odd length is followed by its pad byte when that byte is 0, otherwise the next chunk starts right behind the data (a file written without pad, as #189) - an odd address, where the walk stops (the long reads of the callers need even addresses; the raw search, the fallback, does not look there either).
- Parameters
-
| form | the FORM (its id was checked) |
| id | the chunk id |
- Returns
- the chunk (its id), NULL if the FORM has none, a length runs past the FORM's end, or the walk reaches an odd address