Routines | Platforms | Using BlitPixie |
"fairie magic" written by Anders F Björklund <afb@algonet.se>
Routines | Platforms | Using BlitPixie |
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 |
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 pixel | Bytes per pixel | Pointer type | Colors |
---|---|---|---|
8 | 1 | unsigned char | 256 Colors |
16 | 2 | unsigned short | Thousands |
32 | 4 | unsigned long | Millions |
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)
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.
typedef unsigned long TokenDataType; #define kTokenShift 24 #define kCountMask 0x00FFFFFFL
Token | Value | Count | Extra Data |
---|---|---|---|
kEndShapeToken | 00 | always zero | - |
kLineStartToken | 01 | offset to next linestart token | - |
kDrawPixelsToken | 02 | bytes to draw | count bytes of pixel data + 0-3 bytes of padding to align to next 4-byte boundary |
kSkipPixelsToken | 03 | bytes to skip | - |
kSingleColorToken | 04 | bytes to fill | 4 bytes (1/2/4 pixels) to fill repeatedly with |
Example:
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.