]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxBitmap}}\label{wxbitmap} |
2 | ||
3 | %\overview{Overview}{wxbitmapoverview} | |
4 | % | |
5 | This class encapsulates the concept of a platform-dependent bitmap, | |
0ff2a74d | 6 | either monochrome or colour or colour with alpha channel support. |
a660d684 KB |
7 | |
8 | \wxheading{Derived from} | |
9 | ||
10 | \helpref{wxGDIObject}{wxgdiobject}\\ | |
11 | \helpref{wxObject}{wxobject} | |
12 | ||
97a798f7 | 13 | \wxheading{Include files} |
954b8ae6 JS |
14 | |
15 | <wx/bitmap.h> | |
16 | ||
20e85460 JS |
17 | \wxheading{Predefined objects} |
18 | ||
19 | Objects: | |
20 | ||
21 | {\bf wxNullBitmap} | |
22 | ||
a660d684 KB |
23 | \wxheading{See also} |
24 | ||
06d20283 RD |
25 | \helpref{wxBitmap overview}{wxbitmapoverview}, |
26 | \helpref{supported bitmap file formats}{supportedbitmapformats}, | |
27 | \helpref{wxDC::Blit}{wxdcblit}, | |
28 | \helpref{wxIcon}{wxicon}, \helpref{wxCursor}{wxcursor}, \helpref{wxBitmap}{wxbitmap}, | |
2fd284a4 | 29 | \helpref{wxMemoryDC}{wxmemorydc} |
a660d684 KB |
30 | |
31 | \latexignore{\rtfignore{\wxheading{Members}}} | |
32 | ||
f510b7b2 | 33 | \membersection{wxBitmap::wxBitmap}\label{wxbitmapctor} |
a660d684 KB |
34 | |
35 | \func{}{wxBitmap}{\void} | |
36 | ||
37 | Default constructor. | |
38 | ||
39 | \func{}{wxBitmap}{\param{const wxBitmap\& }{bitmap}} | |
40 | ||
a91225b2 RR |
41 | Copy constructor, uses \helpref{reference counting}{trefcount}. |
42 | To make a real copy, you can use: | |
2faa8e74 JS |
43 | |
44 | \begin{verbatim} | |
45 | wxBitmap newBitmap = oldBitmap.GetSubBitmap( | |
46 | wxRect(0, 0, oldBitmap.GetWidth(), oldBitmap.GetHeight())); | |
47 | \end{verbatim} | |
a660d684 | 48 | |
452418c4 | 49 | \func{}{wxBitmap}{\param{const void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 | 50 | |
0765adca VZ |
51 | Creates a bitmap from the given data which is interpreted in platform-dependent |
52 | manner. | |
a660d684 | 53 | |
eaaa6a06 JS |
54 | \func{}{wxBitmap}{\param{const char}{ bits[]}, \param{int}{ width}, \param{int}{ height}\\ |
55 | \param{int}{ depth = 1}} | |
a660d684 | 56 | |
dfa13ec8 | 57 | Creates a bitmap from an array of bits. |
2259e007 | 58 | |
0765adca VZ |
59 | You should only use this function for monochrome bitmaps ({\it depth} 1) in |
60 | portable programs: in this case the {\it bits} parameter should contain an XBM | |
61 | image. | |
62 | ||
63 | For other bit depths, the behaviour is platform dependent: under Windows, the | |
f6bcfd97 | 64 | data is passed without any changes to the underlying {\tt CreateBitmap()} API. |
0765adca VZ |
65 | Under other platforms, only monochrome bitmaps may be created using this |
66 | constructor and \helpref{wxImage}{wximage} should be used for creating colour | |
67 | bitmaps from static data. | |
a660d684 | 68 | |
eaaa6a06 | 69 | \func{}{wxBitmap}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 | 70 | |
0765adca VZ |
71 | Creates a new bitmap. A depth of -1 indicates the depth of the current screen |
72 | or visual. Some platforms only support 1 for monochrome and -1 for the current | |
388413fc | 73 | colour setting. Beginning with version 2.5.4 of wxWidgets a depth of 32 including |
0ff2a74d | 74 | an alpha channel is supported under MSW, Mac and GTK+. |
a660d684 | 75 | |
452418c4 | 76 | \func{}{wxBitmap}{\param{const char* const*}{ bits}} |
a660d684 KB |
77 | |
78 | Creates a bitmap from XPM data. | |
79 | ||
eaaa6a06 | 80 | \func{}{wxBitmap}{\param{const wxString\& }{name}, \param{long}{ type}} |
a660d684 KB |
81 | |
82 | Loads a bitmap from a file or resource. | |
83 | ||
b06a6b20 VS |
84 | \func{}{wxBitmap}{\param{const wxImage\&}{ img}, \param{int}{ depth = -1}} |
85 | ||
86 | Creates bitmap object from the image. This has to be done | |
87 | to actually display an image as you cannot draw an image directly on a window. | |
a7c7c154 RD |
88 | The resulting bitmap will use the provided colour depth (or that of the |
89 | current system if depth is -1) which entails that a colour reduction has | |
b06a6b20 VS |
90 | to take place. |
91 | ||
a7c7c154 | 92 | When in 8-bit mode (PseudoColour mode), the GTK port will use a color cube created |
b06a6b20 VS |
93 | on program start-up to look up colors. This ensures a very fast conversion, but |
94 | the image quality won't be perfect (and could be better for photo images using more | |
95 | sophisticated dithering algorithms). | |
96 | ||
97 | On Windows, if there is a palette present (set with SetPalette), it will be used when | |
98 | creating the wxBitmap (most useful in 8-bit display mode). On other platforms, | |
99 | the palette is currently ignored. | |
100 | ||
a660d684 KB |
101 | \wxheading{Parameters} |
102 | ||
103 | \docparam{bits}{Specifies an array of pixel values.} | |
104 | ||
105 | \docparam{width}{Specifies the width of the bitmap.} | |
106 | ||
107 | \docparam{height}{Specifies the height of the bitmap.} | |
108 | ||
109 | \docparam{depth}{Specifies the depth of the bitmap. If this is omitted, the display depth of the | |
110 | screen is used.} | |
111 | ||
112 | \docparam{name}{This can refer to a resource name under MS Windows, or a filename under MS Windows and X. | |
1e6d9499 | 113 | Its meaning is determined by the {\it type} parameter.} |
a660d684 KB |
114 | |
115 | \docparam{type}{May be one of the following: | |
116 | ||
117 | \twocolwidtha{5cm} | |
118 | \begin{twocollist} | |
f690fb04 | 119 | \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.} |
2a138829 JS |
120 | \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP\_RESOURCE}}{Load a Windows bitmap resource from the executable. Windows only.} |
121 | \twocolitem{\indexit{wxBITMAP\_TYPE\_PICT\_RESOURCE}}{Load a PICT image resource from the executable. Mac OS only.} | |
f690fb04 GT |
122 | \twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.} |
123 | \twocolitem{\indexit{wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.} | |
124 | \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load an XPM bitmap file.} | |
a660d684 KB |
125 | \end{twocollist} |
126 | ||
fc2171bd JS |
127 | The validity of these flags depends on the platform and wxWidgets configuration. |
128 | If all possible wxWidgets settings are used, the Windows platform supports BMP file, BMP resource, | |
2fd284a4 | 129 | XPM data, and XPM. Under wxGTK, the available formats are BMP file, XPM data, XPM file, and PNG file. |
b75dd496 VS |
130 | Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM file. |
131 | ||
a7c7c154 RD |
132 | In addition, wxBitmap can read all formats that \helpref{wxImage}{wximage} can, which currently include |
133 | wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_TIF, wxBITMAP\_TYPE\_PNG, wxBITMAP\_TYPE\_GIF, wxBITMAP\_TYPE\_PCX, | |
f9ee644e | 134 | and wxBITMAP\_TYPE\_PNM. Of course, you must have wxImage handlers loaded. } |
a660d684 | 135 | |
b06a6b20 VS |
136 | \docparam{img}{Platform-independent wxImage object.} |
137 | ||
a660d684 KB |
138 | \wxheading{Remarks} |
139 | ||
140 | The first form constructs a bitmap object with no data; an assignment or another member function such as Create | |
141 | or LoadFile must be called subsequently. | |
142 | ||
143 | The second and third forms provide copy constructors. Note that these do not copy the | |
144 | bitmap data, but instead a pointer to the data, keeping a reference count. They are therefore | |
145 | very efficient operations. | |
146 | ||
147 | The fourth form constructs a bitmap from data whose type and value depends on | |
148 | the value of the {\it type} argument. | |
149 | ||
150 | The fifth form constructs a (usually monochrome) bitmap from an array of pixel values, under both | |
151 | X and Windows. | |
152 | ||
153 | The sixth form constructs a new bitmap. | |
154 | ||
fc2171bd | 155 | The seventh form constructs a bitmap from pixmap (XPM) data, if wxWidgets has been configured |
a660d684 KB |
156 | to incorporate this feature. |
157 | ||
158 | To use this constructor, you must first include an XPM file. For | |
159 | example, assuming that the file {\tt mybitmap.xpm} contains an XPM array | |
160 | of character pointers called mybitmap: | |
161 | ||
162 | \begin{verbatim} | |
163 | #include "mybitmap.xpm" | |
164 | ||
165 | ... | |
166 | ||
167 | wxBitmap *bitmap = new wxBitmap(mybitmap); | |
168 | \end{verbatim} | |
169 | ||
170 | The eighth form constructs a bitmap from a file or resource. {\it name} can refer | |
171 | to a resource name under MS Windows, or a filename under MS Windows and X. | |
172 | ||
173 | Under Windows, {\it type} defaults to wxBITMAP\_TYPE\_BMP\_RESOURCE. | |
2fd284a4 | 174 | Under X, {\it type} defaults to wxBITMAP\_TYPE\_XPM. |
a660d684 KB |
175 | |
176 | \wxheading{See also} | |
177 | ||
178 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
179 | ||
06d20283 RD |
180 | \pythonnote{Constructors supported by wxPython are:\par |
181 | \indented{2cm}{\begin{twocollist} | |
c9110876 | 182 | \twocolitem{{\bf wxBitmap(name, flag)}}{Loads a bitmap from a file} |
c9110876 | 183 | \twocolitem{{\bf wxEmptyBitmap(width, height, depth = -1)}}{Creates an |
06d20283 | 184 | empty bitmap with the given specifications} |
a7c7c154 RD |
185 | \twocolitem{{\bf wxBitmapFromXPMData(listOfStrings)}}{Create a bitmap |
186 | from a Python list of strings whose contents are XPM data.} | |
187 | \twocolitem{{\bf wxBitmapFromBits(bits, width, height, | |
188 | depth=-1)}}{Create a bitmap from an array of bits contained in a | |
189 | string.} | |
190 | \twocolitem{{\bf wxBitmapFromImage(image, depth=-1)}}{Convert a | |
191 | wxImage to a wxBitmap.} | |
06d20283 RD |
192 | \end{twocollist}} |
193 | } | |
194 | ||
5873607e VZ |
195 | \perlnote{Constructors supported by wxPerl are:\par |
196 | \begin{itemize} | |
197 | \item{Wx::Bitmap->new( width, height, depth = -1 )} | |
198 | \item{Wx::Bitmap->new( name, type )} | |
199 | \item{Wx::Bitmap->new( icon )} | |
d3f3e857 MB |
200 | \item{Wx::Bitmap->newFromBits( bits, width, height, depth = 1 )} |
201 | \item{Wx::Bitmap->newFromXPM( data )} | |
5873607e VZ |
202 | \end{itemize} |
203 | } | |
204 | ||
f510b7b2 | 205 | \membersection{wxBitmap::\destruct{wxBitmap}}\label{wxbitmapdtor} |
a660d684 KB |
206 | |
207 | \func{}{\destruct{wxBitmap}}{\void} | |
208 | ||
55ccdb93 VZ |
209 | Destructor. |
210 | See \helpref{reference-counted object destruction}{refcountdestruct} for more info. | |
a660d684 KB |
211 | |
212 | If the application omits to delete the bitmap explicitly, the bitmap will be | |
fc2171bd | 213 | destroyed automatically by wxWidgets when the application exits. |
a660d684 KB |
214 | |
215 | Do not delete a bitmap that is selected into a memory device context. | |
216 | ||
217 | \membersection{wxBitmap::AddHandler}\label{wxbitmapaddhandler} | |
218 | ||
219 | \func{static void}{AddHandler}{\param{wxBitmapHandler*}{ handler}} | |
220 | ||
221 | Adds a handler to the end of the static list of format handlers. | |
222 | ||
223 | \docparam{handler}{A new bitmap format handler object. There is usually only one instance | |
224 | of a given handler class in an application session.} | |
225 | ||
226 | \wxheading{See also} | |
227 | ||
228 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
229 | ||
f510b7b2 | 230 | \membersection{wxBitmap::CleanUpHandlers}\label{wxbitmapcleanuphandlers} |
a660d684 KB |
231 | |
232 | \func{static void}{CleanUpHandlers}{\void} | |
233 | ||
234 | Deletes all bitmap handlers. | |
235 | ||
fc2171bd | 236 | This function is called by wxWidgets on exit. |
a660d684 | 237 | |
b06a6b20 VS |
238 | \membersection{wxBitmap::ConvertToImage}\label{wxbitmapconverttoimage} |
239 | ||
240 | \func{wxImage}{ConvertToImage}{\void} | |
241 | ||
242 | Creates an image from a platform-dependent bitmap. This preserves | |
243 | mask information so that bitmaps and images can be converted back | |
244 | and forth without loss in that respect. | |
245 | ||
2f930c85 JS |
246 | \membersection{wxBitmap::CopyFromIcon}\label{wxbitmapcopyfromicon} |
247 | ||
248 | \func{bool}{CopyFromIcon}{\param{const wxIcon\&}{ icon}} | |
249 | ||
250 | Creates the bitmap from an icon. | |
251 | ||
c0bcc480 | 252 | \membersection{wxBitmap::Create}\label{wxbitmapcreate} |
a660d684 | 253 | |
eaaa6a06 | 254 | \func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
255 | |
256 | Creates a fresh bitmap. If the final argument is omitted, the display depth of | |
257 | the screen is used. | |
258 | ||
452418c4 | 259 | \func{virtual bool}{Create}{\param{const void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
260 | |
261 | Creates a bitmap from the given data, which can be of arbitrary type. | |
262 | ||
263 | \wxheading{Parameters} | |
264 | ||
265 | \docparam{width}{The width of the bitmap in pixels.} | |
266 | ||
267 | \docparam{height}{The height of the bitmap in pixels.} | |
268 | ||
269 | \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.} | |
270 | ||
271 | \docparam{data}{Data whose type depends on the value of {\it type}.} | |
272 | ||
f510b7b2 | 273 | \docparam{type}{A bitmap type identifier - see \helpref{wxBitmap::wxBitmap}{wxbitmapctor} for a list |
a660d684 KB |
274 | of possible values.} |
275 | ||
276 | \wxheading{Return value} | |
277 | ||
cc81d32f | 278 | true if the call succeeded, false otherwise. |
a660d684 KB |
279 | |
280 | \wxheading{Remarks} | |
281 | ||
282 | The first form works on all platforms. The portability of the second form depends on the | |
283 | type of data. | |
284 | ||
285 | \wxheading{See also} | |
286 | ||
f510b7b2 | 287 | \helpref{wxBitmap::wxBitmap}{wxbitmapctor} |
a660d684 | 288 | |
f510b7b2 | 289 | \membersection{wxBitmap::FindHandler}\label{wxbitmapfindhandler} |
a660d684 KB |
290 | |
291 | \func{static wxBitmapHandler*}{FindHandler}{\param{const wxString\& }{name}} | |
292 | ||
293 | Finds the handler with the given name. | |
294 | ||
0f353563 | 295 | \func{static wxBitmapHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{wxBitmapType}{ bitmapType}} |
a660d684 KB |
296 | |
297 | Finds the handler associated with the given extension and type. | |
298 | ||
0f353563 | 299 | \func{static wxBitmapHandler*}{FindHandler}{\param{wxBitmapType }{bitmapType}} |
a660d684 KB |
300 | |
301 | Finds the handler associated with the given bitmap type. | |
302 | ||
303 | \docparam{name}{The handler name.} | |
304 | ||
305 | \docparam{extension}{The file extension, such as ``bmp".} | |
306 | ||
307 | \docparam{bitmapType}{The bitmap type, such as wxBITMAP\_TYPE\_BMP.} | |
308 | ||
309 | \wxheading{Return value} | |
310 | ||
311 | A pointer to the handler if found, NULL otherwise. | |
312 | ||
313 | \wxheading{See also} | |
314 | ||
315 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
316 | ||
f510b7b2 | 317 | \membersection{wxBitmap::GetDepth}\label{wxbitmapgetdepth} |
a660d684 KB |
318 | |
319 | \constfunc{int}{GetDepth}{\void} | |
320 | ||
321 | Gets the colour depth of the bitmap. A value of 1 indicates a | |
322 | monochrome bitmap. | |
323 | ||
f510b7b2 | 324 | \membersection{wxBitmap::GetHandlers}\label{wxbitmapgethandlers} |
a660d684 KB |
325 | |
326 | \func{static wxList\&}{GetHandlers}{\void} | |
327 | ||
328 | Returns the static list of bitmap format handlers. | |
329 | ||
330 | \wxheading{See also} | |
331 | ||
332 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
333 | ||
334 | \membersection{wxBitmap::GetHeight}\label{wxbitmapgetheight} | |
335 | ||
336 | \constfunc{int}{GetHeight}{\void} | |
337 | ||
338 | Gets the height of the bitmap in pixels. | |
339 | ||
340 | \membersection{wxBitmap::GetPalette}\label{wxbitmapgetpalette} | |
341 | ||
342 | \constfunc{wxPalette*}{GetPalette}{\void} | |
343 | ||
344 | Gets the associated palette (if any) which may have been loaded from a file | |
345 | or set for the bitmap. | |
346 | ||
347 | \wxheading{See also} | |
348 | ||
349 | \helpref{wxPalette}{wxpalette} | |
350 | ||
351 | \membersection{wxBitmap::GetMask}\label{wxbitmapgetmask} | |
352 | ||
353 | \constfunc{wxMask*}{GetMask}{\void} | |
354 | ||
1e6d9499 | 355 | Gets the associated mask (if any) which may have been loaded from a file |
a660d684 KB |
356 | or set for the bitmap. |
357 | ||
358 | \wxheading{See also} | |
359 | ||
360 | \helpref{wxBitmap::SetMask}{wxbitmapsetmask}, \helpref{wxMask}{wxmask} | |
361 | ||
362 | \membersection{wxBitmap::GetWidth}\label{wxbitmapgetwidth} | |
363 | ||
364 | \constfunc{int}{GetWidth}{\void} | |
365 | ||
366 | Gets the width of the bitmap in pixels. | |
367 | ||
368 | \wxheading{See also} | |
369 | ||
370 | \helpref{wxBitmap::GetHeight}{wxbitmapgetheight} | |
371 | ||
f9ee644e RR |
372 | \membersection{wxBitmap::GetSubBitmap}\label{wxbitmapgetsubbitmap} |
373 | ||
d17f05af | 374 | \constfunc{wxBitmap}{GetSubBitmap}{\param{const wxRect\&}{rect}} |
f9ee644e | 375 | |
a7c7c154 | 376 | Returns a sub bitmap of the current one as long as the rect belongs entirely to |
f9ee644e RR |
377 | the bitmap. This function preserves bit depth and mask information. |
378 | ||
f510b7b2 | 379 | \membersection{wxBitmap::InitStandardHandlers}\label{wxbitmapinitstandardhandlers} |
a660d684 KB |
380 | |
381 | \func{static void}{InitStandardHandlers}{\void} | |
382 | ||
fc2171bd | 383 | Adds the standard bitmap format handlers, which, depending on wxWidgets |
a660d684 KB |
384 | configuration, can be handlers for Windows bitmap, Windows bitmap resource, and XPM. |
385 | ||
fc2171bd | 386 | This function is called by wxWidgets on startup. |
a660d684 KB |
387 | |
388 | \wxheading{See also} | |
389 | ||
390 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
391 | ||
f510b7b2 | 392 | \membersection{wxBitmap::InsertHandler}\label{wxbitmapinserthandler} |
a660d684 KB |
393 | |
394 | \func{static void}{InsertHandler}{\param{wxBitmapHandler*}{ handler}} | |
395 | ||
396 | Adds a handler at the start of the static list of format handlers. | |
397 | ||
398 | \docparam{handler}{A new bitmap format handler object. There is usually only one instance | |
399 | of a given handler class in an application session.} | |
400 | ||
401 | \wxheading{See also} | |
402 | ||
403 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
404 | ||
405 | \membersection{wxBitmap::LoadFile}\label{wxbitmaploadfile} | |
406 | ||
0f353563 | 407 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{wxBitmapType}{ type}} |
a660d684 KB |
408 | |
409 | Loads a bitmap from a file or resource. | |
410 | ||
411 | \wxheading{Parameters} | |
412 | ||
413 | \docparam{name}{Either a filename or a Windows resource name. | |
414 | The meaning of {\it name} is determined by the {\it type} parameter.} | |
415 | ||
416 | \docparam{type}{One of the following values: | |
417 | ||
418 | \twocolwidtha{5cm} | |
419 | \begin{twocollist} | |
420 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.} | |
2a138829 JS |
421 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP\_RESOURCE}}{Load a Windows bitmap resource from the executable.} |
422 | \twocolitem{{\bf wxBITMAP\_TYPE\_PICT\_RESOURCE}}{Load a PICT image resource from the executable. Mac OS only.} | |
a660d684 KB |
423 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.} |
424 | \twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.} | |
425 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load an XPM bitmap file.} | |
426 | \end{twocollist} | |
427 | ||
fc2171bd | 428 | The validity of these flags depends on the platform and wxWidgets configuration. |
b75dd496 | 429 | |
a7c7c154 | 430 | In addition, wxBitmap can read all formats that \helpref{wxImage}{wximage} can |
b75dd496 VS |
431 | (wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_PNG, wxBITMAP\_TYPE\_GIF, wxBITMAP\_TYPE\_PCX, wxBITMAP\_TYPE\_PNM). |
432 | (Of course you must have wxImage handlers loaded.) } | |
a660d684 KB |
433 | |
434 | \wxheading{Return value} | |
435 | ||
cc81d32f | 436 | true if the operation succeeded, false otherwise. |
a660d684 KB |
437 | |
438 | \wxheading{Remarks} | |
439 | ||
440 | A palette may be associated with the bitmap if one exists (especially for | |
441 | colour Windows bitmaps), and if the code supports it. You can check | |
442 | if one has been created by using the \helpref{GetPalette}{wxbitmapgetpalette} member. | |
443 | ||
444 | \wxheading{See also} | |
445 | ||
446 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile} | |
447 | ||
b7cacb43 | 448 | \membersection{wxBitmap::IsOk}\label{wxbitmapisok} |
a660d684 | 449 | |
b7cacb43 | 450 | \constfunc{bool}{IsOk}{\void} |
a660d684 | 451 | |
cc81d32f | 452 | Returns true if bitmap data is present. |
a660d684 | 453 | |
f510b7b2 | 454 | \membersection{wxBitmap::RemoveHandler}\label{wxbitmapremovehandler} |
a660d684 KB |
455 | |
456 | \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}} | |
457 | ||
458 | Finds the handler with the given name, and removes it. The handler | |
459 | is not deleted. | |
460 | ||
461 | \docparam{name}{The handler name.} | |
462 | ||
463 | \wxheading{Return value} | |
464 | ||
cc81d32f | 465 | true if the handler was found and removed, false otherwise. |
a660d684 KB |
466 | |
467 | \wxheading{See also} | |
468 | ||
469 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
470 | ||
471 | \membersection{wxBitmap::SaveFile}\label{wxbitmapsavefile} | |
472 | ||
0f353563 | 473 | \func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{wxBitmapType}{ type}, \param{wxPalette* }{palette = NULL}} |
a660d684 KB |
474 | |
475 | Saves a bitmap in the named file. | |
476 | ||
477 | \wxheading{Parameters} | |
478 | ||
479 | \docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.} | |
480 | ||
481 | \docparam{type}{One of the following values: | |
482 | ||
483 | \twocolwidtha{5cm} | |
484 | \begin{twocollist} | |
485 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a Windows bitmap file.} | |
486 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Save a GIF bitmap file.} | |
487 | \twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Save an X bitmap file.} | |
488 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save an XPM bitmap file.} | |
489 | \end{twocollist} | |
490 | ||
fc2171bd | 491 | The validity of these flags depends on the platform and wxWidgets configuration. |
b75dd496 | 492 | |
a7c7c154 | 493 | In addition, wxBitmap can save all formats that \helpref{wxImage}{wximage} can |
b75dd496 VS |
494 | (wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_PNG). |
495 | (Of course you must have wxImage handlers loaded.) } | |
a660d684 | 496 | |
5b6aa0ff JS |
497 | \docparam{palette}{An optional palette used for saving the bitmap.} |
498 | % TODO: this parameter should | |
499 | %probably be eliminated; instead the app should set the palette before saving. | |
a660d684 KB |
500 | |
501 | \wxheading{Return value} | |
502 | ||
cc81d32f | 503 | true if the operation succeeded, false otherwise. |
a660d684 KB |
504 | |
505 | \wxheading{Remarks} | |
506 | ||
fc2171bd | 507 | Depending on how wxWidgets has been configured, not all formats may be available. |
a660d684 KB |
508 | |
509 | \wxheading{See also} | |
510 | ||
511 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
512 | ||
513 | \membersection{wxBitmap::SetDepth}\label{wxbitmapsetdepth} | |
514 | ||
515 | \func{void}{SetDepth}{\param{int }{depth}} | |
516 | ||
517 | Sets the depth member (does not affect the bitmap data). | |
518 | ||
519 | \wxheading{Parameters} | |
520 | ||
521 | \docparam{depth}{Bitmap depth.} | |
522 | ||
523 | \membersection{wxBitmap::SetHeight}\label{wxbitmapsetheight} | |
524 | ||
525 | \func{void}{SetHeight}{\param{int }{height}} | |
526 | ||
527 | Sets the height member (does not affect the bitmap data). | |
528 | ||
529 | \wxheading{Parameters} | |
530 | ||
531 | \docparam{height}{Bitmap height in pixels.} | |
532 | ||
533 | \membersection{wxBitmap::SetMask}\label{wxbitmapsetmask} | |
534 | ||
535 | \func{void}{SetMask}{\param{wxMask* }{mask}} | |
536 | ||
537 | Sets the mask for this bitmap. | |
538 | ||
539 | \wxheading{Remarks} | |
540 | ||
541 | The bitmap object owns the mask once this has been called. | |
542 | ||
543 | \wxheading{See also} | |
544 | ||
545 | \helpref{wxBitmap::GetMask}{wxbitmapgetmask}, \helpref{wxMask}{wxmask} | |
546 | ||
695e43fa | 547 | %% VZ: this function is an implementation detail and shouldn't be documented |
f510b7b2 | 548 | %%\membersection{wxBitmap::SetOk}\label{wxbitmapsetok} |
695e43fa VZ |
549 | %% |
550 | %%\func{void}{SetOk}{\param{int }{isOk}} | |
551 | %% | |
552 | %%Sets the validity member (does not affect the bitmap data). | |
553 | %% | |
554 | %%\wxheading{Parameters} | |
555 | %% | |
556 | %%\docparam{isOk}{Validity flag.} | |
a660d684 KB |
557 | |
558 | \membersection{wxBitmap::SetPalette}\label{wxbitmapsetpalette} | |
559 | ||
f6bcfd97 | 560 | \func{void}{SetPalette}{\param{const wxPalette\& }{palette}} |
a660d684 | 561 | |
c8e1af67 | 562 | Sets the associated palette. (Not implemented under GTK+). |
a660d684 KB |
563 | |
564 | \wxheading{Parameters} | |
565 | ||
566 | \docparam{palette}{The palette to set.} | |
567 | ||
a660d684 KB |
568 | \wxheading{See also} |
569 | ||
570 | \helpref{wxPalette}{wxpalette} | |
571 | ||
f510b7b2 | 572 | \membersection{wxBitmap::SetWidth}\label{wxbitmapsetwidth} |
a660d684 KB |
573 | |
574 | \func{void}{SetWidth}{\param{int }{width}} | |
575 | ||
576 | Sets the width member (does not affect the bitmap data). | |
577 | ||
578 | \wxheading{Parameters} | |
579 | ||
580 | \docparam{width}{Bitmap width in pixels.} | |
581 | ||
f510b7b2 | 582 | \membersection{wxBitmap::operator $=$}\label{wxbitmapassign} |
a660d684 KB |
583 | |
584 | \func{wxBitmap\& }{operator $=$}{\param{const wxBitmap\& }{bitmap}} | |
585 | ||
a91225b2 | 586 | Assignment operator, using \helpref{reference counting}{trefcount}. |
a660d684 KB |
587 | |
588 | \wxheading{Parameters} | |
589 | ||
590 | \docparam{bitmap}{Bitmap to assign.} | |
591 | ||
592 | \wxheading{Return value} | |
593 | ||
594 | Returns 'this' object. | |
595 | ||
a660d684 | 596 |