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