jjPALCOLOR struct
#include <Jazz2/Scripting/Legacy/Palette.h>
A single color of a palette or a 32-bit image.
Red, green and blue components, plus alpha used only by 32-bit images. Also provides conversions to and from hue, saturation and lightness.
Public static functions
- static void Create(void* self)
- Creates a black color with all components 0.
-
static void CreateFromRgb(std::
uint8_t red, std:: uint8_t green, std:: uint8_t blue, void* self) - Creates a color from red, green and blue components, alpha is 0.
-
static void CreateFromRgba(std::
uint8_t red, std:: uint8_t green, std:: uint8_t blue, std:: uint8_t alpha, void* self) - Creates a color from red, green, blue and alpha components.
Public functions
-
auto getHue() -> std::
uint8_t - Returns the hue of the color, 0 to 255 for a full circle.
-
auto getSat() -> std::
uint8_t - Returns the saturation of the color, from 0 (gray) to 255.
-
auto getLight() -> std::
uint8_t - Returns the lightness of the color, from 0 (black) to 255 (white).
-
void swizzle(std::
uint32_t redc, std:: uint32_t greenc, std:: uint32_t bluec) - Rearranges the color components.
-
void setHSL(std::
int32_t hue, std:: uint8_t sat, std:: uint8_t light) - Sets the color from hue, saturation and lightness.
- auto operator=(const jjPALCOLOR& other) -> jjPALCOLOR&
- Copies all four components of another color.
- auto operator==(const jjPALCOLOR& other) -> bool
- Returns whether two colors have the same red, green and blue components, alpha isn't compared.
Public variables
-
std::
uint8_t red - Red component, 0 to 255.
-
std::
uint8_t green - Green component, 0 to 255.
-
std::
uint8_t blue - Blue component, 0 to 255.
-
std::
uint8_t alpha - Alpha component, 0 to 255.
Function documentation
void Jazz2:: Scripting:: Legacy:: jjPALCOLOR:: swizzle(std:: uint32_t redc,
std:: uint32_t greenc,
std:: uint32_t bluec)
Rearranges the color components.
Each parameter names the COLOR::Component whose current value goes into red, green and blue respectively, e.g. swizzle(COLOR::BLUE, COLOR::GREEN, COLOR::RED) swaps red and blue. Alpha isn't changed, and COLOR::ALPHA as a source leaves that component as it is.
void Jazz2:: Scripting:: Legacy:: jjPALCOLOR:: setHSL(std:: int32_t hue,
std:: uint8_t sat,
std:: uint8_t light)
Sets the color from hue, saturation and lightness.
All three are on a 0 to 255 scale. The hue wraps around, so values outside that range are valid, e.g. 258 and -254 equal 2.
Variable documentation
std:: uint8_t Jazz2:: Scripting:: Legacy:: jjPALCOLOR:: alpha
Alpha component, 0 to 255.
Only colors of 32-bit images (jjCOLORMAP) use it; palettes ignore it and usually leave it at 0.