]>
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 | 44 | |
0765adca VZ |
45 | Creates a bitmap from the given data which is interpreted in platform-dependent |
46 | manner. | |
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 | |
0765adca VZ |
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 | |
f6bcfd97 | 58 | data is passed without any changes to the underlying {\tt CreateBitmap()} API. |
0765adca VZ |
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. | |
a660d684 | 62 | |
eaaa6a06 | 63 | \func{}{wxBitmap}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 | 64 | |
0765adca VZ |
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. | |
a660d684 KB |
68 | |
69 | \func{}{wxBitmap}{\param{const char**}{ bits}} | |
70 | ||
71 | Creates a bitmap from XPM data. | |
72 | ||
eaaa6a06 | 73 | \func{}{wxBitmap}{\param{const wxString\& }{name}, \param{long}{ type}} |
a660d684 KB |
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. | |
1e6d9499 | 89 | Its meaning is determined by the {\it type} parameter.} |
a660d684 KB |
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. | |
2fd284a4 JS |
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. | |
b75dd496 VS |
106 | Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM file. |
107 | ||
f9ee644e RR |
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. } | |
a660d684 KB |
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. | |
2fd284a4 | 148 | Under X, {\it type} defaults to wxBITMAP\_TYPE\_XPM. |
a660d684 KB |
149 | |
150 | \wxheading{See also} | |
151 | ||
152 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
153 | ||
06d20283 RD |
154 | \pythonnote{Constructors supported by wxPython are:\par |
155 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
156 | \twocolitem{{\bf wxBitmap(name, flag)}}{Loads a bitmap from a file} |
157 | \twocolitem{{\bf wxBitmapFromData(data, type, width, height, depth=1)}}{Creates | |
dfa13ec8 | 158 | a bitmap from the given data, which can be of arbitrary type.} |
c9110876 | 159 | \twocolitem{{\bf wxNoRefBitmap(name, flag)}}{This one won't own the |
06d20283 RD |
160 | reference, so Python won't call the destructor, this is good for toolbars |
161 | and such where the parent will manage the bitmap.} | |
c9110876 | 162 | \twocolitem{{\bf wxEmptyBitmap(width, height, depth = -1)}}{Creates an |
06d20283 RD |
163 | empty bitmap with the given specifications} |
164 | \end{twocollist}} | |
165 | } | |
166 | ||
a660d684 KB |
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 | ||
c0bcc480 | 202 | \membersection{wxBitmap::Create}\label{wxbitmapcreate} |
a660d684 | 203 | |
eaaa6a06 | 204 | \func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
205 | |
206 | Creates a fresh bitmap. If the final argument is omitted, the display depth of | |
207 | the screen is used. | |
208 | ||
eaaa6a06 | 209 | \func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
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 | ||
1e6d9499 | 305 | Gets the associated mask (if any) which may have been loaded from a file |
a660d684 KB |
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 | ||
f9ee644e RR |
322 | \membersection{wxBitmap::GetSubBitmap}\label{wxbitmapgetsubbitmap} |
323 | ||
d17f05af | 324 | \constfunc{wxBitmap}{GetSubBitmap}{\param{const wxRect\&}{rect}} |
f9ee644e RR |
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 | ||
a660d684 KB |
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 | ||
eaaa6a06 | 357 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type}} |
a660d684 KB |
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 | ||
b75dd496 VS |
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.) } | |
a660d684 KB |
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 | ||
b75dd496 VS |
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.) } | |
a660d684 | 445 | |
5b6aa0ff JS |
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. | |
a660d684 KB |
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 | ||
f6bcfd97 | 508 | \func{void}{SetPalette}{\param{const wxPalette\& }{palette}} |
a660d684 | 509 | |
f6bcfd97 | 510 | Sets the associated palette. |
a660d684 KB |
511 | |
512 | \wxheading{Parameters} | |
513 | ||
514 | \docparam{palette}{The palette to set.} | |
515 | ||
a660d684 KB |
516 | \wxheading{See also} |
517 | ||
518 | \helpref{wxPalette}{wxpalette} | |
519 | ||
520 | \membersection{wxBitmap::SetWidth} | |
521 | ||
522 | \func{void}{SetWidth}{\param{int }{width}} | |
523 | ||
524 | Sets the width member (does not affect the bitmap data). | |
525 | ||
526 | \wxheading{Parameters} | |
527 | ||
528 | \docparam{width}{Bitmap width in pixels.} | |
529 | ||
530 | \membersection{wxBitmap::operator $=$} | |
531 | ||
532 | \func{wxBitmap\& }{operator $=$}{\param{const wxBitmap\& }{bitmap}} | |
533 | ||
534 | Assignment operator. This operator does not copy any data, but instead | |
535 | passes a pointer to the data in {\it bitmap} and increments a reference | |
536 | counter. It is a fast operation. | |
537 | ||
538 | \wxheading{Parameters} | |
539 | ||
540 | \docparam{bitmap}{Bitmap to assign.} | |
541 | ||
542 | \wxheading{Return value} | |
543 | ||
544 | Returns 'this' object. | |
545 | ||
546 | \membersection{wxBitmap::operator $==$} | |
547 | ||
548 | \func{bool}{operator $==$}{\param{const wxBitmap\& }{bitmap}} | |
549 | ||
550 | Equality operator. This operator tests whether the internal data pointers are | |
551 | equal (a fast test). | |
552 | ||
553 | \wxheading{Parameters} | |
554 | ||
555 | \docparam{bitmap}{Bitmap to compare with 'this'} | |
556 | ||
557 | \wxheading{Return value} | |
558 | ||
559 | Returns TRUE if the bitmaps were effectively equal, FALSE otherwise. | |
560 | ||
561 | \membersection{wxBitmap::operator $!=$} | |
562 | ||
563 | \func{bool}{operator $!=$}{\param{const wxBitmap\& }{bitmap}} | |
564 | ||
565 | Inequality operator. This operator tests whether the internal data pointers are | |
566 | unequal (a fast test). | |
567 | ||
568 | \wxheading{Parameters} | |
569 | ||
570 | \docparam{bitmap}{Bitmap to compare with 'this'} | |
571 | ||
572 | \wxheading{Return value} | |
573 | ||
574 | Returns TRUE if the bitmaps were unequal, FALSE otherwise. | |
575 | ||
576 | \section{\class{wxBitmapHandler}}\label{wxbitmaphandler} | |
577 | ||
578 | \overview{Overview}{wxbitmapoverview} | |
579 | ||
580 | This is the base class for implementing bitmap file loading/saving, and bitmap creation from data. | |
581 | It is used within wxBitmap and is not normally seen by the application. | |
582 | ||
583 | If you wish to extend the capabilities of wxBitmap, derive a class from wxBitmapHandler | |
584 | and add the handler using \helpref{wxBitmap::AddHandler}{wxbitmapaddhandler} in your | |
585 | application initialisation. | |
586 | ||
587 | \wxheading{Derived from} | |
588 | ||
589 | \helpref{wxObject}{wxobject} | |
590 | ||
954b8ae6 JS |
591 | \wxheading{Include files} |
592 | ||
593 | <wx/bitmap.h> | |
594 | ||
a660d684 KB |
595 | \wxheading{See also} |
596 | ||
597 | \helpref{wxBitmap}{wxbitmap}, \helpref{wxIcon}{wxicon}, \helpref{wxCursor}{wxcursor} | |
598 | ||
599 | \latexignore{\rtfignore{\wxheading{Members}}} | |
600 | ||
601 | \membersection{wxBitmapHandler::wxBitmapHandler}\label{wxbitmaphandlerconstr} | |
602 | ||
603 | \func{}{wxBitmapHandler}{\void} | |
604 | ||
605 | Default constructor. In your own default constructor, initialise the members | |
606 | m\_name, m\_extension and m\_type. | |
607 | ||
608 | \membersection{wxBitmapHandler::\destruct{wxBitmapHandler}} | |
609 | ||
610 | \func{}{\destruct{wxBitmapHandler}}{\void} | |
611 | ||
612 | Destroys the wxBitmapHandler object. | |
613 | ||
614 | \membersection{wxBitmapHandler::Create} | |
615 | ||
eaaa6a06 | 616 | \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 |
617 | |
618 | Creates a bitmap from the given data, which can be of arbitrary type. The wxBitmap object {\it bitmap} is | |
619 | manipulated by this function. | |
620 | ||
621 | \wxheading{Parameters} | |
622 | ||
623 | \docparam{bitmap}{The wxBitmap object.} | |
624 | ||
625 | \docparam{width}{The width of the bitmap in pixels.} | |
626 | ||
627 | \docparam{height}{The height of the bitmap in pixels.} | |
628 | ||
629 | \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.} | |
630 | ||
631 | \docparam{data}{Data whose type depends on the value of {\it type}.} | |
632 | ||
633 | \docparam{type}{A bitmap type identifier - see \helpref{wxBitmapHandler::wxBitmapHandler}{wxbitmapconstr} for a list | |
634 | of possible values.} | |
635 | ||
636 | \wxheading{Return value} | |
637 | ||
638 | TRUE if the call succeeded, FALSE otherwise (the default). | |
639 | ||
640 | \membersection{wxBitmapHandler::GetName} | |
641 | ||
642 | \constfunc{wxString}{GetName}{\void} | |
643 | ||
644 | Gets the name of this handler. | |
645 | ||
646 | \membersection{wxBitmapHandler::GetExtension} | |
647 | ||
648 | \constfunc{wxString}{GetExtension}{\void} | |
649 | ||
650 | Gets the file extension associated with this handler. | |
651 | ||
652 | \membersection{wxBitmapHandler::GetType} | |
653 | ||
654 | \constfunc{long}{GetType}{\void} | |
655 | ||
656 | Gets the bitmap type associated with this handler. | |
657 | ||
658 | \membersection{wxBitmapHandler::LoadFile}\label{wxbitmaphandlerloadfile} | |
659 | ||
eaaa6a06 | 660 | \func{bool}{LoadFile}{\param{wxBitmap* }{bitmap}, \param{const wxString\&}{ name}, \param{long}{ type}} |
a660d684 KB |
661 | |
662 | Loads a bitmap from a file or resource, putting the resulting data into {\it bitmap}. | |
663 | ||
664 | \wxheading{Parameters} | |
665 | ||
666 | \docparam{bitmap}{The bitmap object which is to be affected by this operation.} | |
667 | ||
668 | \docparam{name}{Either a filename or a Windows resource name. | |
669 | The meaning of {\it name} is determined by the {\it type} parameter.} | |
670 | ||
671 | \docparam{type}{See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for values this can take.} | |
672 | ||
673 | \wxheading{Return value} | |
674 | ||
675 | TRUE if the operation succeeded, FALSE otherwise. | |
676 | ||
677 | \wxheading{See also} | |
678 | ||
679 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile}\\ | |
680 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile}\\ | |
681 | \helpref{wxBitmapHandler::SaveFile}{wxbitmaphandlersavefile} | |
682 | ||
683 | \membersection{wxBitmapHandler::SaveFile}\label{wxbitmaphandlersavefile} | |
684 | ||
685 | \func{bool}{SaveFile}{\param{wxBitmap* }{bitmap}, \param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}} | |
686 | ||
687 | Saves a bitmap in the named file. | |
688 | ||
689 | \wxheading{Parameters} | |
690 | ||
691 | \docparam{bitmap}{The bitmap object which is to be affected by this operation.} | |
692 | ||
693 | \docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.} | |
694 | ||
695 | \docparam{type}{See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for values this can take.} | |
696 | ||
5b6aa0ff | 697 | \docparam{palette}{An optional palette used for saving the bitmap.} |
a660d684 KB |
698 | |
699 | \wxheading{Return value} | |
700 | ||
701 | TRUE if the operation succeeded, FALSE otherwise. | |
702 | ||
703 | \wxheading{See also} | |
704 | ||
705 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile}\\ | |
706 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile}\\ | |
707 | \helpref{wxBitmapHandler::LoadFile}{wxbitmaphandlerloadfile} | |
708 | ||
709 | \membersection{wxBitmapHandler::SetName} | |
710 | ||
711 | \func{void}{SetName}{\param{const wxString\& }{name}} | |
712 | ||
713 | Sets the handler name. | |
714 | ||
715 | \wxheading{Parameters} | |
716 | ||
717 | \docparam{name}{Handler name.} | |
718 | ||
719 | \membersection{wxBitmapHandler::SetExtension} | |
720 | ||
721 | \func{void}{SetExtension}{\param{const wxString\& }{extension}} | |
722 | ||
723 | Sets the handler extension. | |
724 | ||
725 | \wxheading{Parameters} | |
726 | ||
727 | \docparam{extension}{Handler extension.} | |
728 | ||
729 | \membersection{wxBitmapHandler::SetType} | |
730 | ||
731 | \func{void}{SetType}{\param{long }{type}} | |
732 | ||
733 | Sets the handler type. | |
734 | ||
735 | \wxheading{Parameters} | |
736 | ||
737 | \docparam{name}{Handler type.} | |
738 | ||
739 |