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 \membersection{wxPalette::
\destruct{wxPalette
}}
62 \func{}{\destruct{wxPalette
}}{\void}
66 \membersection{wxPalette::Create
}\label{wxpalettecreate
}
68 \func{bool
}{Create
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},
\rtfsp
69 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
71 Creates a palette from arrays of size
{\it n
}, one for each
72 red, blue or green component.
74 \wxheading{Parameters
}
76 \docparam{n
}{The number of indices in the palette.
}
78 \docparam{red
}{An array of red values.
}
80 \docparam{green
}{An array of green values.
}
82 \docparam{blue
}{An array of blue values.
}
84 \wxheading{Return value
}
86 TRUE if the creation was successful, FALSE otherwise.
90 \helpref{wxPalette::wxPalette
}{wxpaletteconstr
}
92 \membersection{wxPalette::GetPixel
}\label{wxpalettegetpixel
}
94 \constfunc{int
}{GetPixel
}{\param{const unsigned char
}{red
},
\param{const unsigned char
}{green
},
\rtfsp
95 \param{const unsigned char
}{blue
}}
97 Returns a pixel value (index into the palette) for the given RGB values.
99 \wxheading{Parameters
}
101 \docparam{red
}{Red value.
}
103 \docparam{green
}{Green value.
}
105 \docparam{blue
}{Blue value.
}
107 \wxheading{Return value
}
109 The nearest palette index.
113 \helpref{wxPalette::GetRGB
}{wxpalettegetrgb
}
115 \membersection{wxPalette::GetRGB
}\label{wxpalettegetrgb
}
117 \constfunc{bool
}{GetPixel
}{\param{int
}{ pixel
},
\param{const unsigned char*
}{red
},
\param{const unsigned char*
}{green
},
\rtfsp
118 \param{const unsigned char*
}{blue
}}
120 Returns RGB values for a given palette index.
122 \wxheading{Parameters
}
124 \docparam{pixel
}{The palette index.
}
126 \docparam{red
}{Receives the red value.
}
128 \docparam{green
}{Receives the green value.
}
130 \docparam{blue
}{Receives the blue value.
}
132 \wxheading{Return value
}
134 TRUE if the operation was successful.
138 \helpref{wxPalette::GetPixel
}{wxpalettegetpixel
}
140 \membersection{wxPalette::Ok
}\label{wxpaletteok
}
142 \constfunc{bool
}{Ok
}{\void}
144 Returns TRUE if palette data is present.
146 \membersection{wxPalette::operator $=$
}\label{wxpaletteassignment
}
148 \func{wxPalette\&
}{operator $=$
}{\param{const wxPalette\&
}{palette
}}
150 Assignment operator, using reference counting. Returns a reference
153 \membersection{wxPalette::operator $==$
}\label{wxpaletteequals
}
155 \func{bool
}{operator $==$
}{\param{const wxPalette\&
}{palette
}}
157 Equality operator. Two palettes are equal if they contain pointers
158 to the same underlying palette data. It does not compare each attribute,
159 so two independently-created palettes using the same parameters will
162 \membersection{wxPalette::operator $!=$
}\label{wxpalettenotequals
}
164 \func{bool
}{operator $!=$
}{\param{const wxPalette\&
}{palette
}}
166 Inequality operator. Two palettes are not equal if they contain pointers
167 to different underlying palette data. It does not compare each attribute.