37template <SupportsTransparency PixelType>
67 auto operator<=>(
const Candidate &other)
const
69 return flipped_tile <=> other.flipped_tile;
74 std::pair{
false,
false}, std::pair{
false,
true}, std::pair{
true,
false}, std::pair{
true,
true}};
76 std::vector<Candidate> candidates;
77 candidates.reserve(4);
79 for (
const auto &[h, v] : flips) {
80 candidates.push_back({tile.flip(h, v), h, v});
83 auto min_candidate = *std::min_element(candidates.begin(), candidates.end());
86 *
static_cast<PixelTile<PixelType> *
>(
this) = min_candidate.flipped_tile;
87 h_flip_ = min_candidate.h_flip;
88 v_flip_ = min_candidate.v_flip;
111 requires requires(
const PixelType &p) { p.is_transparent(p); }
115 PixelTile<PixelType> flipped_tile;
121 std::pair{
false,
false}, std::pair{
false,
true}, std::pair{
true,
false}, std::pair{
true,
true}};
123 std::vector<Candidate> candidates;
124 candidates.reserve(4);
125 for (
const auto &[h, v] : flips) {
126 candidates.push_back({tile.flip(h, v), h, v});
129 auto min_it = std::min_element(
130 candidates.begin(), candidates.end(), [&extrinsic_transparency](
const Candidate &a,
const Candidate &b) {
131 return PixelTile<PixelType>::cross_et_compare(
132 a.flipped_tile, extrinsic_transparency, b.flipped_tile, extrinsic_transparency) < 0;
135 *
static_cast<PixelTile<PixelType> *
>(
this) = min_it->flipped_tile;
136 h_flip_ = min_it->h_flip;
137 v_flip_ = min_it->v_flip;
A PixelTile representation that stores the canonical (lexicographically minimal) orientation among al...
bool h_flip() const
Returns the horizontal flip flag.
bool v_flip() const
Returns the vertical flip flag.
CanonicalPixelTile(const PixelTile< PixelType > &tile, const PixelType &extrinsic_transparency)
Canonicalizes the input tile's orientation under cross-ET strict weak ordering.
CanonicalPixelTile(const PixelTile< PixelType > &tile)
Constructs a CanonicalPixelTile by finding the canonical orientation of the input tile.
auto operator<=>(const CanonicalPixelTile &other) const =default
Three-way comparison operator that compares all fields in lexicographic order.
An 8x8 tile backed by literal-array-based per-pixel storage of an arbitrary pixel type.