Isle
Loading...
Searching...
No Matches
legoimage.h
Go to the documentation of this file.
1#ifndef __LEGOIMAGE_H
2#define __LEGOIMAGE_H
3
4#include "legotypes.h"
5
6class LegoStorage;
7
13public:
16
17 /*
22 LegoPaletteEntry(LegoU8 p_red, LegoU8 p_green, LegoU8 p_blue);
23 */
24
26 LegoU8 GetRed() { return m_red; }
27
30 void SetRed(LegoU8 p_red) { m_red = p_red; }
31
33 LegoU8 GetGreen() { return m_green; }
34
37 void SetGreen(LegoU8 p_green) { m_green = p_green; }
38
40 LegoU8 GetBlue() { return m_blue; }
41
44 void SetBlue(LegoU8 p_blue) { m_blue = p_blue; }
45
49 LegoResult Read(LegoStorage* p_storage);
50
54 LegoResult Write(LegoStorage* p_storage);
55
56protected:
60};
61
68class LegoImage {
69public:
71 LegoImage();
72
76 LegoImage(LegoU32 p_width, LegoU32 p_height);
77
79 ~LegoImage();
80
82 LegoU32 GetWidth() { return m_width; }
83
86 void SetWidth(LegoU32 p_width) { m_width = p_width; }
87
90
93 void SetHeight(LegoU32 p_height) { m_height = p_height; }
94
96 LegoU32 GetCount() { return m_count; }
97
100 void SetCount(LegoU32 p_count) { m_count = p_count; }
101
104
108
112 void SetPaletteEntry(LegoU32 p_i, LegoPaletteEntry& p_paletteEntry) { m_palette[p_i] = p_paletteEntry; }
113
116 LegoU8* GetBits() { return m_bits; }
117
120 void SetBits(LegoU8* p_bits) { m_bits = p_bits; }
121
126 LegoResult Read(LegoStorage* p_storage, LegoU32 p_square);
127
130 LegoResult Write(LegoStorage* p_storage);
131
132protected:
138};
139
140#endif // __LEGOIMAGE_H
[AI] Class representing an 8-bit palettized image with up to 256 palette entries and indexed pixel da...
Definition: legoimage.h:68
LegoPaletteEntry m_palette[256]
[AI] Full palette array (256 possible 8-bit RGB entries).
Definition: legoimage.h:136
LegoResult Read(LegoStorage *p_storage, LegoU32 p_square)
[AI] Reads the full image from the storage source, including width, height, count,...
Definition: legoimage.cpp:77
LegoU8 * m_bits
[AI] Pointer to the image bits. Each byte is a palette index; size = width*height.
Definition: legoimage.h:137
LegoImage()
[AI] Constructs an empty image object. Palette is not initialized; bits is nullptr.
Definition: legoimage.cpp:51
LegoU32 GetWidth()
[AI] Returns the current image width in pixels.
Definition: legoimage.h:82
LegoU32 m_count
[AI] Number of palette entries in use (<= 256).
Definition: legoimage.h:135
void SetCount(LegoU32 p_count)
[AI] Sets the palette color count (number of valid entries in m_palette).
Definition: legoimage.h:100
LegoPaletteEntry & GetPaletteEntry(LegoU32 p_i)
[AI] Returns a reference to the palette entry at index p_i.
Definition: legoimage.h:107
void SetBits(LegoU8 *p_bits)
[AI] Sets the pixel data buffer pointer.
Definition: legoimage.h:120
~LegoImage()
[AI] Destructor; releases any allocated pixel buffer memory.
Definition: legoimage.cpp:69
void SetPaletteEntry(LegoU32 p_i, LegoPaletteEntry &p_paletteEntry)
[AI] Sets the palette entry at index p_i to the given value.
Definition: legoimage.h:112
LegoU8 * GetBits()
[AI] Returns pointer to the buffer containing indexed pixel data.
Definition: legoimage.h:116
LegoU32 m_width
[AI] Image width, in pixels.
Definition: legoimage.h:133
LegoResult Write(LegoStorage *p_storage)
[AI] Writes the full image to the given storage: width, height, count, palette, pixel indices.
Definition: legoimage.cpp:153
void SetHeight(LegoU32 p_height)
[AI] Sets the image height in pixels.
Definition: legoimage.h:93
LegoU32 m_height
[AI] Image height, in pixels.
Definition: legoimage.h:134
void SetWidth(LegoU32 p_width)
[AI] Sets the image width in pixels.
Definition: legoimage.h:86
LegoPaletteEntry * GetPalette()
[AI] Returns the pointer to the start of the palette array (256 entries).
Definition: legoimage.h:103
LegoU32 GetHeight()
[AI] Returns the current image height in pixels.
Definition: legoimage.h:89
LegoU32 GetCount()
[AI] Returns the number of palette entries in use for this image.
Definition: legoimage.h:96
[AI] Represents a single entry in an 8-bit RGB palette with red, green, and blue components.
Definition: legoimage.h:12
LegoResult Read(LegoStorage *p_storage)
[AI] Reads the palette entry data from a storage object.
Definition: legoimage.cpp:19
void SetBlue(LegoU8 p_blue)
[AI] Sets the blue color intensity.
Definition: legoimage.h:44
LegoResult Write(LegoStorage *p_storage)
[AI] Writes the palette entry data to a storage object.
Definition: legoimage.cpp:35
void SetGreen(LegoU8 p_green)
[AI] Sets the green color intensity.
Definition: legoimage.h:37
LegoU8 m_blue
[AI] Blue channel (0-255). Offset 0x02.
Definition: legoimage.h:59
LegoPaletteEntry()
[AI] Constructs an empty palette entry with all components initialized to 0. [Existing comment: Defau...
Definition: legoimage.cpp:11
LegoU8 GetBlue()
[AI] Returns the blue color intensity of this palette entry.
Definition: legoimage.h:40
LegoU8 GetRed()
[AI] Returns the red color intensity of this palette entry.
Definition: legoimage.h:26
LegoU8 m_red
[AI] Red channel (0-255). Offset 0x00.
Definition: legoimage.h:57
LegoU8 m_green
[AI] Green channel (0-255). Offset 0x01.
Definition: legoimage.h:58
LegoU8 GetGreen()
[AI] Returns the green color intensity of this palette entry.
Definition: legoimage.h:33
void SetRed(LegoU8 p_red)
[AI] Sets the red color intensity.
Definition: legoimage.h:30
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
[AI] Defines basic fixed-width data types and platform-neutral constants for LEGO Island codebase.
unsigned long LegoU32
[AI] Unsigned 32-bit integer type for cross-platform compatibility.
Definition: legotypes.h:71
unsigned char LegoU8
[AI] Unsigned 8-bit integer type used throughout LEGO Island.
Definition: legotypes.h:47
LegoS32 LegoResult
[AI] Function result type (return code): typically SUCCESS (0) or FAILURE (-1).
Definition: legotypes.h:101