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
}
14 \helpref{wxDC::SetPalette
}{wxdcsetpalette
},
\helpref{wxBitmap
}{wxbitmap
}
16 \latexignore{\rtfignore{\wxheading{Members
}}}
18 \membersection{wxPalette::wxPalette
}\label{wxpaletteconstr
}
20 \func{}{wxPalette
}{\void}
24 \func{}{wxPalette
}{\param{const wxPalette\&
}{ palette
}}
26 Copy constructor. This uses reference counting so is a cheap operation.
28 \func{}{wxPalette
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},\\
29 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
31 Creates a palette from arrays of size
{\it n
}, one for each
32 red, blue or green component.
34 \wxheading{Parameters
}
36 \docparam{palette
}{A pointer or reference to the palette to copy.
}
38 \docparam{n
}{The number of indices in the palette.
}
40 \docparam{red
}{An array of red values.
}
42 \docparam{green
}{An array of green values.
}
44 \docparam{blue
}{An array of blue values.
}
48 \helpref{wxPalette::Create
}{wxpalettecreate
}
50 \membersection{wxPalette::
\destruct{wxPalette
}}
52 \func{}{\destruct{wxPalette
}}{\void}
56 \membersection{wxPalette::Create
}\label{wxpalettecreate
}
58 \func{bool
}{Create
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},
\rtfsp
59 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
61 Creates a palette from arrays of size
{\it n
}, one for each
62 red, blue or green component.
64 \wxheading{Parameters
}
66 \docparam{n
}{The number of indices in the palette.
}
68 \docparam{red
}{An array of red values.
}
70 \docparam{green
}{An array of green values.
}
72 \docparam{blue
}{An array of blue values.
}
74 \wxheading{Return value
}
76 TRUE if the creation was successful, FALSE otherwise.
80 \helpref{wxPalette::wxPalette
}{wxpaletteconstr
}
82 \membersection{wxPalette::GetPixel
}\label{wxpalettegetpixel
}
84 \constfunc{int
}{GetPixel
}{\param{const unsigned char
}{red
},
\param{const unsigned char
}{green
},
\rtfsp
85 \param{const unsigned char
}{blue
}}
87 Returns a pixel value (index into the palette) for the given RGB values.
89 \wxheading{Parameters
}
91 \docparam{red
}{Red value.
}
93 \docparam{green
}{Green value.
}
95 \docparam{blue
}{Blue value.
}
97 \wxheading{Return value
}
99 The nearest palette index.
103 \helpref{wxPalette::GetRGB
}{wxpalettegetrgb
}
105 \membersection{wxPalette::GetRGB
}\label{wxpalettegetrgb
}
107 \constfunc{bool
}{GetPixel
}{\param{int
}{ pixel
},
\param{const unsigned char*
}{red
},
\param{const unsigned char*
}{green
},
\rtfsp
108 \param{const unsigned char*
}{blue
}}
110 Returns RGB values for a given palette index.
112 \wxheading{Parameters
}
114 \docparam{pixel
}{The palette index.
}
116 \docparam{red
}{Receives the red value.
}
118 \docparam{green
}{Receives the green value.
}
120 \docparam{blue
}{Receives the blue value.
}
122 \wxheading{Return value
}
124 TRUE if the operation was successful.
128 \helpref{wxPalette::GetPixel
}{wxpalettegetpixel
}
130 \membersection{wxPalette::Ok
}\label{wxpaletteok
}
132 \constfunc{bool
}{Ok
}{\void}
134 Returns TRUE if palette data is present.
136 \membersection{wxPalette::operator $=$
}\label{wxpaletteassignment
}
138 \func{wxPalette\&
}{operator $=$
}{\param{const wxPalette\&
}{palette
}}
140 Assignment operator, using reference counting. Returns a reference
143 \membersection{wxPalette::operator $==$
}\label{wxpaletteequals
}
145 \func{bool
}{operator $==$
}{\param{const wxPalette\&
}{palette
}}
147 Equality operator. Two palettes are equal if they contain pointers
148 to the same underlying palette data. It does not compare each attribute,
149 so two independently-created palettes using the same parameters will
152 \membersection{wxPalette::operator $!=$
}\label{wxpalettenotequals
}
154 \func{bool
}{operator $!=$
}{\param{const wxPalette\&
}{palette
}}
156 Inequality operator. Two palettes are not equal if they contain pointers
157 to different underlying palette data. It does not compare each attribute.