Sprite Types | |
Enumerations | |
CPCT_BlendMode | Enumerates all blending modes for cpct_drawSpriteBlended. |
Enumerates all blending modes for cpct_drawSpriteBlended.
These blend operations are common byte operations that the processor does between two values. The cpct_drawSpriteBlended function blends the sprite with the background (present contents of the video memory) byte by byte. It takes 1 byte from video memory (background) and 1 byte from the sprite array (data), does the selected operation with both (XOR, OR, AND, etc) and puts the result in screen video memory, where it got the first byte from the background.
All possible blending modes are implemented as 1-byte Z80 operations. The name of every enumerate value include the mnemonic of the operation that will be performed (XOR, AND, OR, ADD...) between both bytes (background and sprite data). Take into account that pixel values refer to palette indices (0-1, 0-3 or 0-15, depending on graphics mode). Final result of operations will depend on how you select your palette colours.
%======================================================% | Constant | Value | Blending operation | |------------------------------------------------------| | CPCT_BLEND_XOR | 0xAE | = background ^ data | | CPCT_BLEND_AND | 0xA6 | = background & data | | CPCT_BLEND_OR | 0xB6 | = background | data | | CPCT_BLEND_ADD | 0x86 | = background + data | | CPCT_BLEND_ADC | 0x8E | = background + data + Carry | | CPCT_BLEND_SBC | 0x9E | = background - data - Carry | | CPCT_BLEND_SUB | 0x96 | = background - data | | CPCT_BLEND_LDI | 0x7E | = data | | CPCT_BLEND_NOP | 0x00 | = background | %======================================================%