5#include <unordered_map>
36 return hardware_index_ == other.hardware_index_;
41 return hardware_index_ <=> other.hardware_index_;
46 return hardware_index_;
56 return assigned_tile_ids_;
63 return cached_per_color_multiplicity_[color_idx];
66 [[nodiscard]]
const std::array<std::size_t, num_colors> &
color_counts()
const
68 return cached_per_color_multiplicity_;
130 std::size_t hardware_index_;
131 std::size_t capacity_;
133 std::vector<PackableTile::Id> assigned_tile_ids_;
134 std::unordered_map<PackableTile::Id, ColorSet> tile_colors_;
135 std::array<std::size_t, num_colors> cached_per_color_multiplicity_;
A set of colors represented as a bitset.
Wraps a ColorSet with a tile ID for tracking during palette packing.
std::variant< HintId, PrefilledPaletteId, RegularId, AnimId, PrimaryTileId > Id
Variant type for tile identification.
Represents a hardware palette after packing with accumulated colors and assigned tiles.
const std::vector< PackableTile::Id > & assigned_tile_ids() const
std::size_t color_multiplicity(std::size_t color_idx) const
void remove_tile(const PackableTile &tile)
Removes a tile from this palette and recalculates the color set.
std::size_t union_size(const ColorSet &tile_colors) const
Computes the size of the union of this palette's colors with the given colors.
const std::array< std::size_t, num_colors > & color_counts() const
std::strong_ordering operator<=>(const PackedPalette &other) const
std::size_t hardware_index() const
bool operator==(const PackedPalette &other) const
bool can_fit(const ColorSet &tile_colors) const
Checks if a tile's colors can fit in this palette.
void add_tile(const PackableTile &tile)
Adds a tile to this palette.
std::size_t remaining_capacity() const
std::size_t color_count() const
const ColorSet & color_set() const
constexpr std::size_t max_size