]>
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. | |
b75dd496 VS |
99 | Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM file. |
100 | ||
f9ee644e RR |
101 | In addition, wxBitmap can read all formats that \helpref{wxImage}{wximage} can, which currently include |
102 | wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_TIF, wxBITMAP\_TYPE\_PNG, wxBITMAP\_TYPE\_GIF, wxBITMAP\_TYPE\_PCX, | |
103 | and wxBITMAP\_TYPE\_PNM. Of course, you must have wxImage handlers loaded. } | |
a660d684 KB |
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. | |
2fd284a4 | 141 | Under X, {\it type} defaults to wxBITMAP\_TYPE\_XPM. |
a660d684 KB |
142 | |
143 | \wxheading{See also} | |
144 | ||
145 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
146 | ||
06d20283 RD |
147 | \pythonnote{Constructors supported by wxPython are:\par |
148 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
149 | \twocolitem{{\bf wxBitmap(name, flag)}}{Loads a bitmap from a file} |
150 | \twocolitem{{\bf wxBitmapFromData(data, type, width, height, depth=1)}}{Creates | |
dfa13ec8 | 151 | a bitmap from the given data, which can be of arbitrary type.} |
c9110876 | 152 | \twocolitem{{\bf wxNoRefBitmap(name, flag)}}{This one won't own the |
06d20283 RD |
153 | reference, so Python won't call the destructor, this is good for toolbars |
154 | and such where the parent will manage the bitmap.} | |
c9110876 | 155 | \twocolitem{{\bf wxEmptyBitmap(width, height, depth = -1)}}{Creates an |
06d20283 RD |
156 | empty bitmap with the given specifications} |
157 | \end{twocollist}} | |
158 | } | |
159 | ||
a660d684 KB |
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 | ||
eaaa6a06 | 197 | \func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
198 | |
199 | Creates a fresh bitmap. If the final argument is omitted, the display depth of | |
200 | the screen is used. | |
201 | ||
eaaa6a06 | 202 | \func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
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 | ||
1e6d9499 | 298 | Gets the associated mask (if any) which may have been loaded from a file |
a660d684 KB |
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 | ||
f9ee644e RR |
315 | \membersection{wxBitmap::GetSubBitmap}\label{wxbitmapgetsubbitmap} |
316 | ||
317 | \constfunc{wxBitmap}{GetSubBitmap}{\param{const wxRect&}{rect}} | |
318 | ||
319 | Returns a sub bitmap of the current one as long as the rect belongs entirely to | |
320 | the bitmap. This function preserves bit depth and mask information. | |
321 | ||
a660d684 KB |
322 | \membersection{wxBitmap::InitStandardHandlers} |
323 | ||
324 | \func{static void}{InitStandardHandlers}{\void} | |
325 | ||
326 | Adds the standard bitmap format handlers, which, depending on wxWindows | |
327 | configuration, can be handlers for Windows bitmap, Windows bitmap resource, and XPM. | |
328 | ||
329 | This function is called by wxWindows on startup. | |
330 | ||
331 | \wxheading{See also} | |
332 | ||
333 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
334 | ||
335 | \membersection{wxBitmap::InsertHandler} | |
336 | ||
337 | \func{static void}{InsertHandler}{\param{wxBitmapHandler*}{ handler}} | |
338 | ||
339 | Adds a handler at the start of the static list of format handlers. | |
340 | ||
341 | \docparam{handler}{A new bitmap format handler object. There is usually only one instance | |
342 | of a given handler class in an application session.} | |
343 | ||
344 | \wxheading{See also} | |
345 | ||
346 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
347 | ||
348 | \membersection{wxBitmap::LoadFile}\label{wxbitmaploadfile} | |
349 | ||
eaaa6a06 | 350 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type}} |
a660d684 KB |
351 | |
352 | Loads a bitmap from a file or resource. | |
353 | ||
354 | \wxheading{Parameters} | |
355 | ||
356 | \docparam{name}{Either a filename or a Windows resource name. | |
357 | The meaning of {\it name} is determined by the {\it type} parameter.} | |
358 | ||
359 | \docparam{type}{One of the following values: | |
360 | ||
361 | \twocolwidtha{5cm} | |
362 | \begin{twocollist} | |
363 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.} | |
364 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP\_RESOURCE}}{Load a Windows bitmap from the resource database.} | |
365 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.} | |
366 | \twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.} | |
367 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load an XPM bitmap file.} | |
368 | \end{twocollist} | |
369 | ||
b75dd496 VS |
370 | The validity of these flags depends on the platform and wxWindows configuration. |
371 | ||
372 | In addition, wxBitmap can read all formats that \helpref{wxImage}{wximage} can | |
373 | (wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_PNG, wxBITMAP\_TYPE\_GIF, wxBITMAP\_TYPE\_PCX, wxBITMAP\_TYPE\_PNM). | |
374 | (Of course you must have wxImage handlers loaded.) } | |
a660d684 KB |
375 | |
376 | \wxheading{Return value} | |
377 | ||
378 | TRUE if the operation succeeded, FALSE otherwise. | |
379 | ||
380 | \wxheading{Remarks} | |
381 | ||
382 | A palette may be associated with the bitmap if one exists (especially for | |
383 | colour Windows bitmaps), and if the code supports it. You can check | |
384 | if one has been created by using the \helpref{GetPalette}{wxbitmapgetpalette} member. | |
385 | ||
386 | \wxheading{See also} | |
387 | ||
388 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile} | |
389 | ||
390 | \membersection{wxBitmap::Ok}\label{wxbitmapok} | |
391 | ||
392 | \constfunc{bool}{Ok}{\void} | |
393 | ||
394 | Returns TRUE if bitmap data is present. | |
395 | ||
396 | \membersection{wxBitmap::RemoveHandler} | |
397 | ||
398 | \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}} | |
399 | ||
400 | Finds the handler with the given name, and removes it. The handler | |
401 | is not deleted. | |
402 | ||
403 | \docparam{name}{The handler name.} | |
404 | ||
405 | \wxheading{Return value} | |
406 | ||
407 | TRUE if the handler was found and removed, FALSE otherwise. | |
408 | ||
409 | \wxheading{See also} | |
410 | ||
411 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
412 | ||
413 | \membersection{wxBitmap::SaveFile}\label{wxbitmapsavefile} | |
414 | ||
415 | \func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}} | |
416 | ||
417 | Saves a bitmap in the named file. | |
418 | ||
419 | \wxheading{Parameters} | |
420 | ||
421 | \docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.} | |
422 | ||
423 | \docparam{type}{One of the following values: | |
424 | ||
425 | \twocolwidtha{5cm} | |
426 | \begin{twocollist} | |
427 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a Windows bitmap file.} | |
428 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Save a GIF bitmap file.} | |
429 | \twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Save an X bitmap file.} | |
430 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save an XPM bitmap file.} | |
431 | \end{twocollist} | |
432 | ||
b75dd496 VS |
433 | The validity of these flags depends on the platform and wxWindows configuration. |
434 | ||
435 | In addition, wxBitmap can save all formats that \helpref{wxImage}{wximage} can | |
436 | (wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_PNG). | |
437 | (Of course you must have wxImage handlers loaded.) } | |
a660d684 | 438 | |
5b6aa0ff JS |
439 | \docparam{palette}{An optional palette used for saving the bitmap.} |
440 | % TODO: this parameter should | |
441 | %probably be eliminated; instead the app should set the palette before saving. | |
a660d684 KB |
442 | |
443 | \wxheading{Return value} | |
444 | ||
445 | TRUE if the operation succeeded, FALSE otherwise. | |
446 | ||
447 | \wxheading{Remarks} | |
448 | ||
449 | Depending on how wxWindows has been configured, not all formats may be available. | |
450 | ||
451 | \wxheading{See also} | |
452 | ||
453 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
454 | ||
455 | \membersection{wxBitmap::SetDepth}\label{wxbitmapsetdepth} | |
456 | ||
457 | \func{void}{SetDepth}{\param{int }{depth}} | |
458 | ||
459 | Sets the depth member (does not affect the bitmap data). | |
460 | ||
461 | \wxheading{Parameters} | |
462 | ||
463 | \docparam{depth}{Bitmap depth.} | |
464 | ||
465 | \membersection{wxBitmap::SetHeight}\label{wxbitmapsetheight} | |
466 | ||
467 | \func{void}{SetHeight}{\param{int }{height}} | |
468 | ||
469 | Sets the height member (does not affect the bitmap data). | |
470 | ||
471 | \wxheading{Parameters} | |
472 | ||
473 | \docparam{height}{Bitmap height in pixels.} | |
474 | ||
475 | \membersection{wxBitmap::SetMask}\label{wxbitmapsetmask} | |
476 | ||
477 | \func{void}{SetMask}{\param{wxMask* }{mask}} | |
478 | ||
479 | Sets the mask for this bitmap. | |
480 | ||
481 | \wxheading{Remarks} | |
482 | ||
483 | The bitmap object owns the mask once this has been called. | |
484 | ||
485 | \wxheading{See also} | |
486 | ||
487 | \helpref{wxBitmap::GetMask}{wxbitmapgetmask}, \helpref{wxMask}{wxmask} | |
488 | ||
489 | \membersection{wxBitmap::SetOk} | |
490 | ||
491 | \func{void}{SetOk}{\param{int }{isOk}} | |
492 | ||
493 | Sets the validity member (does not affect the bitmap data). | |
494 | ||
495 | \wxheading{Parameters} | |
496 | ||
497 | \docparam{isOk}{Validity flag.} | |
498 | ||
499 | \membersection{wxBitmap::SetPalette}\label{wxbitmapsetpalette} | |
500 | ||
501 | \func{void}{SetPalette}{\param{wxPalette* }{palette}} | |
502 | ||
503 | Sets the associated palette: it will be deleted in the wxBitmap | |
504 | destructor, so if you do not wish it to be deleted automatically, | |
505 | reset the palette to NULL before the bitmap is deleted. | |
506 | ||
507 | \wxheading{Parameters} | |
508 | ||
509 | \docparam{palette}{The palette to set.} | |
510 | ||
511 | \wxheading{Remarks} | |
512 | ||
513 | The bitmap object owns the palette once this has been called. | |
514 | ||
515 | \wxheading{See also} | |
516 | ||
517 | \helpref{wxPalette}{wxpalette} | |
518 | ||
519 | \membersection{wxBitmap::SetWidth} | |
520 | ||
521 | \func{void}{SetWidth}{\param{int }{width}} | |
522 | ||
523 | Sets the width member (does not affect the bitmap data). | |
524 | ||
525 | \wxheading{Parameters} | |
526 | ||
527 | \docparam{width}{Bitmap width in pixels.} | |
528 | ||
529 | \membersection{wxBitmap::operator $=$} | |
530 | ||
531 | \func{wxBitmap\& }{operator $=$}{\param{const wxBitmap\& }{bitmap}} | |
532 | ||
533 | Assignment operator. This operator does not copy any data, but instead | |
534 | passes a pointer to the data in {\it bitmap} and increments a reference | |
535 | counter. It is a fast operation. | |
536 | ||
537 | \wxheading{Parameters} | |
538 | ||
539 | \docparam{bitmap}{Bitmap to assign.} | |
540 | ||
541 | \wxheading{Return value} | |
542 | ||
543 | Returns 'this' object. | |
544 | ||
545 | \membersection{wxBitmap::operator $==$} | |
546 | ||
547 | \func{bool}{operator $==$}{\param{const wxBitmap\& }{bitmap}} | |
548 | ||
549 | Equality operator. This operator tests whether the internal data pointers are | |
550 | equal (a fast test). | |
551 | ||
552 | \wxheading{Parameters} | |
553 | ||
554 | \docparam{bitmap}{Bitmap to compare with 'this'} | |
555 | ||
556 | \wxheading{Return value} | |
557 | ||
558 | Returns TRUE if the bitmaps were effectively equal, FALSE otherwise. | |
559 | ||
560 | \membersection{wxBitmap::operator $!=$} | |
561 | ||
562 | \func{bool}{operator $!=$}{\param{const wxBitmap\& }{bitmap}} | |
563 | ||
564 | Inequality operator. This operator tests whether the internal data pointers are | |
565 | unequal (a fast test). | |
566 | ||
567 | \wxheading{Parameters} | |
568 | ||
569 | \docparam{bitmap}{Bitmap to compare with 'this'} | |
570 | ||
571 | \wxheading{Return value} | |
572 | ||
573 | Returns TRUE if the bitmaps were unequal, FALSE otherwise. | |
574 | ||
575 | \section{\class{wxBitmapHandler}}\label{wxbitmaphandler} | |
576 | ||
577 | \overview{Overview}{wxbitmapoverview} | |
578 | ||
579 | This is the base class for implementing bitmap file loading/saving, and bitmap creation from data. | |
580 | It is used within wxBitmap and is not normally seen by the application. | |
581 | ||
582 | If you wish to extend the capabilities of wxBitmap, derive a class from wxBitmapHandler | |
583 | and add the handler using \helpref{wxBitmap::AddHandler}{wxbitmapaddhandler} in your | |
584 | application initialisation. | |
585 | ||
586 | \wxheading{Derived from} | |
587 | ||
588 | \helpref{wxObject}{wxobject} | |
589 | ||
954b8ae6 JS |
590 | \wxheading{Include files} |
591 | ||
592 | <wx/bitmap.h> | |
593 | ||
a660d684 KB |
594 | \wxheading{See also} |
595 | ||
596 | \helpref{wxBitmap}{wxbitmap}, \helpref{wxIcon}{wxicon}, \helpref{wxCursor}{wxcursor} | |
597 | ||
598 | \latexignore{\rtfignore{\wxheading{Members}}} | |
599 | ||
600 | \membersection{wxBitmapHandler::wxBitmapHandler}\label{wxbitmaphandlerconstr} | |
601 | ||
602 | \func{}{wxBitmapHandler}{\void} | |
603 | ||
604 | Default constructor. In your own default constructor, initialise the members | |
605 | m\_name, m\_extension and m\_type. | |
606 | ||
607 | \membersection{wxBitmapHandler::\destruct{wxBitmapHandler}} | |
608 | ||
609 | \func{}{\destruct{wxBitmapHandler}}{\void} | |
610 | ||
611 | Destroys the wxBitmapHandler object. | |
612 | ||
613 | \membersection{wxBitmapHandler::Create} | |
614 | ||
eaaa6a06 | 615 | \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 |
616 | |
617 | Creates a bitmap from the given data, which can be of arbitrary type. The wxBitmap object {\it bitmap} is | |
618 | manipulated by this function. | |
619 | ||
620 | \wxheading{Parameters} | |
621 | ||
622 | \docparam{bitmap}{The wxBitmap object.} | |
623 | ||
624 | \docparam{width}{The width of the bitmap in pixels.} | |
625 | ||
626 | \docparam{height}{The height of the bitmap in pixels.} | |
627 | ||
628 | \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.} | |
629 | ||
630 | \docparam{data}{Data whose type depends on the value of {\it type}.} | |
631 | ||
632 | \docparam{type}{A bitmap type identifier - see \helpref{wxBitmapHandler::wxBitmapHandler}{wxbitmapconstr} for a list | |
633 | of possible values.} | |
634 | ||
635 | \wxheading{Return value} | |
636 | ||
637 | TRUE if the call succeeded, FALSE otherwise (the default). | |
638 | ||
639 | \membersection{wxBitmapHandler::GetName} | |
640 | ||
641 | \constfunc{wxString}{GetName}{\void} | |
642 | ||
643 | Gets the name of this handler. | |
644 | ||
645 | \membersection{wxBitmapHandler::GetExtension} | |
646 | ||
647 | \constfunc{wxString}{GetExtension}{\void} | |
648 | ||
649 | Gets the file extension associated with this handler. | |
650 | ||
651 | \membersection{wxBitmapHandler::GetType} | |
652 | ||
653 | \constfunc{long}{GetType}{\void} | |
654 | ||
655 | Gets the bitmap type associated with this handler. | |
656 | ||
657 | \membersection{wxBitmapHandler::LoadFile}\label{wxbitmaphandlerloadfile} | |
658 | ||
eaaa6a06 | 659 | \func{bool}{LoadFile}{\param{wxBitmap* }{bitmap}, \param{const wxString\&}{ name}, \param{long}{ type}} |
a660d684 KB |
660 | |
661 | Loads a bitmap from a file or resource, putting the resulting data into {\it bitmap}. | |
662 | ||
663 | \wxheading{Parameters} | |
664 | ||
665 | \docparam{bitmap}{The bitmap object which is to be affected by this operation.} | |
666 | ||
667 | \docparam{name}{Either a filename or a Windows resource name. | |
668 | The meaning of {\it name} is determined by the {\it type} parameter.} | |
669 | ||
670 | \docparam{type}{See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for values this can take.} | |
671 | ||
672 | \wxheading{Return value} | |
673 | ||
674 | TRUE if the operation succeeded, FALSE otherwise. | |
675 | ||
676 | \wxheading{See also} | |
677 | ||
678 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile}\\ | |
679 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile}\\ | |
680 | \helpref{wxBitmapHandler::SaveFile}{wxbitmaphandlersavefile} | |
681 | ||
682 | \membersection{wxBitmapHandler::SaveFile}\label{wxbitmaphandlersavefile} | |
683 | ||
684 | \func{bool}{SaveFile}{\param{wxBitmap* }{bitmap}, \param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}} | |
685 | ||
686 | Saves a bitmap in the named file. | |
687 | ||
688 | \wxheading{Parameters} | |
689 | ||
690 | \docparam{bitmap}{The bitmap object which is to be affected by this operation.} | |
691 | ||
692 | \docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.} | |
693 | ||
694 | \docparam{type}{See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for values this can take.} | |
695 | ||
5b6aa0ff | 696 | \docparam{palette}{An optional palette used for saving the bitmap.} |
a660d684 KB |
697 | |
698 | \wxheading{Return value} | |
699 | ||
700 | TRUE if the operation succeeded, FALSE otherwise. | |
701 | ||
702 | \wxheading{See also} | |
703 | ||
704 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile}\\ | |
705 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile}\\ | |
706 | \helpref{wxBitmapHandler::LoadFile}{wxbitmaphandlerloadfile} | |
707 | ||
708 | \membersection{wxBitmapHandler::SetName} | |
709 | ||
710 | \func{void}{SetName}{\param{const wxString\& }{name}} | |
711 | ||
712 | Sets the handler name. | |
713 | ||
714 | \wxheading{Parameters} | |
715 | ||
716 | \docparam{name}{Handler name.} | |
717 | ||
718 | \membersection{wxBitmapHandler::SetExtension} | |
719 | ||
720 | \func{void}{SetExtension}{\param{const wxString\& }{extension}} | |
721 | ||
722 | Sets the handler extension. | |
723 | ||
724 | \wxheading{Parameters} | |
725 | ||
726 | \docparam{extension}{Handler extension.} | |
727 | ||
728 | \membersection{wxBitmapHandler::SetType} | |
729 | ||
730 | \func{void}{SetType}{\param{long }{type}} | |
731 | ||
732 | Sets the handler type. | |
733 | ||
734 | \wxheading{Parameters} | |
735 | ||
736 | \docparam{name}{Handler type.} | |
737 | ||
738 |