Class: Wx::Palette

Inherits:
GDIObject show all
Defined in:
lib/wx/doc/gen/palette.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A palette is a table that maps pixel values to RGB colours.

It allows the colours of a low-depth bitmap, for example, to be mapped to the available colours in a display. The notion of palettes is becoming more and more obsolete nowadays and only the MSW port is still using a native palette. All other ports use generic code which is basically just an array of colours. 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 Image for more information.

Category: Graphics Device Interface (GDI) Predefined objects/pointers: NULL_PALETTE

Instance Method Summary collapse

Methods inherited from GDIObject

#clone, #dup

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::Palette #initialize(palette) ⇒ Wx::Palette #initialize(n, green, blue) ⇒ Wx::Palette

Returns a new instance of Palette.

Overloads:

  • #initializeWx::Palette

    Default constructor.

  • #initialize(palette) ⇒ Wx::Palette

    Copy constructor, uses Reference Counting.

    Parameters:

    • palette (Wx::Palette)

      A reference to the palette to copy.

  • #initialize(n, green, blue) ⇒ Wx::Palette

    Creates a palette from arrays of size n, one for each red, blue or green component.

    Parameters:

    • n (Array<Integer>)

      The number of indices in the palette.

    • green (Array<Integer>)

      An array of green values.

    • blue (Array<Integer>)

      An array of blue values.

    See Also:



44
# File 'lib/wx/doc/gen/palette.rb', line 44

def initialize(*args) end

Instance Method Details

#create(n, green, blue) ⇒ Boolean

Creates a palette from arrays of size n, one for each red, blue or green component.

true if the creation was successful, false otherwise.

Parameters:

  • n (Array<Integer>)

    The number of indices in the palette.

  • green (Array<Integer>)

    An array of green values.

  • blue (Array<Integer>)

    An array of blue values.

Returns:

  • (Boolean)

See Also:

  • palette


54
# File 'lib/wx/doc/gen/palette.rb', line 54

def create(n, green, blue) end

#get_colours_countInteger Also known as: colours_count

Returns number of entries in palette.

Returns:

  • (Integer)


58
# File 'lib/wx/doc/gen/palette.rb', line 58

def get_colours_count; end

#get_pixel(red, green, blue) ⇒ Integer Also known as: pixel

Returns a pixel value (index into the palette) for the given RGB values.

The nearest palette index or NOT_FOUND for unexpected errors.

Parameters:

  • red (Integer)

    Red value.

  • green (Integer)

    Green value.

  • blue (Integer)

    Blue value.

Returns:

  • (Integer)

See Also:



69
# File 'lib/wx/doc/gen/palette.rb', line 69

def get_pixel(red, green, blue) end

#get_rgb(pixel, red, green, blue) ⇒ Boolean Also known as: rgb

Returns RGB values for a given palette index.

true if the operation was successful.

Parameters:

  • pixel (Integer)

    The palette index.

  • red (unsigned char)

    Receives the red value.

  • green (unsigned char)

    Receives the green value.

  • blue (unsigned char)

    Receives the blue value.

Returns:

  • (Boolean)

See Also:



81
# File 'lib/wx/doc/gen/palette.rb', line 81

def get_rgb(pixel, red, green, blue) end

#is_okBoolean Also known as: ok?

Returns true if palette data is present.

Returns:

  • (Boolean)


86
# File 'lib/wx/doc/gen/palette.rb', line 86

def is_ok; end