35template <SupportsTransparency PixelType>
63 auto operator<=>(
const Candidate &other)
const
65 return flipped_tile <=> other.flipped_tile;
70 std::pair{
false,
false}, std::pair{
false,
true}, std::pair{
true,
false}, std::pair{
true,
true}};
72 std::vector<Candidate> candidates;
73 candidates.reserve(4);
75 for (
const auto &[h, v] : flips) {
76 candidates.push_back({tile.flip(h, v), h, v});
79 auto min_candidate = *std::min_element(candidates.begin(), candidates.end());
82 *
static_cast<PixelTile<PixelType> *
>(
this) = min_candidate.flipped_tile;
83 h_flip_ = min_candidate.h_flip;
84 v_flip_ = min_candidate.v_flip;
105 requires requires(
const PixelType &p) { p.is_transparent(p); }
109 PixelTile<PixelType> flipped_tile;
115 std::pair{
false,
false}, std::pair{
false,
true}, std::pair{
true,
false}, std::pair{
true,
true}};
117 std::vector<Candidate> candidates;
118 candidates.reserve(4);
119 for (
const auto &[h, v] : flips) {
120 candidates.push_back({tile.flip(h, v), h, v});
123 auto min_it = std::min_element(
124 candidates.begin(), candidates.end(), [&extrinsic_transparency](
const Candidate &a,
const Candidate &b) {
125 return PixelTile<PixelType>::cross_et_compare(
126 a.flipped_tile, extrinsic_transparency, b.flipped_tile, extrinsic_transparency) < 0;
129 *
static_cast<PixelTile<PixelType> *
>(
this) = min_it->flipped_tile;
130 h_flip_ = min_it->h_flip;
131 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.