Jazz2::Editor::PaletteMapper class

Finds the entries of a palette closest to colors, and remembers them.

With dithering, a 4 × 4 ordered pattern shifts the colors a little before they're looked up, which mixes the two closest entries where a color lies between them. The pattern is aligned to the pixels the colors are at, so tiles next to each other continue it without a seam.

Constructors, destructors, conversion operators

PaletteMapper(const std::uint32_t* palette, bool dither)
Creates a mapper to the entries 1 to 255 of a palette.

Public functions

auto Map(std::uint32_t color, std::int32_t x, std::int32_t y) -> std::uint8_t
Returns the entry for a color R | G << 8 | B << 16 at a pixel.