Jazz2::Scripting::Legacy::jjPAL class

A 256-color palette.

Reference-counted wrapper around 256 jjPALCOLOR entries, mirroring the original JJ2+ palette object. Scripts use it to read and edit individual colors and to fill, tint, gradient or copy ranges, then apply() the result to the screen (or reset() back to the level default). Backs the global jjPalette.

Public static functions

static auto Create() -> jjPAL*
Returns a new instance.

Constructors, destructors, conversion operators

jjPAL()
Creates a new instance.
~jjPAL()

Public functions

void AddRef()
Increments the reference count.
void Release()
Decrements the reference count.
auto operator=(const jjPAL& o) -> jjPAL&
auto operator==(const jjPAL& o) -> bool
auto getColor(std::uint8_t idx) -> jjPALCOLOR&
Returns the color at the specified palette index.
auto getConstColor(std::uint8_t idx) const -> const jjPALCOLOR&
Returns the read-only color at the specified palette index.
auto setColorEntry(std::uint8_t idx, jjPALCOLOR& value) -> jjPALCOLOR&
Sets the color at the specified palette index.
void reset()
Resets the palette to the level default.
void apply()
Applies the palette so it takes effect on screen.
auto load(const String& filename) -> bool
Loads the palette from a file.
void fill(std::uint8_t red, std::uint8_t green, std::uint8_t blue, float opacity)
Fills the whole palette with the given color, blended by opacity.
void fillTint(std::uint8_t red, std::uint8_t green, std::uint8_t blue, std::uint8_t start, std::uint8_t length, float opacity)
Tints a range of palette entries with the given color.
void fillFromColor(jjPALCOLOR color, float opacity)
Fills the whole palette with the given color, blended by opacity.
void fillTintFromColor(jjPALCOLOR color, std::uint8_t start, std::uint8_t length, float opacity)
Tints a range of palette entries with the given color.
void gradient(std::uint8_t red1, std::uint8_t green1, std::uint8_t blue1, std::uint8_t red2, std::uint8_t green2, std::uint8_t blue2, std::uint8_t start, std::uint8_t length, float opacity, bool inclusive)
Writes a color gradient into a range of palette entries.
void gradientFromColor(jjPALCOLOR color1, jjPALCOLOR color2, std::uint8_t start, std::uint8_t length, float opacity, bool inclusive)
Writes a color gradient into a range of palette entries.
void copyFrom(std::uint8_t start, std::uint8_t length, std::uint8_t start2, const jjPAL& source, float opacity)
Copies a range of entries from another palette, blended by opacity.
auto findNearestColor(jjPALCOLOR color) -> std::uint8_t
Returns the palette index closest to the given color.