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