3#include <unordered_set>
14 bool hit_error =
false;
15 std::size_t tile_index = 0;
16 for (
const auto &tile : tiles) {
19 const auto &pixel = tile.at(row, col);
23 std::vector errors = {format_->
format(
24 "{}: invalid alpha channel: {}",
28 std::ranges::copy(highlight, std::back_inserter(errors));
29 diag_->
err(
"alpha-channel-validation", errors);
46 bool hit_error =
false;
47 std::size_t tile_index = 0;
48 for (
const auto &tile : tiles) {
49 std::unordered_set<Rgba32> unique_colors;
52 const auto &pixel = tile.at(row, col);
54 unique_colors.insert(pixel);
60 std::vector errors = {format_->
format(
61 "{}: found {}th unique color: {}",
66 std::ranges::copy(highlight, std::back_inserter(errors));
67 diag_->
err(
"color-count-validation", errors);
78 "unique color constraint violation: tile had more than {} unique non-transparent pixels",
A result type that maintains a chainable sequence of errors for debugging and error reporting.
An 8x8 tile backed by literal-array-based per-pixel storage of an arbitrary pixel type.
Represents a 32-bit RGBA color.
static constexpr std::uint8_t alpha_opaque
static constexpr std::uint8_t alpha_transparent
virtual std::string format(const std::string &format_str, const std::vector< FormatParam > ¶ms) const
Formats a string with styled parameters using fmtlib syntax.
virtual std::vector< std::string > print_metatile_highlight(metatile::Subtile subtile, std::size_t row, std::size_t col, Style color) const =0
ChainableResult< void > validate_alpha_channels(const std::vector< PixelTile< Rgba32 > > &tiles) const
ChainableResult< void > generate_precision_loss_warnings(const std::vector< PixelTile< Rgba32 > > &tiles) const
ChainableResult< void > validate_unique_color_count(const std::vector< PixelTile< Rgba32 > > &tiles, const Rgba32 &extrinsic) const
void err(const std::string &tag, const std::string &msg) const
Display a tagged error message.
constexpr std::size_t max_size
constexpr std::size_t side_length_pix
@ bold
Bold text formatting.