Porytiles
Loading...
Searching...
No Matches
porytiles2::PaletteMatchResult< ColorType > Struct Template Reference

Result type for palette matching operations. More...

#include <palette_matchers.hpp>

Collaboration diagram for porytiles2::PaletteMatchResult< ColorType >:
[legend]

Public Attributes

bool is_covered = false
 True if the palette covers all non-transparent colors in the tile, false otherwise.
 
std::set< ColorType > missing_colors
 The set of non-transparent colors from the tile that are NOT present in the palette.
 
std::set< ColorType > covered_colors
 The set of non-transparent colors from the tile that ARE present in the palette.
 
std::vector< std::size_t > uncovered_pixel_indices
 The linear indices of tile pixels whose colors are not covered by the palette.
 
unsigned int pal_index = 0
 The palette index of the match, useful in batch operations.
 

Detailed Description

template<SupportsTransparency ColorType>
struct porytiles2::PaletteMatchResult< ColorType >

Result type for palette matching operations.

PaletteMatchResult encapsulates the outcome of matching a PixelTile against a Palette. It indicates whether the palette completely covers all non-transparent colors in the tile, and if not, which colors are missing and which are present. It also tracks the specific pixel positions that are not covered by the palette.

Template Parameters
ColorTypeThe color type of the palette and tile

Definition at line 23 of file palette_matchers.hpp.

Member Data Documentation

◆ covered_colors

template<SupportsTransparency ColorType>
std::set<ColorType> porytiles2::PaletteMatchResult< ColorType >::covered_colors

The set of non-transparent colors from the tile that ARE present in the palette.

Definition at line 37 of file palette_matchers.hpp.

◆ is_covered

template<SupportsTransparency ColorType>
bool porytiles2::PaletteMatchResult< ColorType >::is_covered = false

True if the palette covers all non-transparent colors in the tile, false otherwise.

Definition at line 27 of file palette_matchers.hpp.

◆ missing_colors

template<SupportsTransparency ColorType>
std::set<ColorType> porytiles2::PaletteMatchResult< ColorType >::missing_colors

The set of non-transparent colors from the tile that are NOT present in the palette.

Definition at line 32 of file palette_matchers.hpp.

◆ pal_index

template<SupportsTransparency ColorType>
unsigned int porytiles2::PaletteMatchResult< ColorType >::pal_index = 0

The palette index of the match, useful in batch operations.

Definition at line 52 of file palette_matchers.hpp.

◆ uncovered_pixel_indices

template<SupportsTransparency ColorType>
std::vector<std::size_t> porytiles2::PaletteMatchResult< ColorType >::uncovered_pixel_indices

The linear indices of tile pixels whose colors are not covered by the palette.

This vector contains the indices [0, 64) of pixels in the tile that have non-transparent colors not present in the palette. These indices can be converted to (row, col) coordinates using tile::index_to_row_col() if needed. Empty if all non-transparent pixels are covered by the palette.

Definition at line 47 of file palette_matchers.hpp.


The documentation for this struct was generated from the following file: