]>
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, | |
6 | either monochrome or colour. | |
7 | ||
8 | \wxheading{Derived from} | |
9 | ||
10 | \helpref{wxGDIObject}{wxgdiobject}\\ | |
11 | \helpref{wxObject}{wxobject} | |
12 | ||
954b8ae6 JS |
13 | \wxheading{Include files} |
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 | ||
33 | \membersection{wxBitmap::wxBitmap}\label{wxbitmapconstr} | |
34 | ||
35 | \func{}{wxBitmap}{\void} | |
36 | ||
37 | Default constructor. | |
38 | ||
39 | \func{}{wxBitmap}{\param{const wxBitmap\& }{bitmap}} | |
40 | ||
1e6d9499 | 41 | Copy constructor. |
a660d684 | 42 | |
eaaa6a06 | 43 | \func{}{wxBitmap}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
44 | |
45 | Creates a bitmap from the given data, which can be of arbitrary type. | |
2259e007 | 46 | Windows only, I think. |
a660d684 | 47 | |
eaaa6a06 JS |
48 | \func{}{wxBitmap}{\param{const char}{ bits[]}, \param{int}{ width}, \param{int}{ height}\\ |
49 | \param{int}{ depth = 1}} | |
a660d684 | 50 | |
dfa13ec8 | 51 | Creates a bitmap from an array of bits. |
2259e007 | 52 | |
dfa13ec8 | 53 | Note that the bit depth is ignored on GTK+ and Motif. If you want to create a bitmap |
2259e007 | 54 | from something else than a 1-bit data array, use the \helpref{wxImage}{wximage} class. |
a660d684 | 55 | |
eaaa6a06 | 56 | \func{}{wxBitmap}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 | 57 | |
2259e007 RR |
58 | Creates a new bitmap. A depth of -1 indicates the depth of the current screen or |
59 | visual. Some platforms only support 1 for monochrome and -1 for the current colour | |
60 | setting. | |
a660d684 KB |
61 | |
62 | \func{}{wxBitmap}{\param{const char**}{ bits}} | |
63 | ||
64 | Creates a bitmap from XPM data. | |
65 | ||
eaaa6a06 | 66 | \func{}{wxBitmap}{\param{const wxString\& }{name}, \param{long}{ type}} |
a660d684 KB |
67 | |
68 | Loads a bitmap from a file or resource. | |
69 | ||
70 | \wxheading{Parameters} | |
71 | ||
72 | \docparam{bits}{Specifies an array of pixel values.} | |
73 | ||
74 | \docparam{width}{Specifies the width of the bitmap.} | |
75 | ||
76 | \docparam{height}{Specifies the height of the bitmap.} | |
77 | ||
78 | \docparam{depth}{Specifies the depth of the bitmap. If this is omitted, the display depth of the | |
79 | screen is used.} | |
80 | ||
81 | \docparam{name}{This can refer to a resource name under MS Windows, or a filename under MS Windows and X. | |
1e6d9499 | 82 | Its meaning is determined by the {\it type} parameter.} |
a660d684 KB |
83 | |
84 | \docparam{type}{May be one of the following: | |
85 | ||
86 | \twocolwidtha{5cm} | |
87 | \begin{twocollist} | |
88 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_BMP}}}{Load a Windows bitmap file.} | |
89 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_BMP\_RESOURCE}}}{Load a Windows bitmap from the resource database.} | |
90 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_GIF}}}{Load a GIF bitmap file.} | |
91 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_XBM}}}{Load an X bitmap file.} | |
92 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_XPM}}}{Load an XPM bitmap file.} | |
93 | \twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_RESOURCE}}}{Load a Windows resource name.} | |
94 | \end{twocollist} | |
95 | ||
96 | The validity of these flags depends on the platform and wxWindows configuration. | |
2fd284a4 JS |
97 | If all possible wxWindows settings are used, the Windows platform supports BMP file, BMP resource, |
98 | XPM data, and XPM. Under wxGTK, the available formats are BMP file, XPM data, XPM file, and PNG file. | |
99 | Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM file.} | |
a660d684 KB |
100 | |
101 | \wxheading{Remarks} | |
102 | ||
103 | The first form constructs a bitmap object with no data; an assignment or another member function such as Create | |
104 | or LoadFile must be called subsequently. | |
105 | ||
106 | The second and third forms provide copy constructors. Note that these do not copy the | |
107 | bitmap data, but instead a pointer to the data, keeping a reference count. They are therefore | |
108 | very efficient operations. | |
109 | ||
110 | The fourth form constructs a bitmap from data whose type and value depends on | |
111 | the value of the {\it type} argument. | |
112 | ||
113 | The fifth form constructs a (usually monochrome) bitmap from an array of pixel values, under both | |
114 | X and Windows. | |
115 | ||
116 | The sixth form constructs a new bitmap. | |
117 | ||
118 | The seventh form constructs a bitmap from pixmap (XPM) data, if wxWindows has been configured | |
119 | to incorporate this feature. | |
120 | ||
121 | To use this constructor, you must first include an XPM file. For | |
122 | example, assuming that the file {\tt mybitmap.xpm} contains an XPM array | |
123 | of character pointers called mybitmap: | |
124 | ||
125 | \begin{verbatim} | |
126 | #include "mybitmap.xpm" | |
127 | ||
128 | ... | |
129 | ||
130 | wxBitmap *bitmap = new wxBitmap(mybitmap); | |
131 | \end{verbatim} | |
132 | ||
133 | The eighth form constructs a bitmap from a file or resource. {\it name} can refer | |
134 | to a resource name under MS Windows, or a filename under MS Windows and X. | |
135 | ||
136 | Under Windows, {\it type} defaults to wxBITMAP\_TYPE\_BMP\_RESOURCE. | |
2fd284a4 | 137 | Under X, {\it type} defaults to wxBITMAP\_TYPE\_XPM. |
a660d684 KB |
138 | |
139 | \wxheading{See also} | |
140 | ||
141 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
142 | ||
06d20283 RD |
143 | \pythonnote{Constructors supported by wxPython are:\par |
144 | \indented{2cm}{\begin{twocollist} | |
145 | \twocolitem{\bf{wxBitmap(name, flag)}}{Loads a bitmap from a file} | |
dfa13ec8 RD |
146 | \twocolitem{\bf{wxBitmap(data, type, width, height, depth=1)}}{Creates |
147 | a bitmap from the given data, which can be of arbitrary type.} | |
06d20283 RD |
148 | \twocolitem{\bf{wxNoRefBitmap(name, flag)}}{This one won't own the |
149 | reference, so Python won't call the destructor, this is good for toolbars | |
150 | and such where the parent will manage the bitmap.} | |
f899db6d | 151 | \twocolitem{\bf{wxEmptyBitmap(width, height, depth = -1)}}{Creates an |
06d20283 RD |
152 | empty bitmap with the given specifications} |
153 | \end{twocollist}} | |
154 | } | |
155 | ||
a660d684 KB |
156 | \membersection{wxBitmap::\destruct{wxBitmap}} |
157 | ||
158 | \func{}{\destruct{wxBitmap}}{\void} | |
159 | ||
160 | Destroys the wxBitmap object and possibly the underlying bitmap data. | |
161 | Because reference counting is used, the bitmap may not actually be | |
162 | destroyed at this point - only when the reference count is zero will the | |
163 | data be deleted. | |
164 | ||
165 | If the application omits to delete the bitmap explicitly, the bitmap will be | |
166 | destroyed automatically by wxWindows when the application exits. | |
167 | ||
168 | Do not delete a bitmap that is selected into a memory device context. | |
169 | ||
170 | \membersection{wxBitmap::AddHandler}\label{wxbitmapaddhandler} | |
171 | ||
172 | \func{static void}{AddHandler}{\param{wxBitmapHandler*}{ handler}} | |
173 | ||
174 | Adds a handler to the end of the static list of format handlers. | |
175 | ||
176 | \docparam{handler}{A new bitmap format handler object. There is usually only one instance | |
177 | of a given handler class in an application session.} | |
178 | ||
179 | \wxheading{See also} | |
180 | ||
181 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
182 | ||
183 | \membersection{wxBitmap::CleanUpHandlers} | |
184 | ||
185 | \func{static void}{CleanUpHandlers}{\void} | |
186 | ||
187 | Deletes all bitmap handlers. | |
188 | ||
189 | This function is called by wxWindows on exit. | |
190 | ||
191 | \membersection{wxBitmap::Create} | |
192 | ||
eaaa6a06 | 193 | \func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
194 | |
195 | Creates a fresh bitmap. If the final argument is omitted, the display depth of | |
196 | the screen is used. | |
197 | ||
eaaa6a06 | 198 | \func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
199 | |
200 | Creates a bitmap from the given data, which can be of arbitrary type. | |
201 | ||
202 | \wxheading{Parameters} | |
203 | ||
204 | \docparam{width}{The width of the bitmap in pixels.} | |
205 | ||
206 | \docparam{height}{The height of the bitmap in pixels.} | |
207 | ||
208 | \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.} | |
209 | ||
210 | \docparam{data}{Data whose type depends on the value of {\it type}.} | |
211 | ||
212 | \docparam{type}{A bitmap type identifier - see \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for a list | |
213 | of possible values.} | |
214 | ||
215 | \wxheading{Return value} | |
216 | ||
217 | TRUE if the call succeeded, FALSE otherwise. | |
218 | ||
219 | \wxheading{Remarks} | |
220 | ||
221 | The first form works on all platforms. The portability of the second form depends on the | |
222 | type of data. | |
223 | ||
224 | \wxheading{See also} | |
225 | ||
226 | \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} | |
227 | ||
228 | \membersection{wxBitmap::FindHandler} | |
229 | ||
230 | \func{static wxBitmapHandler*}{FindHandler}{\param{const wxString\& }{name}} | |
231 | ||
232 | Finds the handler with the given name. | |
233 | ||
234 | \func{static wxBitmapHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ bitmapType}} | |
235 | ||
236 | Finds the handler associated with the given extension and type. | |
237 | ||
238 | \func{static wxBitmapHandler*}{FindHandler}{\param{long }{bitmapType}} | |
239 | ||
240 | Finds the handler associated with the given bitmap type. | |
241 | ||
242 | \docparam{name}{The handler name.} | |
243 | ||
244 | \docparam{extension}{The file extension, such as ``bmp".} | |
245 | ||
246 | \docparam{bitmapType}{The bitmap type, such as wxBITMAP\_TYPE\_BMP.} | |
247 | ||
248 | \wxheading{Return value} | |
249 | ||
250 | A pointer to the handler if found, NULL otherwise. | |
251 | ||
252 | \wxheading{See also} | |
253 | ||
254 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
255 | ||
256 | \membersection{wxBitmap::GetDepth} | |
257 | ||
258 | \constfunc{int}{GetDepth}{\void} | |
259 | ||
260 | Gets the colour depth of the bitmap. A value of 1 indicates a | |
261 | monochrome bitmap. | |
262 | ||
263 | \membersection{wxBitmap::GetHandlers} | |
264 | ||
265 | \func{static wxList\&}{GetHandlers}{\void} | |
266 | ||
267 | Returns the static list of bitmap format handlers. | |
268 | ||
269 | \wxheading{See also} | |
270 | ||
271 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
272 | ||
273 | \membersection{wxBitmap::GetHeight}\label{wxbitmapgetheight} | |
274 | ||
275 | \constfunc{int}{GetHeight}{\void} | |
276 | ||
277 | Gets the height of the bitmap in pixels. | |
278 | ||
279 | \membersection{wxBitmap::GetPalette}\label{wxbitmapgetpalette} | |
280 | ||
281 | \constfunc{wxPalette*}{GetPalette}{\void} | |
282 | ||
283 | Gets the associated palette (if any) which may have been loaded from a file | |
284 | or set for the bitmap. | |
285 | ||
286 | \wxheading{See also} | |
287 | ||
288 | \helpref{wxPalette}{wxpalette} | |
289 | ||
290 | \membersection{wxBitmap::GetMask}\label{wxbitmapgetmask} | |
291 | ||
292 | \constfunc{wxMask*}{GetMask}{\void} | |
293 | ||
1e6d9499 | 294 | Gets the associated mask (if any) which may have been loaded from a file |
a660d684 KB |
295 | or set for the bitmap. |
296 | ||
297 | \wxheading{See also} | |
298 | ||
299 | \helpref{wxBitmap::SetMask}{wxbitmapsetmask}, \helpref{wxMask}{wxmask} | |
300 | ||
301 | \membersection{wxBitmap::GetWidth}\label{wxbitmapgetwidth} | |
302 | ||
303 | \constfunc{int}{GetWidth}{\void} | |
304 | ||
305 | Gets the width of the bitmap in pixels. | |
306 | ||
307 | \wxheading{See also} | |
308 | ||
309 | \helpref{wxBitmap::GetHeight}{wxbitmapgetheight} | |
310 | ||
311 | \membersection{wxBitmap::InitStandardHandlers} | |
312 | ||
313 | \func{static void}{InitStandardHandlers}{\void} | |
314 | ||
315 | Adds the standard bitmap format handlers, which, depending on wxWindows | |
316 | configuration, can be handlers for Windows bitmap, Windows bitmap resource, and XPM. | |
317 | ||
318 | This function is called by wxWindows on startup. | |
319 | ||
320 | \wxheading{See also} | |
321 | ||
322 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
323 | ||
324 | \membersection{wxBitmap::InsertHandler} | |
325 | ||
326 | \func{static void}{InsertHandler}{\param{wxBitmapHandler*}{ handler}} | |
327 | ||
328 | Adds a handler at the start of the static list of format handlers. | |
329 | ||
330 | \docparam{handler}{A new bitmap format handler object. There is usually only one instance | |
331 | of a given handler class in an application session.} | |
332 | ||
333 | \wxheading{See also} | |
334 | ||
335 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
336 | ||
337 | \membersection{wxBitmap::LoadFile}\label{wxbitmaploadfile} | |
338 | ||
eaaa6a06 | 339 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type}} |
a660d684 KB |
340 | |
341 | Loads a bitmap from a file or resource. | |
342 | ||
343 | \wxheading{Parameters} | |
344 | ||
345 | \docparam{name}{Either a filename or a Windows resource name. | |
346 | The meaning of {\it name} is determined by the {\it type} parameter.} | |
347 | ||
348 | \docparam{type}{One of the following values: | |
349 | ||
350 | \twocolwidtha{5cm} | |
351 | \begin{twocollist} | |
352 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.} | |
353 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP\_RESOURCE}}{Load a Windows bitmap from the resource database.} | |
354 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.} | |
355 | \twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.} | |
356 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load an XPM bitmap file.} | |
357 | \end{twocollist} | |
358 | ||
359 | The validity of these flags depends on the platform and wxWindows configuration.} | |
360 | ||
361 | \wxheading{Return value} | |
362 | ||
363 | TRUE if the operation succeeded, FALSE otherwise. | |
364 | ||
365 | \wxheading{Remarks} | |
366 | ||
367 | A palette may be associated with the bitmap if one exists (especially for | |
368 | colour Windows bitmaps), and if the code supports it. You can check | |
369 | if one has been created by using the \helpref{GetPalette}{wxbitmapgetpalette} member. | |
370 | ||
371 | \wxheading{See also} | |
372 | ||
373 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile} | |
374 | ||
375 | \membersection{wxBitmap::Ok}\label{wxbitmapok} | |
376 | ||
377 | \constfunc{bool}{Ok}{\void} | |
378 | ||
379 | Returns TRUE if bitmap data is present. | |
380 | ||
381 | \membersection{wxBitmap::RemoveHandler} | |
382 | ||
383 | \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}} | |
384 | ||
385 | Finds the handler with the given name, and removes it. The handler | |
386 | is not deleted. | |
387 | ||
388 | \docparam{name}{The handler name.} | |
389 | ||
390 | \wxheading{Return value} | |
391 | ||
392 | TRUE if the handler was found and removed, FALSE otherwise. | |
393 | ||
394 | \wxheading{See also} | |
395 | ||
396 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
397 | ||
398 | \membersection{wxBitmap::SaveFile}\label{wxbitmapsavefile} | |
399 | ||
400 | \func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}} | |
401 | ||
402 | Saves a bitmap in the named file. | |
403 | ||
404 | \wxheading{Parameters} | |
405 | ||
406 | \docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.} | |
407 | ||
408 | \docparam{type}{One of the following values: | |
409 | ||
410 | \twocolwidtha{5cm} | |
411 | \begin{twocollist} | |
412 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a Windows bitmap file.} | |
413 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Save a GIF bitmap file.} | |
414 | \twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Save an X bitmap file.} | |
415 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save an XPM bitmap file.} | |
416 | \end{twocollist} | |
417 | ||
418 | The validity of these flags depends on the platform and wxWindows configuration.} | |
419 | ||
5b6aa0ff JS |
420 | \docparam{palette}{An optional palette used for saving the bitmap.} |
421 | % TODO: this parameter should | |
422 | %probably be eliminated; instead the app should set the palette before saving. | |
a660d684 KB |
423 | |
424 | \wxheading{Return value} | |
425 | ||
426 | TRUE if the operation succeeded, FALSE otherwise. | |
427 | ||
428 | \wxheading{Remarks} | |
429 | ||
430 | Depending on how wxWindows has been configured, not all formats may be available. | |
431 | ||
432 | \wxheading{See also} | |
433 | ||
434 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
435 | ||
436 | \membersection{wxBitmap::SetDepth}\label{wxbitmapsetdepth} | |
437 | ||
438 | \func{void}{SetDepth}{\param{int }{depth}} | |
439 | ||
440 | Sets the depth member (does not affect the bitmap data). | |
441 | ||
442 | \wxheading{Parameters} | |
443 | ||
444 | \docparam{depth}{Bitmap depth.} | |
445 | ||
446 | \membersection{wxBitmap::SetHeight}\label{wxbitmapsetheight} | |
447 | ||
448 | \func{void}{SetHeight}{\param{int }{height}} | |
449 | ||
450 | Sets the height member (does not affect the bitmap data). | |
451 | ||
452 | \wxheading{Parameters} | |
453 | ||
454 | \docparam{height}{Bitmap height in pixels.} | |
455 | ||
456 | \membersection{wxBitmap::SetMask}\label{wxbitmapsetmask} | |
457 | ||
458 | \func{void}{SetMask}{\param{wxMask* }{mask}} | |
459 | ||
460 | Sets the mask for this bitmap. | |
461 | ||
462 | \wxheading{Remarks} | |
463 | ||
464 | The bitmap object owns the mask once this has been called. | |
465 | ||
466 | \wxheading{See also} | |
467 | ||
468 | \helpref{wxBitmap::GetMask}{wxbitmapgetmask}, \helpref{wxMask}{wxmask} | |
469 | ||
470 | \membersection{wxBitmap::SetOk} | |
471 | ||
472 | \func{void}{SetOk}{\param{int }{isOk}} | |
473 | ||
474 | Sets the validity member (does not affect the bitmap data). | |
475 | ||
476 | \wxheading{Parameters} | |
477 | ||
478 | \docparam{isOk}{Validity flag.} | |
479 | ||
480 | \membersection{wxBitmap::SetPalette}\label{wxbitmapsetpalette} | |
481 | ||
482 | \func{void}{SetPalette}{\param{wxPalette* }{palette}} | |
483 | ||
484 | Sets the associated palette: it will be deleted in the wxBitmap | |
485 | destructor, so if you do not wish it to be deleted automatically, | |
486 | reset the palette to NULL before the bitmap is deleted. | |
487 | ||
488 | \wxheading{Parameters} | |
489 | ||
490 | \docparam{palette}{The palette to set.} | |
491 | ||
492 | \wxheading{Remarks} | |
493 | ||
494 | The bitmap object owns the palette once this has been called. | |
495 | ||
496 | \wxheading{See also} | |
497 | ||
498 | \helpref{wxPalette}{wxpalette} | |
499 | ||
500 | \membersection{wxBitmap::SetWidth} | |
501 | ||
502 | \func{void}{SetWidth}{\param{int }{width}} | |
503 | ||
504 | Sets the width member (does not affect the bitmap data). | |
505 | ||
506 | \wxheading{Parameters} | |
507 | ||
508 | \docparam{width}{Bitmap width in pixels.} | |
509 | ||
510 | \membersection{wxBitmap::operator $=$} | |
511 | ||
512 | \func{wxBitmap\& }{operator $=$}{\param{const wxBitmap\& }{bitmap}} | |
513 | ||
514 | Assignment operator. This operator does not copy any data, but instead | |
515 | passes a pointer to the data in {\it bitmap} and increments a reference | |
516 | counter. It is a fast operation. | |
517 | ||
518 | \wxheading{Parameters} | |
519 | ||
520 | \docparam{bitmap}{Bitmap to assign.} | |
521 | ||
522 | \wxheading{Return value} | |
523 | ||
524 | Returns 'this' object. | |
525 | ||
526 | \membersection{wxBitmap::operator $==$} | |
527 | ||
528 | \func{bool}{operator $==$}{\param{const wxBitmap\& }{bitmap}} | |
529 | ||
530 | Equality operator. This operator tests whether the internal data pointers are | |
531 | equal (a fast test). | |
532 | ||
533 | \wxheading{Parameters} | |
534 | ||
535 | \docparam{bitmap}{Bitmap to compare with 'this'} | |
536 | ||
537 | \wxheading{Return value} | |
538 | ||
539 | Returns TRUE if the bitmaps were effectively equal, FALSE otherwise. | |
540 | ||
541 | \membersection{wxBitmap::operator $!=$} | |
542 | ||
543 | \func{bool}{operator $!=$}{\param{const wxBitmap\& }{bitmap}} | |
544 | ||
545 | Inequality operator. This operator tests whether the internal data pointers are | |
546 | unequal (a fast test). | |
547 | ||
548 | \wxheading{Parameters} | |
549 | ||
550 | \docparam{bitmap}{Bitmap to compare with 'this'} | |
551 | ||
552 | \wxheading{Return value} | |
553 | ||
554 | Returns TRUE if the bitmaps were unequal, FALSE otherwise. | |
555 | ||
556 | \section{\class{wxBitmapHandler}}\label{wxbitmaphandler} | |
557 | ||
558 | \overview{Overview}{wxbitmapoverview} | |
559 | ||
560 | This is the base class for implementing bitmap file loading/saving, and bitmap creation from data. | |
561 | It is used within wxBitmap and is not normally seen by the application. | |
562 | ||
563 | If you wish to extend the capabilities of wxBitmap, derive a class from wxBitmapHandler | |
564 | and add the handler using \helpref{wxBitmap::AddHandler}{wxbitmapaddhandler} in your | |
565 | application initialisation. | |
566 | ||
567 | \wxheading{Derived from} | |
568 | ||
569 | \helpref{wxObject}{wxobject} | |
570 | ||
954b8ae6 JS |
571 | \wxheading{Include files} |
572 | ||
573 | <wx/bitmap.h> | |
574 | ||
a660d684 KB |
575 | \wxheading{See also} |
576 | ||
577 | \helpref{wxBitmap}{wxbitmap}, \helpref{wxIcon}{wxicon}, \helpref{wxCursor}{wxcursor} | |
578 | ||
579 | \latexignore{\rtfignore{\wxheading{Members}}} | |
580 | ||
581 | \membersection{wxBitmapHandler::wxBitmapHandler}\label{wxbitmaphandlerconstr} | |
582 | ||
583 | \func{}{wxBitmapHandler}{\void} | |
584 | ||
585 | Default constructor. In your own default constructor, initialise the members | |
586 | m\_name, m\_extension and m\_type. | |
587 | ||
588 | \membersection{wxBitmapHandler::\destruct{wxBitmapHandler}} | |
589 | ||
590 | \func{}{\destruct{wxBitmapHandler}}{\void} | |
591 | ||
592 | Destroys the wxBitmapHandler object. | |
593 | ||
594 | \membersection{wxBitmapHandler::Create} | |
595 | ||
eaaa6a06 | 596 | \func{virtual bool}{Create}{\param{wxBitmap* }{bitmap}, \param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
597 | |
598 | Creates a bitmap from the given data, which can be of arbitrary type. The wxBitmap object {\it bitmap} is | |
599 | manipulated by this function. | |
600 | ||
601 | \wxheading{Parameters} | |
602 | ||
603 | \docparam{bitmap}{The wxBitmap object.} | |
604 | ||
605 | \docparam{width}{The width of the bitmap in pixels.} | |
606 | ||
607 | \docparam{height}{The height of the bitmap in pixels.} | |
608 | ||
609 | \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.} | |
610 | ||
611 | \docparam{data}{Data whose type depends on the value of {\it type}.} | |
612 | ||
613 | \docparam{type}{A bitmap type identifier - see \helpref{wxBitmapHandler::wxBitmapHandler}{wxbitmapconstr} for a list | |
614 | of possible values.} | |
615 | ||
616 | \wxheading{Return value} | |
617 | ||
618 | TRUE if the call succeeded, FALSE otherwise (the default). | |
619 | ||
620 | \membersection{wxBitmapHandler::GetName} | |
621 | ||
622 | \constfunc{wxString}{GetName}{\void} | |
623 | ||
624 | Gets the name of this handler. | |
625 | ||
626 | \membersection{wxBitmapHandler::GetExtension} | |
627 | ||
628 | \constfunc{wxString}{GetExtension}{\void} | |
629 | ||
630 | Gets the file extension associated with this handler. | |
631 | ||
632 | \membersection{wxBitmapHandler::GetType} | |
633 | ||
634 | \constfunc{long}{GetType}{\void} | |
635 | ||
636 | Gets the bitmap type associated with this handler. | |
637 | ||
638 | \membersection{wxBitmapHandler::LoadFile}\label{wxbitmaphandlerloadfile} | |
639 | ||
eaaa6a06 | 640 | \func{bool}{LoadFile}{\param{wxBitmap* }{bitmap}, \param{const wxString\&}{ name}, \param{long}{ type}} |
a660d684 KB |
641 | |
642 | Loads a bitmap from a file or resource, putting the resulting data into {\it bitmap}. | |
643 | ||
644 | \wxheading{Parameters} | |
645 | ||
646 | \docparam{bitmap}{The bitmap object which is to be affected by this operation.} | |
647 | ||
648 | \docparam{name}{Either a filename or a Windows resource name. | |
649 | The meaning of {\it name} is determined by the {\it type} parameter.} | |
650 | ||
651 | \docparam{type}{See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for values this can take.} | |
652 | ||
653 | \wxheading{Return value} | |
654 | ||
655 | TRUE if the operation succeeded, FALSE otherwise. | |
656 | ||
657 | \wxheading{See also} | |
658 | ||
659 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile}\\ | |
660 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile}\\ | |
661 | \helpref{wxBitmapHandler::SaveFile}{wxbitmaphandlersavefile} | |
662 | ||
663 | \membersection{wxBitmapHandler::SaveFile}\label{wxbitmaphandlersavefile} | |
664 | ||
665 | \func{bool}{SaveFile}{\param{wxBitmap* }{bitmap}, \param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}} | |
666 | ||
667 | Saves a bitmap in the named file. | |
668 | ||
669 | \wxheading{Parameters} | |
670 | ||
671 | \docparam{bitmap}{The bitmap object which is to be affected by this operation.} | |
672 | ||
673 | \docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.} | |
674 | ||
675 | \docparam{type}{See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for values this can take.} | |
676 | ||
5b6aa0ff | 677 | \docparam{palette}{An optional palette used for saving the bitmap.} |
a660d684 KB |
678 | |
679 | \wxheading{Return value} | |
680 | ||
681 | TRUE if the operation succeeded, FALSE otherwise. | |
682 | ||
683 | \wxheading{See also} | |
684 | ||
685 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile}\\ | |
686 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile}\\ | |
687 | \helpref{wxBitmapHandler::LoadFile}{wxbitmaphandlerloadfile} | |
688 | ||
689 | \membersection{wxBitmapHandler::SetName} | |
690 | ||
691 | \func{void}{SetName}{\param{const wxString\& }{name}} | |
692 | ||
693 | Sets the handler name. | |
694 | ||
695 | \wxheading{Parameters} | |
696 | ||
697 | \docparam{name}{Handler name.} | |
698 | ||
699 | \membersection{wxBitmapHandler::SetExtension} | |
700 | ||
701 | \func{void}{SetExtension}{\param{const wxString\& }{extension}} | |
702 | ||
703 | Sets the handler extension. | |
704 | ||
705 | \wxheading{Parameters} | |
706 | ||
707 | \docparam{extension}{Handler extension.} | |
708 | ||
709 | \membersection{wxBitmapHandler::SetType} | |
710 | ||
711 | \func{void}{SetType}{\param{long }{type}} | |
712 | ||
713 | Sets the handler type. | |
714 | ||
715 | \wxheading{Parameters} | |
716 | ||
717 | \docparam{name}{Handler type.} | |
718 | ||
719 |