1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxPalette docs
8 %% Copyright: (c) wxWidgets
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxPalette
}}\label{wxpalette
}
14 A palette is a table that maps pixel values to RGB colours. It allows the colours
15 of a low-depth bitmap, for example, to be mapped to the available colours in a display.
17 %TODO: topic overview for wxPalette.
18 \wxheading{Derived from
}
20 \helpref{wxGDIObject
}{wxgdiobject
}\\
21 \helpref{wxObject
}{wxobject
}
23 \wxheading{Include files
}
27 \wxheading{Predefined objects
}
35 \helpref{wxDC::SetPalette
}{wxdcsetpalette
},
\helpref{wxBitmap
}{wxbitmap
}
37 \latexignore{\rtfignore{\wxheading{Members
}}}
39 \membersection{wxPalette::wxPalette
}\label{wxpalettector
}
41 \func{}{wxPalette
}{\void}
45 \func{}{wxPalette
}{\param{const wxPalette\&
}{ palette
}}
47 Copy constructor. This uses reference counting so is a cheap operation.
49 \func{}{wxPalette
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},\\
50 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
52 Creates a palette from arrays of size
{\it n
}, one for each
53 red, blue or green component.
55 \wxheading{Parameters
}
57 \docparam{palette
}{A pointer or reference to the palette to copy.
}
59 \docparam{n
}{The number of indices in the palette.
}
61 \docparam{red
}{An array of red values.
}
63 \docparam{green
}{An array of green values.
}
65 \docparam{blue
}{An array of blue values.
}
69 \helpref{wxPalette::Create
}{wxpalettecreate
}
71 \perlnote{In wxPerl the third constructor form takes as parameters
72 3 array references ( they must be of the same length ).
}
74 \membersection{wxPalette::
\destruct{wxPalette
}}\label{wxpalettedtor
}
76 \func{}{\destruct{wxPalette
}}{\void}
80 \membersection{wxPalette::Create
}\label{wxpalettecreate
}
82 \func{bool
}{Create
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},
\rtfsp
83 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
85 Creates a palette from arrays of size
{\it n
}, one for each
86 red, blue or green component.
88 \wxheading{Parameters
}
90 \docparam{n
}{The number of indices in the palette.
}
92 \docparam{red
}{An array of red values.
}
94 \docparam{green
}{An array of green values.
}
96 \docparam{blue
}{An array of blue values.
}
98 \wxheading{Return value
}
100 true if the creation was successful, false otherwise.
104 \helpref{wxPalette::wxPalette
}{wxpalettector
}
106 \membersection{wxPalette::GetColoursCount
}\label{wxpalettegetcolourscount
}
108 \constfunc{int
}{GetColoursCount
}{\void}
110 Returns number of entries in palette.
112 \membersection{wxPalette::GetPixel
}\label{wxpalettegetpixel
}
114 \constfunc{int
}{GetPixel
}{\param{unsigned char
}{red
},
\param{unsigned char
}{green
},
\rtfsp
115 \param{unsigned char
}{blue
}}
117 Returns a pixel value (index into the palette) for the given RGB values.
119 \wxheading{Parameters
}
121 \docparam{red
}{Red value.
}
123 \docparam{green
}{Green value.
}
125 \docparam{blue
}{Blue value.
}
127 \wxheading{Return value
}
129 The nearest palette index or
{\tt wxNOT
\_FOUND} for unexpected errors.
133 \helpref{wxPalette::GetRGB
}{wxpalettegetrgb
}
135 \membersection{wxPalette::GetRGB
}\label{wxpalettegetrgb
}
137 \constfunc{bool
}{GetRGB
}{\param{int
}{ pixel
},
\param{const unsigned char*
}{red
},
\param{const unsigned char*
}{green
},
\rtfsp
138 \param{const unsigned char*
}{blue
}}
140 Returns RGB values for a given palette index.
142 \wxheading{Parameters
}
144 \docparam{pixel
}{The palette index.
}
146 \docparam{red
}{Receives the red value.
}
148 \docparam{green
}{Receives the green value.
}
150 \docparam{blue
}{Receives the blue value.
}
152 \wxheading{Return value
}
154 true if the operation was successful.
158 \helpref{wxPalette::GetPixel
}{wxpalettegetpixel
}
160 \perlnote{In wxPerl this method takes only the
{\tt pixel
} parameter and
161 returns a
3-element list ( or the empty list upon failure ).
}
163 \membersection{wxPalette::Ok
}\label{wxpaletteok
}
165 \constfunc{bool
}{Ok
}{\void}
167 Returns true if palette data is present.
169 \membersection{wxPalette::operator $=$
}\label{wxpaletteassignment
}
171 \func{wxPalette\&
}{operator $=$
}{\param{const wxPalette\&
}{palette
}}
173 Assignment operator, using reference counting. Returns a reference
176 \membersection{wxPalette::operator $==$
}\label{wxpaletteequals
}
178 \func{bool
}{operator $==$
}{\param{const wxPalette\&
}{palette
}}
180 Equality operator. Two palettes are equal if they contain pointers
181 to the same underlying palette data. It does not compare each attribute,
182 so two independently-created palettes using the same parameters will
185 \membersection{wxPalette::operator $!=$
}\label{wxpalettenotequals
}
187 \func{bool
}{operator $!=$
}{\param{const wxPalette\&
}{palette
}}
189 Inequality operator. Two palettes are not equal if they contain pointers
190 to different underlying palette data. It does not compare each attribute.