|
Porytiles
|
Service for converting images into collections of 8x8 tiles. More...
#include <image_tileizer.hpp>
Public Member Functions | |
| ChainableResult< std::vector< PixelTile< T > > > | tileize (const Image< T > &img) const |
| Converts an image into a vector of 8x8 tiles. | |
Service for converting images into collections of 8x8 tiles.
The ImageTileizer service provides functionality to decompose images into individual 8x8 pixel tiles. This is a fundamental operation in tileset compilation, where large images need to be broken down into the tile-based format used by the Game Boy Advance graphics system.
The service validates that input images have dimensions that are multiples of the tile size (8 pixels) and processes the image in row-major order, creating tiles from left-to-right, top-to-bottom. Each resulting PixelTile<T> contains the exact pixel data from the corresponding 8x8 region of the source image.
| T | The pixel type (e.g., Rgba32, IndexPixel) |
Definition at line 29 of file image_tileizer.hpp.
|
inline |
Converts an image into a vector of 8x8 tiles.
This method decomposes the input image into individual 8x8 pixel tiles, processing the image in row-major order (left-to-right, top-to-bottom). The resulting tiles contain the exact pixel data from their corresponding regions in the source image.
The method validates that the image dimensions are multiples of 8 pixels, as partial tiles are not supported in the Game Boy Advance graphics system. If the validation fails, an error is returned with details about the invalid dimensions.
For an image of width W and height H pixels:
| img | The source image to tileize |
| T | The pixel type (e.g., Rgba32, IndexPixel) |
Definition at line 55 of file image_tileizer.hpp.