Jazz2/Editor/Imaging/PaletteMatch.h file

Namespaces

namespace Jazz2
Root namespace of Jazz² Resurrection.
namespace Jazz2::Editor

Classes

struct Jazz2::Editor::OkLab
A color in the Oklab color space, where distances follow how different colors look.
class Jazz2::Editor::PaletteSearch
Finds the entries of a palette that look the closest to colors.

Functions

void MatchPalette(const std::uint32_t(&from)[256], const std::uint32_t(&to)[256], std::uint8_t(&table)[256])
Maps each entry of a palette to the entry of another palette that looks the closest.
auto IsSpriteColor(std::int32_t index, std::uint32_t entry) -> bool
Returns whether an entry of the palette of a level is the color the sprites have at the same index.

Function documentation

void MatchPalette(const std::uint32_t(&from)[256], const std::uint32_t(&to)[256], std::uint8_t(&table)[256])

Maps each entry of a palette to the entry of another palette that looks the closest.

Colors are compared in OkLab. Entry 0 is transparent in both, so it maps to 0 and nothing else maps to it.

bool IsSpriteColor(std::int32_t index, std::uint32_t entry)

Returns whether an entry of the palette of a level is the color the sprites have at the same index.

The sprites are drawn in the palette of the level too. Tile sets often tweak the colors of the sprites a little, so a close color counts too. Entry 0 is transparent, it never counts.