Routines | Platforms | Using BlitPixie

BlitPixie API

BlitPixie Logo

"fairie magic" written by Anders F Björklund <>

Routines | Platforms | Using BlitPixie


Currently the BlitPixie family of blitters consists of :

Routines | Platforms | Using BlitPixie


The blitters come in one or several of four versions:

Supported compilers:

The assembly versions use CodeWarrior's inline assembly, with some #defines to make stuff more readable.
The inline assembly is separated to stand-alone assembler files for MPW's assemblers automatically, using a script.

Shared libraries are supplied for use by all environments.
Note: They are supposed to be linked into your application, not copied to the System folder.

Routines | Platforms | Using BlitPixie

Using BlitPixie


The blitters commonly accept a baseAddr which is a pointer to the start of pixel memory, and a rowBytes which is the offset in bytes from one line of pixels to the next.

Pointer parameters are declared as unsigned char * (UInt8*), and integer parameters as unsigned long (UInt32). Some integers like width and height are given as unsigned short (UInt16).


The blitter routines work in one of the following bit depths:
Bits per pixelBytes per pixelPointer typeColors
81unsigned char256 Colors
162unsigned shortThousands
324unsigned longMillions

Other pixel depths, such as 1,2,4 or 24 bits are not supported (except with BlitPixieAllBit on the 68k). Pixel conversions are not supported at all, the routines expect Macintosh byte ordering. Definitions of the pixel format can be found in the file BlitPixiePixelFormat.h

To access the pixel memory on the 68k, the processor should be put in 32-bit mode (instead of 24-bit mode) if it isn't already and the pixel map so requires. This can be checked by using PixMap32Bit and changed using SwapMMUMode. Or always use 32-bit mode... (which is the case on the PowerPC)

Compiled Sprites

The sprite compiler converts a pixel mask into a set of 68k assembly instructions (returned as a function ptr), that will draw the masked sprite using the image data when you call it.

NOTE: This function obviously performs no clipping, so be careful.

RLE Sprites

The Run-Length-Encoding format is designed for: All RLE tokens are 4 bytes, the first byte is the token type and the next three is the token count. After the token can additional follow extra data, see below table, but the data is always a multiple of 4 bytes wide.
typedef unsigned long       TokenDataType;
#define kTokenShift         24
#define kCountMask          0x00FFFFFFL
TokenValueCountExtra Data
kEndShapeToken00always zero-
kLineStartToken01offset to next
linestart token
kDrawPixelsToken02bytes to drawcount bytes of pixel data +
0-3 bytes of padding to align to next 4-byte boundary
kSkipPixelsToken03bytes to skip-
kSingleColorToken04bytes to fill4 bytes (1/2/4 pixels) to fill repeatedly with


kLineStartToken #12
- kSkipPixelsToken #12
- kDrawPixelsToken #8 $FF00FF00FF00FF00
kLineStartToken #16
- kSkipPixelsToken #16
- kDrawPixelsToken  #4 $FF00
- kSingleColorToken #20 $0000
- kDrawPixelsToken  #4 $FF00
kEndShapeToken #0

Routines | Platforms | Using BlitPixie

Last updated on 00-08-05 by afb.