wxPalette(3erl)
π wxPalette (Erlang Module Definition)
okay bestie, so this is the wxPalette page from the Erlang module docs β yes, the one and only wxPalette(3erl) β and we're gonna get you obsessed with it. Let's go β¨
π NAME
wxPalette β literally just functions for the wxPalette class. that's the whole vibe. π
β¨ DESCRIPTION
so. A palette is a table that maps pixel values to RGB colours π It lets you take the colours of a low-depth bitmap, for example, and map them to the available colours in a display. iconic behaviour, honestly.
but like β ngl β the notion of palettes is becoming more and more obsolete nowadays, and only the MSW port is still using a native palette π All the other ports use generic code which is basically just an array of colours. no cap, that's it.
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 β iykyk.
Predefined objects (include wx.hrl): ?wxNullPalette π
See:wxDC:setPalette/2,wxBitmap
wxWidgets docs: wxPalette πΈ
π§ DATA TYPES
wxPalette() = wx:wx_object()
that's it. that's the type. slay. π
π EXPORTS
new() -> wxPalette()β Default constructor. the classic, the blueprint, the main character energy π«Άnew(Palette) -> wxPalette()
Types:
Palette = wxPalette()
Copy constructor β and yes, it uses overview_refcount π
new(Red, Green, Blue) -> wxPalette()
Types:
Red = Green = Blue = binary()
Creates a palette from arrays of size n, one for each red, blue or green component β¨
See: create/4
destroy(This :: wxPalette()) -> okβ Destructor. bye bestie π
See: reference-counted object destruction
create(This, Red, Green, Blue) -> boolean()
Types:
This = wxPalette()
Red = Green = 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
getColoursCount(This) -> integer()
Types:
This = wxPalette()
Returns number of entries in palette. like counting your besties π₯
getPixel(This, Red, Green, Blue) -> integer()
Types:
This = wxPalette()
Red = Green = 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. not found?? rude but okay π
See: getRGB/2
getRGB(This, Pixel) -> Result
Types:
Result =
{Res :: boolean(),
Red :: integer(),
Green :: integer(),
Blue :: integer()}
This = wxPalette()
Pixel = integer()
Returns RGB values for a given palette index π
Return: true if the operation was successful.
See: getPixel/4
ok(This) -> boolean()
Types:
This = wxPalette()
See: isOk/1.
isOk(This) -> boolean()
Types:
This = wxPalette()
Returns true if palette data is present. vibe check passed β
that's the whole page, bestie β every option, every type, every See: reference, all of it, untouched π stay hydrated and go map some pixels π
β with love, the wxWidgets team π (source: wx 2.2.2.1, and this manual page is wxPalette(3erl)) π¦
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms