Isle
Loading...
Searching...
No Matches
MxPalette Class Reference

[AI] Encapsulates a DirectDraw 8-bit (256 color) palette for use with DirectX rendering. More...

#include <mxpalette.h>

Inheritance diagram for MxPalette:
Collaboration diagram for MxPalette:

Public Member Functions

MxBool operator== (MxPalette &p_other)
 [AI] Compares two palettes for equality by checking all 256 color entries (RGB only, not flags). More...
 
void Detach ()
 [AI] Detaches the internal DirectDraw palette object, releasing ownership. More...
 
 MxPalette ()
 [AI] Constructs a new palette, initializing to the system or default palette entries. More...
 
 MxPalette (const RGBQUAD *)
 [AI] Constructs a palette using an array of RGBQUADs for indices 10..245, with system entries at borders. More...
 
 ~MxPalette () override
 [AI] Destructor. More...
 
void ApplySystemEntriesToPalette (LPPALETTEENTRY p_entries)
 [AI] Copies system palette entries (first and last 10) to the specified buffer. More...
 
MxPaletteClone ()
 [AI] Creates a duplicate of this palette object with the same palette data and override flag. More...
 
void GetDefaultPalette (LPPALETTEENTRY p_entries)
 [AI] Retrieves the default palette for the current system/graphics environment. More...
 
MxResult GetEntries (LPPALETTEENTRY p_entries)
 [AI] Copies all palette entries to external buffer. More...
 
MxResult SetEntries (LPPALETTEENTRY p_palette)
 [AI] Sets the palette's RGB entries from an external array and updates the DirectDraw palette if attached. More...
 
MxResult SetSkyColor (LPPALETTEENTRY p_skyColor)
 [AI] Sets the "sky color" palette entry (typically index 141, reserved for sky background), and updates attached DirectDraw palette. More...
 
void Reset (MxBool p_ignoreSkyColor)
 [AI] Resets palette entries to default system values, optionally preserving the current sky color, then uploads to DirectDraw. More...
 
LPDIRECTDRAWPALETTE CreateNativePalette ()
 [AI] Creates the internal DirectDraw palette object and populates it with the current palette entries. More...
 
void SetPalette (LPDIRECTDRAWPALETTE p_palette)
 [AI] Sets the internal DirectDraw palette pointer, releasing any previously held instance. More...
 
void SetOverrideSkyColor (MxBool p_value)
 [AI] Sets whether the sky color is overridden, preventing calls to SetSkyColor from effecting palette entries. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Detailed Description

[AI] Encapsulates a DirectDraw 8-bit (256 color) palette for use with DirectX rendering.

Handles palette entry management, overrides for special colors (e.g., sky), cloning, and platform/system palette integration. [AI]

The palette provides facilities to set, retrieve, and modify palette entries, set the palette for rendering, and override specific entries for custom rendering effects such as sky gradients. Internal members allow for efficient updates and synchronization with DirectDraw API objects. [AI]

Definition at line 17 of file mxpalette.h.

Constructor & Destructor Documentation

◆ MxPalette() [1/2]

MxPalette::MxPalette ( )

[AI] Constructs a new palette, initializing to the system or default palette entries.

[AI]

Definition at line 77 of file mxpalette.cpp.

◆ MxPalette() [2/2]

MxPalette::MxPalette ( const RGBQUAD *  p_colors)

[AI] Constructs a palette using an array of RGBQUADs for indices 10..245, with system entries at borders.

[AI]

Parameters
p_colorsPointer to RGBQUAD array (minimum 256 entries recommended). [AI]

Definition at line 87 of file mxpalette.cpp.

◆ ~MxPalette()

MxPalette::~MxPalette ( )
override

[AI] Destructor.

Releases any allocated DirectDraw palette. [AI]

Definition at line 105 of file mxpalette.cpp.

Member Function Documentation

◆ ApplySystemEntriesToPalette()

void MxPalette::ApplySystemEntriesToPalette ( LPPALETTEENTRY  p_entries)

[AI] Copies system palette entries (first and last 10) to the specified buffer.

[AI]

Parameters
p_entriesPointer to a PALETTEENTRY array to receive system entries. [AI]

Used to synchronize palette with system colors for correct display. [AI]

Definition at line 293 of file mxpalette.cpp.

◆ Clone()

MxPalette * MxPalette::Clone ( )

[AI] Creates a duplicate of this palette object with the same palette data and override flag.

[AI]

Returns
A new MxPalette instance with copied entries and state. [AI]

Definition at line 160 of file mxpalette.cpp.

◆ CreateNativePalette()

LPDIRECTDRAWPALETTE MxPalette::CreateNativePalette ( )

[AI] Creates the internal DirectDraw palette object and populates it with the current palette entries.

[AI]

Returns
LPDIRECTDRAWPALETTE to the created native palette object (can be NULL on failure). [AI]

On first call, creates palette. No-op on subsequent calls. [AI]

Definition at line 114 of file mxpalette.cpp.

◆ Detach()

void MxPalette::Detach ( )

[AI] Detaches the internal DirectDraw palette object, releasing ownership.

Does not release the underlying DirectDraw resource. [AI]

Definition at line 266 of file mxpalette.cpp.

◆ GetDefaultPalette()

void MxPalette::GetDefaultPalette ( LPPALETTEENTRY  p_entries)

[AI] Retrieves the default palette for the current system/graphics environment.

[AI]

Parameters
p_entriesPointer to a PALETTEENTRY array to receive all default entries. [AI]

Uses system palette if supported, otherwise uses static default. [AI]

Definition at line 311 of file mxpalette.cpp.

◆ GetEntries()

MxResult MxPalette::GetEntries ( LPPALETTEENTRY  p_entries)

[AI] Copies all palette entries to external buffer.

[AI]

Parameters
p_entriesOutput buffer for 256 palette entries. [AI]
Returns
SUCCESS always. [AI]

Definition at line 170 of file mxpalette.cpp.

◆ operator==()

MxBool MxPalette::operator== ( MxPalette p_other)

[AI] Compares two palettes for equality by checking all 256 color entries (RGB only, not flags).

[AI]

Parameters
p_otherThe palette to compare with. [AI]
Returns
TRUE if all RGB entries are equal; otherwise FALSE. [AI]

Definition at line 273 of file mxpalette.cpp.

◆ Reset()

void MxPalette::Reset ( MxBool  p_ignoreSkyColor)

[AI] Resets palette entries to default system values, optionally preserving the current sky color, then uploads to DirectDraw.

[AI]

Parameters
p_ignoreSkyColorIf FALSE, the sky color entry will be forcibly set. [AI]

Definition at line 329 of file mxpalette.cpp.

◆ SetEntries()

MxResult MxPalette::SetEntries ( LPPALETTEENTRY  p_palette)

[AI] Sets the palette's RGB entries from an external array and updates the DirectDraw palette if attached.

[AI]

Parameters
p_paletteInput buffer of 256 palette entries. [AI]
Returns
SUCCESS if successful; FAILURE on DirectDraw error. [AI]

Definition at line 178 of file mxpalette.cpp.

◆ SetOverrideSkyColor()

void MxPalette::SetOverrideSkyColor ( MxBool  p_value)
inline

[AI] Sets whether the sky color is overridden, preventing calls to SetSkyColor from effecting palette entries.

[AI]

Parameters
p_valueTRUE to override, FALSE to use palette. [AI]

Definition at line 112 of file mxpalette.h.

◆ SetPalette()

void MxPalette::SetPalette ( LPDIRECTDRAWPALETTE  p_palette)

[AI] Sets the internal DirectDraw palette pointer, releasing any previously held instance.

No copy is made. [AI]

Parameters
p_palettePointer to DirectDraw palette instance. [AI]

Definition at line 255 of file mxpalette.cpp.

◆ SetSkyColor()

MxResult MxPalette::SetSkyColor ( LPPALETTEENTRY  p_skyColor)

[AI] Sets the "sky color" palette entry (typically index 141, reserved for sky background), and updates attached DirectDraw palette.

[AI]

Parameters
p_skyColorPointer to sky color entry (only one entry used). [AI]
Returns
SUCCESS or FAILURE depending on update result. [AI]

If override for sky color is enabled, this call has no effect. [AI]

Definition at line 239 of file mxpalette.cpp.


The documentation for this class was generated from the following files: