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.
8 \wxheading{Derived from
}
10 \helpref{wxGDIObject
}{wxgdiobject
}\\
11 \helpref{wxObject
}{wxobject
}
15 \helpref{wxDC::SetPalette
}{wxdcsetpalette
},
\helpref{wxBitmap
}{wxbitmap
}
17 \latexignore{\rtfignore{\wxheading{Members
}}}
19 \membersection{wxPalette::wxPalette
}\label{wxpaletteconstr
}
21 \func{}{wxPalette
}{\void}
25 \func{}{wxPalette
}{\param{const wxPalette\&
}{ palette
}}
27 Copy constructor. This uses reference counting so is a cheap operation.
29 \func{}{wxPalette
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},\\
30 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
32 Creates a palette from arrays of size
{\it n
}, one for each
33 red, blue or green component.
35 \wxheading{Parameters
}
37 \docparam{palette
}{A pointer or reference to the palette to copy.
}
39 \docparam{n
}{The number of indices in the palette.
}
41 \docparam{red
}{An array of red values.
}
43 \docparam{green
}{An array of green values.
}
45 \docparam{blue
}{An array of blue values.
}
49 \helpref{wxPalette::Create
}{wxpalettecreate
}
51 \membersection{wxPalette::
\destruct{wxPalette
}}
53 \func{}{\destruct{wxPalette
}}{\void}
57 \membersection{wxPalette::Create
}\label{wxpalettecreate
}
59 \func{bool
}{Create
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},
\rtfsp
60 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
62 Creates a palette from arrays of size
{\it n
}, one for each
63 red, blue or green component.
65 \wxheading{Parameters
}
67 \docparam{n
}{The number of indices in the palette.
}
69 \docparam{red
}{An array of red values.
}
71 \docparam{green
}{An array of green values.
}
73 \docparam{blue
}{An array of blue values.
}
75 \wxheading{Return value
}
77 TRUE if the creation was successful, FALSE otherwise.
81 \helpref{wxPalette::wxPalette
}{wxpaletteconstr
}
83 \membersection{wxPalette::GetPixel
}\label{wxpalettegetpixel
}
85 \constfunc{int
}{GetPixel
}{\param{const unsigned char
}{red
},
\param{const unsigned char
}{green
},
\rtfsp
86 \param{const unsigned char
}{blue
}}
88 Returns a pixel value (index into the palette) for the given RGB values.
90 \wxheading{Parameters
}
92 \docparam{red
}{Red value.
}
94 \docparam{green
}{Green value.
}
96 \docparam{blue
}{Blue value.
}
98 \wxheading{Return value
}
100 The nearest palette index.
104 \helpref{wxPalette::GetRGB
}{wxpalettegetrgb
}
106 \membersection{wxPalette::GetRGB
}\label{wxpalettegetrgb
}
108 \constfunc{bool
}{GetPixel
}{\param{int
}{ pixel
},
\param{const unsigned char*
}{red
},
\param{const unsigned char*
}{green
},
\rtfsp
109 \param{const unsigned char*
}{blue
}}
111 Returns RGB values for a given palette index.
113 \wxheading{Parameters
}
115 \docparam{pixel
}{The palette index.
}
117 \docparam{red
}{Receives the red value.
}
119 \docparam{green
}{Receives the green value.
}
121 \docparam{blue
}{Receives the blue value.
}
123 \wxheading{Return value
}
125 TRUE if the operation was successful.
129 \helpref{wxPalette::GetPixel
}{wxpalettegetpixel
}
131 \membersection{wxPalette::Ok
}\label{wxpaletteok
}
133 \constfunc{bool
}{Ok
}{\void}
135 Returns TRUE if palette data is present.
137 \membersection{wxPalette::operator $=$
}\label{wxpaletteassignment
}
139 \func{wxPalette\&
}{operator $=$
}{\param{const wxPalette\&
}{palette
}}
141 Assignment operator, using reference counting. Returns a reference
144 \membersection{wxPalette::operator $==$
}\label{wxpaletteequals
}
146 \func{bool
}{operator $==$
}{\param{const wxPalette\&
}{palette
}}
148 Equality operator. Two palettes are equal if they contain pointers
149 to the same underlying palette data. It does not compare each attribute,
150 so two independently-created palettes using the same parameters will
153 \membersection{wxPalette::operator $!=$
}\label{wxpalettenotequals
}
155 \func{bool
}{operator $!=$
}{\param{const wxPalette\&
}{palette
}}
157 Inequality operator. Two palettes are not equal if they contain pointers
158 to different underlying palette data. It does not compare each attribute.