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