Porytiles
Loading...
Searching...
No Matches
palette_matchers.hpp File Reference
#include <algorithm>
#include <ranges>
#include <set>
#include "porytiles/domain/models/palette.hpp"
#include "porytiles/domain/models/pixel_tile.hpp"
#include "porytiles/utilities/panic/panic.hpp"
Include dependency graph for palette_matchers.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  porytiles::PaletteMatchResult< ColorType >
 Result type for palette matching operations. More...
 

Namespaces

namespace  porytiles
 
namespace  porytiles::details
 

Functions

template<SupportsTransparency ColorType, typename TransparencyPredicate , std::size_t N = 0>
PaletteMatchResult< ColorType > porytiles::details::match_tile_to_palette_impl (const PixelTile< ColorType > &tile, const Palette< ColorType, N > &palette, TransparencyPredicate is_transparent_pred)
 Helper function implementing the core palette matching logic.
 
template<SupportsTransparency ColorType, std::size_t N = 0>
requires requires(const ColorType &c) { c.is_transparent(); }
PaletteMatchResult< ColorType > porytiles::match_tile_to_palette (const PixelTile< ColorType > &tile, const Palette< ColorType, N > &palette)
 Matches a PixelTile against a Palette (intrinsic transparency only).
 
template<SupportsTransparency ColorType, std::size_t N = 0>
requires requires(const ColorType &c) { c.is_transparent(c); }
PaletteMatchResult< ColorType > porytiles::match_tile_to_palette (const PixelTile< ColorType > &tile, const Palette< ColorType, N > &palette, const ColorType &extrinsic)
 Matches a PixelTile against a Palette (extrinsic transparency).
 
template<SupportsTransparency ColorType, typename PaletteContainer >
requires requires(const ColorType &c) { c.is_transparent(c); }
std::vector< PaletteMatchResult< ColorType > > porytiles::match_or_best (const PixelTile< ColorType > &tile, const PaletteContainer &palettes, const ColorType &extrinsic, std::size_t top_n)
 Finds the best palette match(es) for a tile (extrinsic transparency).