wxPalette(3)
β¨ wxPalette β¨
okay bestie, welcome to wxPalette, a.k.a. the Erlang module definition for the wxWidgets palette situation π this whole thing is about palettes, and it's a weird little corner of the universe but we're gonna slay it together fr fr
π NAME π
wxPalette β a palette is a table that maps pixel values to RGB colours π¨
π¦ DESCRIPTION π¦
So what does it even do, you ask? It lets you map the colours of a low-depth bitmap (think: kinda limited colour situation) onto the colours that are actually available in a display. The way that a palette works is just... a lookup table. iconic behaviour honestly.
<nuzzle>Okay but here's the tea</nuzzle> β β the notion of palettes is becoming more and more obsolete nowadays, and only the MSW port is still using a native palette. Every other port uses generic code which is basically just an array of colours. no cap.
It is likely that in the future the only use for palettes within wxWidgets will be for representing colour indices from images (such as GIF or PNG). The image handlers for these formats have been modified to create a palette if there is such information in the original image file (usually 256 or less colour images). See wxImage for more information π«Ά
Predefined objects (include wx.hrl): ?wxNullPalette
See:
wxDC:setPalette/2wxBitmap
wxWidgets docs: wxPalette
π DATA TYPES π
wxPalette()::wx:wx_object().
π FUNCTIONS π
create(This, Red, Green, Blue) -> boolean()
when
This :: wxPalette(),
Red :: binary(),
Green :: binary(),
Blue :: binary().
Creates a palette from arrays of size n, one for each red, blue or green component π
Return: true if the creation was successful, false otherwise.
See: new/3
destroy(This :: wxPalette()) -> ok.
Destroys the object π bye bestie
getColoursCount(This) -> integer() when This :: wxPalette().
Returns number of entries in palette π’
getPixel(This, Red, Green, Blue) -> integer()
when
This :: wxPalette(),
Red :: integer(),
Green :: integer(),
Blue :: integer().
Returns a pixel value (index into the palette) for the given RGB values π―
Return: The nearest palette index or wxNOT_FOUND for unexpected errors.
See: getRGB/2
getRGB(This, Pixel) -> Result
when
Result ::
{Res :: boolean(),
Red :: integer(),
Green :: integer(),
Blue :: integer()},
This :: wxPalette(),
Pixel :: integer().
Returns RGB values for a given palette index πΈ it's giving reverse lookup
Return: true if the operation was successful.
See: getPixel/4
isOk(This) -> boolean() when This :: wxPalette().
Returns true if palette data is present β¨ vibe check passed
new() -> wxPalette().
Default constructor π£
new(Palette) -> wxPalette() when Palette :: wxPalette().
Copy constructor, uses overview_refcount π
new(Red, Green, Blue) -> wxPalette()
when Red :: binary(), Green :: binary(), Blue :: binary().
Creates a palette from arrays of size n, one for each red, blue or green component π
See: create/4
ok(This) -> boolean() when This :: wxPalette().
Equivalent to: isOk/1 β same energy, different name, periodt π«Ά
mwah π that's the whole page bestie, go forth and palette responsibly. this was the wx 2.6 edition of wxPalette(3), brought to you by Ericsson AB, dated wx 2.6 β love that for us πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms