1 \section{\class{wxPalette
}}\label{wxpalette
}
3 A palette is a table that maps pixel values to RGB colours. It allows the colours
4 of a low-depth bitmap, for example, to be mapped to the available colours in a display.
6 %TODO: topic overview for wxPalette.
7 \wxheading{Derived from
}
9 \helpref{wxGDIObject
}{wxgdiobject
}\\
10 \helpref{wxObject
}{wxobject
}
12 \wxheading{Include files
}
16 \wxheading{Predefined objects
}
24 \helpref{wxDC::SetPalette
}{wxdcsetpalette
},
\helpref{wxBitmap
}{wxbitmap
}
26 \latexignore{\rtfignore{\wxheading{Members
}}}
28 \membersection{wxPalette::wxPalette
}\label{wxpaletteconstr
}
30 \func{}{wxPalette
}{\void}
34 \func{}{wxPalette
}{\param{const wxPalette\&
}{ palette
}}
36 Copy constructor. This uses reference counting so is a cheap operation.
38 \func{}{wxPalette
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},\\
39 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
41 Creates a palette from arrays of size
{\it n
}, one for each
42 red, blue or green component.
44 \wxheading{Parameters
}
46 \docparam{palette
}{A pointer or reference to the palette to copy.
}
48 \docparam{n
}{The number of indices in the palette.
}
50 \docparam{red
}{An array of red values.
}
52 \docparam{green
}{An array of green values.
}
54 \docparam{blue
}{An array of blue values.
}
58 \helpref{wxPalette::Create
}{wxpalettecreate
}
60 \perlnote{In wxPerl the third constructor form takes as parameters
61 3 array references ( they must be of the same length ).
}
63 \membersection{wxPalette::
\destruct{wxPalette
}}
65 \func{}{\destruct{wxPalette
}}{\void}
69 \membersection{wxPalette::Create
}\label{wxpalettecreate
}
71 \func{bool
}{Create
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},
\rtfsp
72 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
74 Creates a palette from arrays of size
{\it n
}, one for each
75 red, blue or green component.
77 \wxheading{Parameters
}
79 \docparam{n
}{The number of indices in the palette.
}
81 \docparam{red
}{An array of red values.
}
83 \docparam{green
}{An array of green values.
}
85 \docparam{blue
}{An array of blue values.
}
87 \wxheading{Return value
}
89 TRUE if the creation was successful, FALSE otherwise.
93 \helpref{wxPalette::wxPalette
}{wxpaletteconstr
}
95 \membersection{wxPalette::GetPixel
}\label{wxpalettegetpixel
}
97 \constfunc{int
}{GetPixel
}{\param{const unsigned char
}{red
},
\param{const unsigned char
}{green
},
\rtfsp
98 \param{const unsigned char
}{blue
}}
100 Returns a pixel value (index into the palette) for the given RGB values.
102 \wxheading{Parameters
}
104 \docparam{red
}{Red value.
}
106 \docparam{green
}{Green value.
}
108 \docparam{blue
}{Blue value.
}
110 \wxheading{Return value
}
112 The nearest palette index.
116 \helpref{wxPalette::GetRGB
}{wxpalettegetrgb
}
118 \membersection{wxPalette::GetRGB
}\label{wxpalettegetrgb
}
120 \constfunc{bool
}{GetPixel
}{\param{int
}{ pixel
},
\param{const unsigned char*
}{red
},
\param{const unsigned char*
}{green
},
\rtfsp
121 \param{const unsigned char*
}{blue
}}
123 Returns RGB values for a given palette index.
125 \wxheading{Parameters
}
127 \docparam{pixel
}{The palette index.
}
129 \docparam{red
}{Receives the red value.
}
131 \docparam{green
}{Receives the green value.
}
133 \docparam{blue
}{Receives the blue value.
}
135 \wxheading{Return value
}
137 TRUE if the operation was successful.
141 \helpref{wxPalette::GetPixel
}{wxpalettegetpixel
}
143 \perlnote{In wxPerl this method takes only the
{\tt pixel
} parameter and
144 returns a
3-element list ( or the empty list upon failure ).
}
146 \membersection{wxPalette::Ok
}\label{wxpaletteok
}
148 \constfunc{bool
}{Ok
}{\void}
150 Returns TRUE if palette data is present.
152 \membersection{wxPalette::operator $=$
}\label{wxpaletteassignment
}
154 \func{wxPalette\&
}{operator $=$
}{\param{const wxPalette\&
}{palette
}}
156 Assignment operator, using reference counting. Returns a reference
159 \membersection{wxPalette::operator $==$
}\label{wxpaletteequals
}
161 \func{bool
}{operator $==$
}{\param{const wxPalette\&
}{palette
}}
163 Equality operator. Two palettes are equal if they contain pointers
164 to the same underlying palette data. It does not compare each attribute,
165 so two independently-created palettes using the same parameters will
168 \membersection{wxPalette::operator $!=$
}\label{wxpalettenotequals
}
170 \func{bool
}{operator $!=$
}{\param{const wxPalette\&
}{palette
}}
172 Inequality operator. Two palettes are not equal if they contain pointers
173 to different underlying palette data. It does not compare each attribute.