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