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