Isle
|
[AI] Class representing an 8-bit palettized image with up to 256 palette entries and indexed pixel data. More...
#include <legoimage.h>
Public Member Functions | |
LegoImage () | |
[AI] Constructs an empty image object. Palette is not initialized; bits is nullptr. More... | |
LegoImage (LegoU32 p_width, LegoU32 p_height) | |
[AI] Constructs an image object with a given width and height. More... | |
~LegoImage () | |
[AI] Destructor; releases any allocated pixel buffer memory. More... | |
LegoU32 | GetWidth () |
[AI] Returns the current image width in pixels. More... | |
void | SetWidth (LegoU32 p_width) |
[AI] Sets the image width in pixels. More... | |
LegoU32 | GetHeight () |
[AI] Returns the current image height in pixels. More... | |
void | SetHeight (LegoU32 p_height) |
[AI] Sets the image height in pixels. More... | |
LegoU32 | GetCount () |
[AI] Returns the number of palette entries in use for this image. More... | |
void | SetCount (LegoU32 p_count) |
[AI] Sets the palette color count (number of valid entries in m_palette). More... | |
LegoPaletteEntry * | GetPalette () |
[AI] Returns the pointer to the start of the palette array (256 entries). More... | |
LegoPaletteEntry & | GetPaletteEntry (LegoU32 p_i) |
[AI] Returns a reference to the palette entry at index p_i. More... | |
void | SetPaletteEntry (LegoU32 p_i, LegoPaletteEntry &p_paletteEntry) |
[AI] Sets the palette entry at index p_i to the given value. More... | |
LegoU8 * | GetBits () |
[AI] Returns pointer to the buffer containing indexed pixel data. More... | |
void | SetBits (LegoU8 *p_bits) |
[AI] Sets the pixel data buffer pointer. More... | |
LegoResult | Read (LegoStorage *p_storage, LegoU32 p_square) |
[AI] Reads the full image from the storage source, including width, height, count, palette, and pixel indices. More... | |
LegoResult | Write (LegoStorage *p_storage) |
[AI] Writes the full image to the given storage: width, height, count, palette, pixel indices. More... | |
Protected Attributes | |
LegoU32 | m_width |
[AI] Image width, in pixels. More... | |
LegoU32 | m_height |
[AI] Image height, in pixels. More... | |
LegoU32 | m_count |
[AI] Number of palette entries in use (<= 256). More... | |
LegoPaletteEntry | m_palette [256] |
[AI] Full palette array (256 possible 8-bit RGB entries). More... | |
LegoU8 * | m_bits |
[AI] Pointer to the image bits. Each byte is a palette index; size = width*height. More... | |
[AI] Class representing an 8-bit palettized image with up to 256 palette entries and indexed pixel data.
[AI] Each image consists of a width, height, a count of palette colors (typically 256 or less), a palette array, and a bitmap of indices referencing the palette. Pixel data is 8-bit indices into the palette. Provides serialization/deserialization and functions to manipulate palette and raw image bits. If square padding is requested upon read, non-square images are padded to squares by duplicating scanlines or columns as needed. Used for textures, UI elements, or sprite data in LEGO Island.
Definition at line 68 of file legoimage.h.
LegoImage::LegoImage | ( | ) |
[AI] Constructs an empty image object. Palette is not initialized; bits is nullptr.
Definition at line 51 of file legoimage.cpp.
[AI] Constructs an image object with a given width and height.
Allocates the bits buffer accordingly.
p_width | [AI] Width in pixels. |
p_height | [AI] Height in pixels. |
Definition at line 60 of file legoimage.cpp.
LegoImage::~LegoImage | ( | ) |
[AI] Destructor; releases any allocated pixel buffer memory.
Definition at line 69 of file legoimage.cpp.
|
inline |
[AI] Returns pointer to the buffer containing indexed pixel data.
[AI_SUGGESTED_CORRECTED_NAME: GetPixelIndices]
[AI] Each byte is a palette index for the corresponding pixel, row-major order. Buffer size is width*height bytes.
Definition at line 116 of file legoimage.h.
|
inline |
[AI] Returns the number of palette entries in use for this image.
Definition at line 96 of file legoimage.h.
|
inline |
[AI] Returns the current image height in pixels.
Definition at line 89 of file legoimage.h.
|
inline |
[AI] Returns the pointer to the start of the palette array (256 entries).
Definition at line 103 of file legoimage.h.
|
inline |
[AI] Returns a reference to the palette entry at index p_i.
No bounds checking.
p_i | [AI] Index (palette entry number, 0-255). |
Definition at line 107 of file legoimage.h.
|
inline |
[AI] Returns the current image width in pixels.
Definition at line 82 of file legoimage.h.
LegoResult LegoImage::Read | ( | LegoStorage * | p_storage, |
LegoU32 | p_square | ||
) |
[AI] Reads the full image from the storage source, including width, height, count, palette, and pixel indices.
p_storage | [AI] Storage interface to read from (file/memory/etc). |
p_square | [AI] If nonzero, enforces padding of the image to square dimensions by duplicating scanlines or columns. |
[AI] Allocates m_bits with new[] (deletes the previous on success). Applies square-padding if requested and width != height.
Definition at line 77 of file legoimage.cpp.
|
inline |
[AI] Sets the pixel data buffer pointer.
Does NOT take ownership of the memory.
p_bits | [AI] Pointer to new bits data. Must be width * height bytes. |
Definition at line 120 of file legoimage.h.
|
inline |
[AI] Sets the palette color count (number of valid entries in m_palette).
p_count | [AI] Number of palette colors used (<= 256). |
Definition at line 100 of file legoimage.h.
|
inline |
[AI] Sets the image height in pixels.
[AI_SUGGESTED_CORRECTED_NAME: SetImageHeight]
p_height | [AI] New height value to store. |
Definition at line 93 of file legoimage.h.
|
inline |
[AI] Sets the palette entry at index p_i to the given value.
No bounds checking.
p_i | [AI] Index (palette entry number, 0-255). |
p_paletteEntry | [AI] Palette object containing the desired RGB value for this entry. |
Definition at line 112 of file legoimage.h.
|
inline |
[AI] Sets the image width in pixels.
[AI_SUGGESTED_CORRECTED_NAME: SetImageWidth]
p_width | [AI] New width value to store. |
Definition at line 86 of file legoimage.h.
LegoResult LegoImage::Write | ( | LegoStorage * | p_storage | ) |
[AI] Writes the full image to the given storage: width, height, count, palette, pixel indices.
p_storage | [AI] Storage output to receive the formatted palette data and image bits. |
Definition at line 153 of file legoimage.cpp.
|
protected |
[AI] Pointer to the image bits. Each byte is a palette index; size = width*height.
Definition at line 137 of file legoimage.h.
|
protected |
[AI] Number of palette entries in use (<= 256).
Definition at line 135 of file legoimage.h.
|
protected |
[AI] Image height, in pixels.
Definition at line 134 of file legoimage.h.
|
protected |
[AI] Full palette array (256 possible 8-bit RGB entries).
Definition at line 136 of file legoimage.h.
|
protected |
[AI] Image width, in pixels.
Definition at line 133 of file legoimage.h.