TextureAtlasPackerRegion
Internal data structure for regions during the packing process.
TextureAtlasPackerRegion holds temporary information about images to be packed, including pixel data, dimensions, and packing results. This is distinct from TextureAtlasRegion which represents the final packed regions in the atlas.
Features:
- Support for trimmed sprites (packed vs original dimensions)
- Offset data for proper sprite alignment
- Variant regions that share texture data with a source
- Bin packing rectangle assignment
Instance Members
name: String
Unique identifier for this region. Used to reference the region in the final atlas.
originalWidth: Int
Original sprite width including transparent margins. This is the full size before any trimming optimization.
originalHeight: Int
Original sprite height including transparent margins. This is the full size before any trimming optimization.
packedWidth: Int
Actual width of non-transparent pixels to be packed. Usually smaller than originalWidth due to trimming.
packedHeight: Int
Actual height of non-transparent pixels to be packed. Usually smaller than originalHeight due to trimming.
offsetX: Int
Horizontal offset from original sprite origin to packed pixels. Used to maintain proper sprite alignment after trimming.
offsetY: Int
Vertical offset from original sprite origin to packed pixels. Used to maintain proper sprite alignment after trimming.
pixels: ceramic.UInt8Array
Raw pixel data for this region in RGBA format. Null for variant regions that reference another region.
sourceRegion: TextureAtlasPackerRegion
Reference to source region for variants. Variant regions share the same texture coordinates as their source but can have different original dimensions and offsets.
rect: binpacking.Rect
Assigned position in the texture page after bin packing. Null until the region has been successfully packed.
rendered: Bool
Tracks whether pixels have been copied to the page texture. Prevents duplicate rendering during repacking operations.
new(name: String, ?originalWidth: Null<Int>, ?originalHeight: Null<Int>, packedWidth: Int, packedHeight: Int, ?offsetX: Null<Int>, ?offsetY: Null<Int>, ?pixels: Null<ceramic.UInt8Array>, ?sourceRegion: Null<TextureAtlasPackerRegion>, ?rect: Null<binpacking.Rect>, ?rendered: Null<Bool>): Void
Name | Type | Default | Description |
---|---|---|---|
name |
String | * Unique identifier for this region. Used to reference the region in the final atlas. | |
originalWidth |
Null<Int> | (optional) | * Original sprite width including transparent margins. This is the full size before any trimming optimization. |
originalHeight |
Null<Int> | (optional) | * Original sprite height including transparent margins. This is the full size before any trimming optimization. |
packedWidth |
Int | * Actual width of non-transparent pixels to be packed. Usually smaller than originalWidth due to trimming. | |
packedHeight |
Int | * Actual height of non-transparent pixels to be packed. Usually smaller than originalHeight due to trimming. | |
offsetX |
Null<Int> | (optional) | * Horizontal offset from original sprite origin to packed pixels. Used to maintain proper sprite alignment after trimming. |
offsetY |
Null<Int> | (optional) | * Vertical offset from original sprite origin to packed pixels. Used to maintain proper sprite alignment after trimming. |
pixels |
Null<ceramic.UInt8Array> | (optional) | * Raw pixel data for this region in RGBA format. Null for variant regions that reference another region. |
sourceRegion |
Null<TextureAtlasPackerRegion> | (optional) | * Reference to source region for variants. Variant regions share the same texture coordinates as their source but can have different original dimensions and offsets. |
rect |
Null<binpacking.Rect> | (optional) | * Assigned position in the texture page after bin packing. Null until the region has been successfully packed. |
rendered |
Null<Bool> | (optional) | * Tracks whether pixels have been copied to the page texture. Prevents duplicate rendering during repacking operations. |
Metadata
Name | Parameters |
---|---|
:structInit |
- |
:allow |
ceramic.TextureAtlasPacker |
:allow |
ceramic.TextureAtlasPackerPage |