|
Porytiles
|
A PixelTile representation that stores the canonical (lexicographically minimal) orientation among all flipped variants. More...
#include <canonical_pixel_tile.hpp>
Public Member Functions | |
| 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. | |
| bool | h_flip () const |
| Returns the horizontal flip flag. | |
| bool | v_flip () const |
| Returns the vertical flip flag. | |
Public Member Functions inherited from porytiles2::PixelTile< PixelType > | |
| virtual | ~PixelTile ()=default |
| PixelTile () | |
| PixelTile (std::array< PixelType, tile::size_pix > pix) | |
| auto | operator<=> (const PixelTile &) const =default |
| bool | is_transparent () const |
| Checks if this entire PixelTile is transparent (intrinsic transparency only). | |
| bool | is_transparent (const PixelType &extrinsic) const |
| Checks if this entire PixelTile is transparent. | |
| bool | equals_ignoring_transparency (const PixelTile &other) const |
| Compares this PixelTile with another, treating all transparent pixels as equal. | |
| bool | equals_ignoring_transparency (const PixelTile &other, const PixelType &extrinsic) const |
| Compares this PixelTile with another, treating all transparent pixels as equal. | |
| PixelType | at (std::size_t i) const |
| PixelType | at (std::size_t row, std::size_t col) const |
| void | set (std::size_t i, const PixelType &p) |
| void | set (std::size_t row, std::size_t col, const PixelType &p) |
| PixelTile | flip (bool h_flip, bool v_flip) const |
| Creates a flipped copy of this PixelTile. | |
| std::set< PixelType > | unique_nontransparent_colors () const |
| Returns the set of unique non-transparent colors present in this PixelTile (intrinsic transparency only). | |
| std::set< PixelType > | unique_nontransparent_colors (const PixelType &extrinsic) const |
| Returns the set of unique non-transparent colors present in this PixelTile. | |
| const std::array< PixelType, tile::size_pix > & | pix () const |
A PixelTile representation that stores the canonical (lexicographically minimal) orientation among all flipped variants.
CanonicalPixelTile finds and stores the canonical orientation of a tile by evaluating all four possible flip combinations (no flip, horizontal only, vertical only, and both horizontal and vertical). The canonical orientation is defined as the lexicographically minimal tile data among these four variants.
This representation enables:
The stored flip flags (h_flip_ and v_flip_) represent the transformation needed to convert the canonical tile back to the original input tile. For example, if the input tile's horizontal flip is its canonical form, h_flip() will return true, indicating that horizontally flipping the canonical tile reproduces the original.
This approach is particularly useful for:
| PixelType | The pixel type of this tile; must satisfy SupportsTransparency concept |
Definition at line 38 of file canonical_pixel_tile.hpp.
|
inlineexplicit |
Constructs a CanonicalPixelTile by finding the canonical orientation of the input tile.
This constructor evaluates all four possible flip combinations of the input tile:
The lexicographically minimal tile among these four variants is selected as the canonical form and stored as the base PixelTile data. The flip flags that transform this canonical form back to the input tile are stored in h_flip_ and v_flip_.
The lexicographic comparison is performed using the default PixelTile comparison operator (operator<=>), which compares pixel data element-by-element.
| tile | The input PixelTile to canonicalize |
Definition at line 59 of file canonical_pixel_tile.hpp.
|
inline |
Returns the horizontal flip flag.
Indicates whether the canonical tile must be horizontally flipped to reproduce the original input tile. If true, applying a horizontal flip to this CanonicalPixelTile's tile data will yield the original tile orientation.
Definition at line 115 of file canonical_pixel_tile.hpp.
|
default |
Three-way comparison operator that compares all fields in lexicographic order.
Provides complete ordering by comparing first the base PixelTile data, then h_flip_, then v_flip_. This enables CanonicalPixelTile instances to be used in ordered containers like std::set or std::map.
Two CanonicalPixelTile instances are equal if and only if they have identical canonical tile data and identical flip flags.
| other | The CanonicalPixelTile to compare against |
|
inline |
Returns the vertical flip flag.
Indicates whether the canonical tile must be vertically flipped to reproduce the original input tile. If true, applying a vertical flip to this CanonicalPixelTile's tile data will yield the original tile orientation.
Definition at line 129 of file canonical_pixel_tile.hpp.