joeylib2/include/joey/palette.h

31 lines
1.1 KiB
C

// Palette and SCB (scanline control byte) accessors.
//
// Colors are 12-bit $0RGB (bits 11..8 red, 7..4 green, 3..0 blue).
// The library forces color 0 of every palette to black; paletteSet
// silently masks that entry to $000 regardless of what the caller
// passed. See docs/DESIGN.md sections 5 and 10.
#ifndef JOEYLIB_PALETTE_H
#define JOEYLIB_PALETTE_H
#include "platform.h"
#include "surface.h"
#include "types.h"
// Load all 16 colors of a palette. colors16 must point to exactly 16
// uint16_t values in $0RGB format.
void paletteSet(SurfaceT *s, uint8_t paletteIndex, const uint16_t *colors16);
// Read all 16 colors of a palette into out16.
void paletteGet(const SurfaceT *s, uint8_t paletteIndex, uint16_t *out16);
// Assign a single palette index (0..15) to a single scanline (0..199).
void scbSet(SurfaceT *s, uint16_t line, uint8_t paletteIndex);
// Assign a palette index to an inclusive range of scanlines.
void scbSetRange(SurfaceT *s, uint16_t firstLine, uint16_t lastLine, uint8_t paletteIndex);
// Read the palette index assigned to a scanline.
uint8_t scbGet(const SurfaceT *s, uint16_t line);
#endif