bitmaplib
A bitmap is a Blitz object, numbered from 0: a drawing surface of a
width, height and depth, the number of bitplanes. The blitting and
drawing commands draw into the used bitmap; BitMap, ScreensBitMap,
ShapesBitMap and CludgeBitMap make the bitmap they set up the used
one, and Use BitMap chooses another.
BitMap allocates a bitmap in chip memory of its own, which is freed
with the object. ScreensBitMap, ShapesBitMap and CludgeBitMap
only borrow the memory of a screen, a shape or the program; it is not
freed with the bitmap. With runtime error checking, using a bitmap that
is not set up is an error.
Based on the bitmaplib guide by Acid Software.
Library number 160. It manages BitMap objects, by default at most 10 (the compiler options set the maximum).
Commands
BitMap
Makes a bitmap of the given width, height and depth in chip memory and makes it the used bitmap; a bitmap the object held before is freed. A depth of n gives 2 to the power of n colours, 8 for a depth of 3. With runtime error checking, a depth of 0 or more than 8 is the error “Illegal BitMap Depth”, and a width or height below 1 the error “Illegal BitMap Size”.
Statement. Help text: BitMap#,Width,Height,Depth
Arguments: .w, .w, .w, .w
The pointers to the bitplanes beyond the depth are cleared in the object.
CludgeBitMap
Takes memory of the program, such as included data, as a bitmap of the given width, height and depth, with the planes one after the other, and makes it the used bitmap. The memory must be chip memory and large enough; the program is responsible for that. A game can take one block of memory at its start for all its bitmaps this way, instead of allocating and freeing them. With runtime error checking, a depth of 0 or more than 8 is the error “Illegal BitMap Depth”, and a width or height below 1 the error “Illegal BitMap Size”.
Statement. Help text: BitMap#,Width,Height,Depth,Memory
Arguments: .w, .w, .w, .w, .l
CopyBitMap
Makes the second bitmap a copy of the first, in chip memory of its own. The used bitmap does not change.
Statement. Help text: Src BitMap#,Dest BitMap#
Arguments: .w, .w
With runtime error checking, a source bitmap without memory of its own (borrowed or not set up) is the error “Can’t copy borrowed Bitmap”.
LoadBitMap
Loads an IFF ILBM picture into a bitmap that is already set up, and with Palette# its colours into that palette object. Amiga mode only.
Statement. Help text: BitMap#,Filename$[,Palette#]
2 forms:
.w, $.w, $, .w
The file is closed before each of these errors:
| Situation | Error |
|---|---|
| the file cannot be opened | “Can’t Open File”, or “Can’t Open IFF” with Palette# |
| the file has no picture header | “Can’t Find IFF ‘BMHD’” |
| the file has no picture data | “Can’t Find IFF ‘BODY’” |
| the file ends inside the picture data | “Can’t Read File” |
ScreensBitMap
Takes the bitmap of a screen as the bitmap object and makes it the used bitmap, so that the blitting and drawing commands draw on the screen. Every screen has a bitmap, also one opened without a bitmap object.
Statement. Help text: Screen#,BitMap#
Arguments: .w, .w
ShapesBitMap
Takes the bitplanes of a shape as a bitmap and makes it the used bitmap, so that a program can draw into the shape.
Statement. Help text: Shape#,BitMap#
Arguments: .w, .w