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