Jazz2/Editor/Imaging/AccentColor.h file

Namespaces

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

Functions

auto FindAccentColor(const Formats::TileSetData& tileSet, const std::uint32_t* palette, Death::Containers::ArrayView<const float> tileWeights, nCine::Colorf& color) -> bool
Finds the color a tile set is known by — a vivid color that many of its pixels have.

Function documentation

bool FindAccentColor(const Formats::TileSetData& tileSet, const std::uint32_t* palette, Death::Containers::ArrayView<const float> tileWeights, nCine::Colorf& color)

Finds the color a tile set is known by — a vivid color that many of its pixels have.

The pixels are sorted by their hue, each weighted by how saturated and bright it is, so grays and dark shades don't count. The color of the hue with the most weight is returned light and only a little saturated. The 8-bit tiles take their colors from palette, as R | G << 8 | B << 16. A tile counts as much as its entry of tileWeights says, a tile without one doesn't count, all tiles count the same if it's empty. Returns false if no pixel that counts has a color like that.