32 panic(
"unhandled Layer value");
41 return "northwest(" + std::to_string(
static_cast<std::uint8_t
>(layer)) +
")";
43 return "northeast(" + std::to_string(
static_cast<std::uint8_t
>(layer)) +
")";
45 return "southwest(" + std::to_string(
static_cast<std::uint8_t
>(layer)) +
")";
47 return "southeast(" + std::to_string(
static_cast<std::uint8_t
>(layer)) +
")";
49 panic(
"unhandled Subtile value");
52[[nodiscard]]
inline std::tuple<std::size_t, Layer, Subtile>
from_tile_index(std::size_t tile_index)
59 return {metatile_index, layer, subtile};
66 std::size_t subtile_row,
67 std::size_t subtile_col,
94template <SupportsTransparency PixelType>
111 requires requires(const PixelType &p) { p.is_transparent(); }
113 const bool bottom_transparent =
114 std::ranges::all_of(
bottom(), [](
const auto &tile) {
return tile.is_transparent(); });
115 const bool middle_transparent =
116 std::ranges::all_of(
middle(), [](
const auto &tile) {
return tile.is_transparent(); });
117 const bool top_transparent = std::ranges::all_of(
top(), [](
const auto &tile) {
return tile.is_transparent(); });
118 return bottom_transparent && middle_transparent && top_transparent;
133 requires requires(
const PixelType &p) { p.is_transparent(p); }
135 const bool bottom_transparent =
136 std::ranges::all_of(
bottom(), [=](
const auto &tile) {
return tile.is_transparent(extrinsic); });
137 const bool middle_transparent =
138 std::ranges::all_of(
middle(), [=](
const auto &tile) {
return tile.is_transparent(extrinsic); });
139 const bool top_transparent =
140 std::ranges::all_of(
top(), [=](
const auto &tile) {
return tile.is_transparent(extrinsic); });
141 return bottom_transparent && middle_transparent && top_transparent;
156 auto out_it = tiles.begin();
157 out_it = std::ranges::copy(
bottom(), out_it).out;
158 out_it = std::ranges::copy(
middle(), out_it).out;
159 std::ranges::copy(
top(), out_it);
176 panic(fmt::format(
"index {} out of bounds: must be [0,3]", i));
206 panic(fmt::format(
"index {} out of bounds: must be [0,3]", i));
208 bottom_[i] = std::move(tile);
223 panic(fmt::format(
"index {} out of bounds: must be [0,3]", i));
253 panic(fmt::format(
"index {} out of bounds: must be [0,3]", i));
255 middle_[i] = std::move(tile);
270 panic(fmt::format(
"index {} out of bounds: must be [0,3]", i));
300 panic(fmt::format(
"index {} out of bounds: must be [0,3]", i));
302 top_[i] = std::move(tile);
315[[nodiscard]] std::vector<PixelTile<T>> decompose(
const std::vector<Metatile<T>> &metatiles)
317 std::vector<PixelTile<T>> tiles;
319 for (
const auto &mt : metatiles) {
320 tiles.append_range(mt.decompose());
An 8x8 tile backed by literal-array-based per-pixel storage of an arbitrary pixel type.
Abstract base class for applying text styling with context-aware formatting.
virtual std::string format(const std::string &format_str, const std::vector< FormatParam > ¶ms) const
Formats a string with styled parameters using fmtlib syntax.
constexpr std::size_t side_length_pix
void panic(const StringViewSourceLoc &s)
Unconditionally terminates the program with a panic message.
@ bold
Bold text formatting.