]>
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 | ||
f510b7b2 | 33 | \membersection{wxBitmap::wxBitmap}\label{wxbitmapctor} |
a660d684 KB |
34 | |
35 | \func{}{wxBitmap}{\void} | |
36 | ||
37 | Default constructor. | |
38 | ||
39 | \func{}{wxBitmap}{\param{const wxBitmap\& }{bitmap}} | |
40 | ||
2faa8e74 JS |
41 | Copy constructor. Note that this does not take a fresh copy of the data, |
42 | but instead makes the internal data point to {\it bitmap}'s data. So | |
43 | changing one bitmap will change the other. To make a real copy, you can | |
44 | use: | |
45 | ||
46 | \begin{verbatim} | |
47 | wxBitmap newBitmap = oldBitmap.GetSubBitmap( | |
48 | wxRect(0, 0, oldBitmap.GetWidth(), oldBitmap.GetHeight())); | |
49 | \end{verbatim} | |
a660d684 | 50 | |
eaaa6a06 | 51 | \func{}{wxBitmap}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 | 52 | |
0765adca VZ |
53 | Creates a bitmap from the given data which is interpreted in platform-dependent |
54 | manner. | |
a660d684 | 55 | |
eaaa6a06 JS |
56 | \func{}{wxBitmap}{\param{const char}{ bits[]}, \param{int}{ width}, \param{int}{ height}\\ |
57 | \param{int}{ depth = 1}} | |
a660d684 | 58 | |
dfa13ec8 | 59 | Creates a bitmap from an array of bits. |
2259e007 | 60 | |
0765adca VZ |
61 | You should only use this function for monochrome bitmaps ({\it depth} 1) in |
62 | portable programs: in this case the {\it bits} parameter should contain an XBM | |
63 | image. | |
64 | ||
65 | For other bit depths, the behaviour is platform dependent: under Windows, the | |
f6bcfd97 | 66 | data is passed without any changes to the underlying {\tt CreateBitmap()} API. |
0765adca VZ |
67 | Under other platforms, only monochrome bitmaps may be created using this |
68 | constructor and \helpref{wxImage}{wximage} should be used for creating colour | |
69 | bitmaps from static data. | |
a660d684 | 70 | |
eaaa6a06 | 71 | \func{}{wxBitmap}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 | 72 | |
0765adca VZ |
73 | Creates a new bitmap. A depth of -1 indicates the depth of the current screen |
74 | or visual. Some platforms only support 1 for monochrome and -1 for the current | |
75 | colour setting. | |
a660d684 KB |
76 | |
77 | \func{}{wxBitmap}{\param{const char**}{ bits}} | |
78 | ||
79 | Creates a bitmap from XPM data. | |
80 | ||
eaaa6a06 | 81 | \func{}{wxBitmap}{\param{const wxString\& }{name}, \param{long}{ type}} |
a660d684 KB |
82 | |
83 | Loads a bitmap from a file or resource. | |
84 | ||
b06a6b20 VS |
85 | \func{}{wxBitmap}{\param{const wxImage\&}{ img}, \param{int}{ depth = -1}} |
86 | ||
87 | Creates bitmap object from the image. This has to be done | |
88 | to actually display an image as you cannot draw an image directly on a window. | |
a7c7c154 RD |
89 | The resulting bitmap will use the provided colour depth (or that of the |
90 | current system if depth is -1) which entails that a colour reduction has | |
b06a6b20 VS |
91 | to take place. |
92 | ||
a7c7c154 | 93 | When in 8-bit mode (PseudoColour mode), the GTK port will use a color cube created |
b06a6b20 VS |
94 | on program start-up to look up colors. This ensures a very fast conversion, but |
95 | the image quality won't be perfect (and could be better for photo images using more | |
96 | sophisticated dithering algorithms). | |
97 | ||
98 | On Windows, if there is a palette present (set with SetPalette), it will be used when | |
99 | creating the wxBitmap (most useful in 8-bit display mode). On other platforms, | |
100 | the palette is currently ignored. | |
101 | ||
a660d684 KB |
102 | \wxheading{Parameters} |
103 | ||
104 | \docparam{bits}{Specifies an array of pixel values.} | |
105 | ||
106 | \docparam{width}{Specifies the width of the bitmap.} | |
107 | ||
108 | \docparam{height}{Specifies the height of the bitmap.} | |
109 | ||
110 | \docparam{depth}{Specifies the depth of the bitmap. If this is omitted, the display depth of the | |
111 | screen is used.} | |
112 | ||
113 | \docparam{name}{This can refer to a resource name under MS Windows, or a filename under MS Windows and X. | |
1e6d9499 | 114 | Its meaning is determined by the {\it type} parameter.} |
a660d684 KB |
115 | |
116 | \docparam{type}{May be one of the following: | |
117 | ||
118 | \twocolwidtha{5cm} | |
119 | \begin{twocollist} | |
f690fb04 GT |
120 | \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.} |
121 | \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP\_RESOURCE}}{Load a Windows bitmap from the resource database.} | |
122 | \twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.} | |
123 | \twocolitem{\indexit{wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.} | |
124 | \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load an XPM bitmap file.} | |
125 | \twocolitem{\indexit{wxBITMAP\_TYPE\_RESOURCE}}{Load a Windows resource name.} | |
a660d684 KB |
126 | \end{twocollist} |
127 | ||
fc2171bd JS |
128 | The validity of these flags depends on the platform and wxWidgets configuration. |
129 | If all possible wxWidgets settings are used, the Windows platform supports BMP file, BMP resource, | |
2fd284a4 | 130 | XPM data, and XPM. Under wxGTK, the available formats are BMP file, XPM data, XPM file, and PNG file. |
b75dd496 VS |
131 | Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM file. |
132 | ||
a7c7c154 RD |
133 | In addition, wxBitmap can read all formats that \helpref{wxImage}{wximage} can, which currently include |
134 | wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_TIF, wxBITMAP\_TYPE\_PNG, wxBITMAP\_TYPE\_GIF, wxBITMAP\_TYPE\_PCX, | |
f9ee644e | 135 | and wxBITMAP\_TYPE\_PNM. Of course, you must have wxImage handlers loaded. } |
a660d684 | 136 | |
b06a6b20 VS |
137 | \docparam{img}{Platform-independent wxImage object.} |
138 | ||
a660d684 KB |
139 | \wxheading{Remarks} |
140 | ||
141 | The first form constructs a bitmap object with no data; an assignment or another member function such as Create | |
142 | or LoadFile must be called subsequently. | |
143 | ||
144 | The second and third forms provide copy constructors. Note that these do not copy the | |
145 | bitmap data, but instead a pointer to the data, keeping a reference count. They are therefore | |
146 | very efficient operations. | |
147 | ||
148 | The fourth form constructs a bitmap from data whose type and value depends on | |
149 | the value of the {\it type} argument. | |
150 | ||
151 | The fifth form constructs a (usually monochrome) bitmap from an array of pixel values, under both | |
152 | X and Windows. | |
153 | ||
154 | The sixth form constructs a new bitmap. | |
155 | ||
fc2171bd | 156 | The seventh form constructs a bitmap from pixmap (XPM) data, if wxWidgets has been configured |
a660d684 KB |
157 | to incorporate this feature. |
158 | ||
159 | To use this constructor, you must first include an XPM file. For | |
160 | example, assuming that the file {\tt mybitmap.xpm} contains an XPM array | |
161 | of character pointers called mybitmap: | |
162 | ||
163 | \begin{verbatim} | |
164 | #include "mybitmap.xpm" | |
165 | ||
166 | ... | |
167 | ||
168 | wxBitmap *bitmap = new wxBitmap(mybitmap); | |
169 | \end{verbatim} | |
170 | ||
171 | The eighth form constructs a bitmap from a file or resource. {\it name} can refer | |
172 | to a resource name under MS Windows, or a filename under MS Windows and X. | |
173 | ||
174 | Under Windows, {\it type} defaults to wxBITMAP\_TYPE\_BMP\_RESOURCE. | |
2fd284a4 | 175 | Under X, {\it type} defaults to wxBITMAP\_TYPE\_XPM. |
a660d684 KB |
176 | |
177 | \wxheading{See also} | |
178 | ||
179 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
180 | ||
06d20283 RD |
181 | \pythonnote{Constructors supported by wxPython are:\par |
182 | \indented{2cm}{\begin{twocollist} | |
c9110876 | 183 | \twocolitem{{\bf wxBitmap(name, flag)}}{Loads a bitmap from a file} |
c9110876 | 184 | \twocolitem{{\bf wxEmptyBitmap(width, height, depth = -1)}}{Creates an |
06d20283 | 185 | empty bitmap with the given specifications} |
a7c7c154 RD |
186 | \twocolitem{{\bf wxBitmapFromXPMData(listOfStrings)}}{Create a bitmap |
187 | from a Python list of strings whose contents are XPM data.} | |
188 | \twocolitem{{\bf wxBitmapFromBits(bits, width, height, | |
189 | depth=-1)}}{Create a bitmap from an array of bits contained in a | |
190 | string.} | |
191 | \twocolitem{{\bf wxBitmapFromImage(image, depth=-1)}}{Convert a | |
192 | wxImage to a wxBitmap.} | |
06d20283 RD |
193 | \end{twocollist}} |
194 | } | |
195 | ||
5873607e VZ |
196 | \perlnote{Constructors supported by wxPerl are:\par |
197 | \begin{itemize} | |
198 | \item{Wx::Bitmap->new( width, height, depth = -1 )} | |
199 | \item{Wx::Bitmap->new( name, type )} | |
200 | \item{Wx::Bitmap->new( icon )} | |
d3f3e857 MB |
201 | \item{Wx::Bitmap->newFromBits( bits, width, height, depth = 1 )} |
202 | \item{Wx::Bitmap->newFromXPM( data )} | |
5873607e VZ |
203 | \end{itemize} |
204 | } | |
205 | ||
f510b7b2 | 206 | \membersection{wxBitmap::\destruct{wxBitmap}}\label{wxbitmapdtor} |
a660d684 KB |
207 | |
208 | \func{}{\destruct{wxBitmap}}{\void} | |
209 | ||
210 | Destroys the wxBitmap object and possibly the underlying bitmap data. | |
211 | Because reference counting is used, the bitmap may not actually be | |
212 | destroyed at this point - only when the reference count is zero will the | |
213 | data be deleted. | |
214 | ||
215 | If the application omits to delete the bitmap explicitly, the bitmap will be | |
fc2171bd | 216 | destroyed automatically by wxWidgets when the application exits. |
a660d684 KB |
217 | |
218 | Do not delete a bitmap that is selected into a memory device context. | |
219 | ||
220 | \membersection{wxBitmap::AddHandler}\label{wxbitmapaddhandler} | |
221 | ||
222 | \func{static void}{AddHandler}{\param{wxBitmapHandler*}{ handler}} | |
223 | ||
224 | Adds a handler to the end of the static list of format handlers. | |
225 | ||
226 | \docparam{handler}{A new bitmap format handler object. There is usually only one instance | |
227 | of a given handler class in an application session.} | |
228 | ||
229 | \wxheading{See also} | |
230 | ||
231 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
232 | ||
f510b7b2 | 233 | \membersection{wxBitmap::CleanUpHandlers}\label{wxbitmapcleanuphandlers} |
a660d684 KB |
234 | |
235 | \func{static void}{CleanUpHandlers}{\void} | |
236 | ||
237 | Deletes all bitmap handlers. | |
238 | ||
fc2171bd | 239 | This function is called by wxWidgets on exit. |
a660d684 | 240 | |
b06a6b20 VS |
241 | \membersection{wxBitmap::ConvertToImage}\label{wxbitmapconverttoimage} |
242 | ||
243 | \func{wxImage}{ConvertToImage}{\void} | |
244 | ||
245 | Creates an image from a platform-dependent bitmap. This preserves | |
246 | mask information so that bitmaps and images can be converted back | |
247 | and forth without loss in that respect. | |
248 | ||
2f930c85 JS |
249 | \membersection{wxBitmap::CopyFromIcon}\label{wxbitmapcopyfromicon} |
250 | ||
251 | \func{bool}{CopyFromIcon}{\param{const wxIcon\&}{ icon}} | |
252 | ||
253 | Creates the bitmap from an icon. | |
254 | ||
c0bcc480 | 255 | \membersection{wxBitmap::Create}\label{wxbitmapcreate} |
a660d684 | 256 | |
eaaa6a06 | 257 | \func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
258 | |
259 | Creates a fresh bitmap. If the final argument is omitted, the display depth of | |
260 | the screen is used. | |
261 | ||
eaaa6a06 | 262 | \func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}} |
a660d684 KB |
263 | |
264 | Creates a bitmap from the given data, which can be of arbitrary type. | |
265 | ||
266 | \wxheading{Parameters} | |
267 | ||
268 | \docparam{width}{The width of the bitmap in pixels.} | |
269 | ||
270 | \docparam{height}{The height of the bitmap in pixels.} | |
271 | ||
272 | \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.} | |
273 | ||
274 | \docparam{data}{Data whose type depends on the value of {\it type}.} | |
275 | ||
f510b7b2 | 276 | \docparam{type}{A bitmap type identifier - see \helpref{wxBitmap::wxBitmap}{wxbitmapctor} for a list |
a660d684 KB |
277 | of possible values.} |
278 | ||
279 | \wxheading{Return value} | |
280 | ||
cc81d32f | 281 | true if the call succeeded, false otherwise. |
a660d684 KB |
282 | |
283 | \wxheading{Remarks} | |
284 | ||
285 | The first form works on all platforms. The portability of the second form depends on the | |
286 | type of data. | |
287 | ||
288 | \wxheading{See also} | |
289 | ||
f510b7b2 | 290 | \helpref{wxBitmap::wxBitmap}{wxbitmapctor} |
a660d684 | 291 | |
f510b7b2 | 292 | \membersection{wxBitmap::FindHandler}\label{wxbitmapfindhandler} |
a660d684 KB |
293 | |
294 | \func{static wxBitmapHandler*}{FindHandler}{\param{const wxString\& }{name}} | |
295 | ||
296 | Finds the handler with the given name. | |
297 | ||
298 | \func{static wxBitmapHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ bitmapType}} | |
299 | ||
300 | Finds the handler associated with the given extension and type. | |
301 | ||
302 | \func{static wxBitmapHandler*}{FindHandler}{\param{long }{bitmapType}} | |
303 | ||
304 | Finds the handler associated with the given bitmap type. | |
305 | ||
306 | \docparam{name}{The handler name.} | |
307 | ||
308 | \docparam{extension}{The file extension, such as ``bmp".} | |
309 | ||
310 | \docparam{bitmapType}{The bitmap type, such as wxBITMAP\_TYPE\_BMP.} | |
311 | ||
312 | \wxheading{Return value} | |
313 | ||
314 | A pointer to the handler if found, NULL otherwise. | |
315 | ||
316 | \wxheading{See also} | |
317 | ||
318 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
319 | ||
f510b7b2 | 320 | \membersection{wxBitmap::GetDepth}\label{wxbitmapgetdepth} |
a660d684 KB |
321 | |
322 | \constfunc{int}{GetDepth}{\void} | |
323 | ||
324 | Gets the colour depth of the bitmap. A value of 1 indicates a | |
325 | monochrome bitmap. | |
326 | ||
f510b7b2 | 327 | \membersection{wxBitmap::GetHandlers}\label{wxbitmapgethandlers} |
a660d684 KB |
328 | |
329 | \func{static wxList\&}{GetHandlers}{\void} | |
330 | ||
331 | Returns the static list of bitmap format handlers. | |
332 | ||
333 | \wxheading{See also} | |
334 | ||
335 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
336 | ||
337 | \membersection{wxBitmap::GetHeight}\label{wxbitmapgetheight} | |
338 | ||
339 | \constfunc{int}{GetHeight}{\void} | |
340 | ||
341 | Gets the height of the bitmap in pixels. | |
342 | ||
343 | \membersection{wxBitmap::GetPalette}\label{wxbitmapgetpalette} | |
344 | ||
345 | \constfunc{wxPalette*}{GetPalette}{\void} | |
346 | ||
347 | Gets the associated palette (if any) which may have been loaded from a file | |
348 | or set for the bitmap. | |
349 | ||
350 | \wxheading{See also} | |
351 | ||
352 | \helpref{wxPalette}{wxpalette} | |
353 | ||
354 | \membersection{wxBitmap::GetMask}\label{wxbitmapgetmask} | |
355 | ||
356 | \constfunc{wxMask*}{GetMask}{\void} | |
357 | ||
1e6d9499 | 358 | Gets the associated mask (if any) which may have been loaded from a file |
a660d684 KB |
359 | or set for the bitmap. |
360 | ||
361 | \wxheading{See also} | |
362 | ||
363 | \helpref{wxBitmap::SetMask}{wxbitmapsetmask}, \helpref{wxMask}{wxmask} | |
364 | ||
365 | \membersection{wxBitmap::GetWidth}\label{wxbitmapgetwidth} | |
366 | ||
367 | \constfunc{int}{GetWidth}{\void} | |
368 | ||
369 | Gets the width of the bitmap in pixels. | |
370 | ||
371 | \wxheading{See also} | |
372 | ||
373 | \helpref{wxBitmap::GetHeight}{wxbitmapgetheight} | |
374 | ||
f9ee644e RR |
375 | \membersection{wxBitmap::GetSubBitmap}\label{wxbitmapgetsubbitmap} |
376 | ||
d17f05af | 377 | \constfunc{wxBitmap}{GetSubBitmap}{\param{const wxRect\&}{rect}} |
f9ee644e | 378 | |
a7c7c154 | 379 | Returns a sub bitmap of the current one as long as the rect belongs entirely to |
f9ee644e RR |
380 | the bitmap. This function preserves bit depth and mask information. |
381 | ||
f510b7b2 | 382 | \membersection{wxBitmap::InitStandardHandlers}\label{wxbitmapinitstandardhandlers} |
a660d684 KB |
383 | |
384 | \func{static void}{InitStandardHandlers}{\void} | |
385 | ||
fc2171bd | 386 | Adds the standard bitmap format handlers, which, depending on wxWidgets |
a660d684 KB |
387 | configuration, can be handlers for Windows bitmap, Windows bitmap resource, and XPM. |
388 | ||
fc2171bd | 389 | This function is called by wxWidgets on startup. |
a660d684 KB |
390 | |
391 | \wxheading{See also} | |
392 | ||
393 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
394 | ||
f510b7b2 | 395 | \membersection{wxBitmap::InsertHandler}\label{wxbitmapinserthandler} |
a660d684 KB |
396 | |
397 | \func{static void}{InsertHandler}{\param{wxBitmapHandler*}{ handler}} | |
398 | ||
399 | Adds a handler at the start of the static list of format handlers. | |
400 | ||
401 | \docparam{handler}{A new bitmap format handler object. There is usually only one instance | |
402 | of a given handler class in an application session.} | |
403 | ||
404 | \wxheading{See also} | |
405 | ||
406 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
407 | ||
408 | \membersection{wxBitmap::LoadFile}\label{wxbitmaploadfile} | |
409 | ||
eaaa6a06 | 410 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type}} |
a660d684 KB |
411 | |
412 | Loads a bitmap from a file or resource. | |
413 | ||
414 | \wxheading{Parameters} | |
415 | ||
416 | \docparam{name}{Either a filename or a Windows resource name. | |
417 | The meaning of {\it name} is determined by the {\it type} parameter.} | |
418 | ||
419 | \docparam{type}{One of the following values: | |
420 | ||
421 | \twocolwidtha{5cm} | |
422 | \begin{twocollist} | |
423 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.} | |
424 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP\_RESOURCE}}{Load a Windows bitmap from the resource database.} | |
425 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.} | |
426 | \twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Load an X bitmap file.} | |
427 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load an XPM bitmap file.} | |
428 | \end{twocollist} | |
429 | ||
fc2171bd | 430 | The validity of these flags depends on the platform and wxWidgets configuration. |
b75dd496 | 431 | |
a7c7c154 | 432 | In addition, wxBitmap can read all formats that \helpref{wxImage}{wximage} can |
b75dd496 VS |
433 | (wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_PNG, wxBITMAP\_TYPE\_GIF, wxBITMAP\_TYPE\_PCX, wxBITMAP\_TYPE\_PNM). |
434 | (Of course you must have wxImage handlers loaded.) } | |
a660d684 KB |
435 | |
436 | \wxheading{Return value} | |
437 | ||
cc81d32f | 438 | true if the operation succeeded, false otherwise. |
a660d684 KB |
439 | |
440 | \wxheading{Remarks} | |
441 | ||
442 | A palette may be associated with the bitmap if one exists (especially for | |
443 | colour Windows bitmaps), and if the code supports it. You can check | |
444 | if one has been created by using the \helpref{GetPalette}{wxbitmapgetpalette} member. | |
445 | ||
446 | \wxheading{See also} | |
447 | ||
448 | \helpref{wxBitmap::SaveFile}{wxbitmapsavefile} | |
449 | ||
450 | \membersection{wxBitmap::Ok}\label{wxbitmapok} | |
451 | ||
452 | \constfunc{bool}{Ok}{\void} | |
453 | ||
cc81d32f | 454 | Returns true if bitmap data is present. |
a660d684 | 455 | |
f510b7b2 | 456 | \membersection{wxBitmap::RemoveHandler}\label{wxbitmapremovehandler} |
a660d684 KB |
457 | |
458 | \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}} | |
459 | ||
460 | Finds the handler with the given name, and removes it. The handler | |
461 | is not deleted. | |
462 | ||
463 | \docparam{name}{The handler name.} | |
464 | ||
465 | \wxheading{Return value} | |
466 | ||
cc81d32f | 467 | true if the handler was found and removed, false otherwise. |
a660d684 KB |
468 | |
469 | \wxheading{See also} | |
470 | ||
471 | \helpref{wxBitmapHandler}{wxbitmaphandler} | |
472 | ||
473 | \membersection{wxBitmap::SaveFile}\label{wxbitmapsavefile} | |
474 | ||
475 | \func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}, \param{wxPalette* }{palette = NULL}} | |
476 | ||
477 | Saves a bitmap in the named file. | |
478 | ||
479 | \wxheading{Parameters} | |
480 | ||
481 | \docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.} | |
482 | ||
483 | \docparam{type}{One of the following values: | |
484 | ||
485 | \twocolwidtha{5cm} | |
486 | \begin{twocollist} | |
487 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a Windows bitmap file.} | |
488 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Save a GIF bitmap file.} | |
489 | \twocolitem{{\bf wxBITMAP\_TYPE\_XBM}}{Save an X bitmap file.} | |
490 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save an XPM bitmap file.} | |
491 | \end{twocollist} | |
492 | ||
fc2171bd | 493 | The validity of these flags depends on the platform and wxWidgets configuration. |
b75dd496 | 494 | |
a7c7c154 | 495 | In addition, wxBitmap can save all formats that \helpref{wxImage}{wximage} can |
b75dd496 VS |
496 | (wxBITMAP\_TYPE\_JPEG, wxBITMAP\_TYPE\_PNG). |
497 | (Of course you must have wxImage handlers loaded.) } | |
a660d684 | 498 | |
5b6aa0ff JS |
499 | \docparam{palette}{An optional palette used for saving the bitmap.} |
500 | % TODO: this parameter should | |
501 | %probably be eliminated; instead the app should set the palette before saving. | |
a660d684 KB |
502 | |
503 | \wxheading{Return value} | |
504 | ||
cc81d32f | 505 | true if the operation succeeded, false otherwise. |
a660d684 KB |
506 | |
507 | \wxheading{Remarks} | |
508 | ||
fc2171bd | 509 | Depending on how wxWidgets has been configured, not all formats may be available. |
a660d684 KB |
510 | |
511 | \wxheading{See also} | |
512 | ||
513 | \helpref{wxBitmap::LoadFile}{wxbitmaploadfile} | |
514 | ||
515 | \membersection{wxBitmap::SetDepth}\label{wxbitmapsetdepth} | |
516 | ||
517 | \func{void}{SetDepth}{\param{int }{depth}} | |
518 | ||
519 | Sets the depth member (does not affect the bitmap data). | |
520 | ||
521 | \wxheading{Parameters} | |
522 | ||
523 | \docparam{depth}{Bitmap depth.} | |
524 | ||
525 | \membersection{wxBitmap::SetHeight}\label{wxbitmapsetheight} | |
526 | ||
527 | \func{void}{SetHeight}{\param{int }{height}} | |
528 | ||
529 | Sets the height member (does not affect the bitmap data). | |
530 | ||
531 | \wxheading{Parameters} | |
532 | ||
533 | \docparam{height}{Bitmap height in pixels.} | |
534 | ||
535 | \membersection{wxBitmap::SetMask}\label{wxbitmapsetmask} | |
536 | ||
537 | \func{void}{SetMask}{\param{wxMask* }{mask}} | |
538 | ||
539 | Sets the mask for this bitmap. | |
540 | ||
541 | \wxheading{Remarks} | |
542 | ||
543 | The bitmap object owns the mask once this has been called. | |
544 | ||
545 | \wxheading{See also} | |
546 | ||
547 | \helpref{wxBitmap::GetMask}{wxbitmapgetmask}, \helpref{wxMask}{wxmask} | |
548 | ||
695e43fa | 549 | %% VZ: this function is an implementation detail and shouldn't be documented |
f510b7b2 | 550 | %%\membersection{wxBitmap::SetOk}\label{wxbitmapsetok} |
695e43fa VZ |
551 | %% |
552 | %%\func{void}{SetOk}{\param{int }{isOk}} | |
553 | %% | |
554 | %%Sets the validity member (does not affect the bitmap data). | |
555 | %% | |
556 | %%\wxheading{Parameters} | |
557 | %% | |
558 | %%\docparam{isOk}{Validity flag.} | |
a660d684 KB |
559 | |
560 | \membersection{wxBitmap::SetPalette}\label{wxbitmapsetpalette} | |
561 | ||
f6bcfd97 | 562 | \func{void}{SetPalette}{\param{const wxPalette\& }{palette}} |
a660d684 | 563 | |
c8e1af67 | 564 | Sets the associated palette. (Not implemented under GTK+). |
a660d684 KB |
565 | |
566 | \wxheading{Parameters} | |
567 | ||
568 | \docparam{palette}{The palette to set.} | |
569 | ||
a660d684 KB |
570 | \wxheading{See also} |
571 | ||
572 | \helpref{wxPalette}{wxpalette} | |
573 | ||
f510b7b2 | 574 | \membersection{wxBitmap::SetWidth}\label{wxbitmapsetwidth} |
a660d684 KB |
575 | |
576 | \func{void}{SetWidth}{\param{int }{width}} | |
577 | ||
578 | Sets the width member (does not affect the bitmap data). | |
579 | ||
580 | \wxheading{Parameters} | |
581 | ||
582 | \docparam{width}{Bitmap width in pixels.} | |
583 | ||
f510b7b2 | 584 | \membersection{wxBitmap::operator $=$}\label{wxbitmapassign} |
a660d684 KB |
585 | |
586 | \func{wxBitmap\& }{operator $=$}{\param{const wxBitmap\& }{bitmap}} | |
587 | ||
588 | Assignment operator. This operator does not copy any data, but instead | |
589 | passes a pointer to the data in {\it bitmap} and increments a reference | |
590 | counter. It is a fast operation. | |
591 | ||
592 | \wxheading{Parameters} | |
593 | ||
594 | \docparam{bitmap}{Bitmap to assign.} | |
595 | ||
596 | \wxheading{Return value} | |
597 | ||
598 | Returns 'this' object. | |
599 | ||
f510b7b2 | 600 | \membersection{wxBitmap::operator $==$}\label{wxbitmapequal} |
a660d684 KB |
601 | |
602 | \func{bool}{operator $==$}{\param{const wxBitmap\& }{bitmap}} | |
603 | ||
604 | Equality operator. This operator tests whether the internal data pointers are | |
605 | equal (a fast test). | |
606 | ||
607 | \wxheading{Parameters} | |
608 | ||
609 | \docparam{bitmap}{Bitmap to compare with 'this'} | |
610 | ||
611 | \wxheading{Return value} | |
612 | ||
cc81d32f | 613 | Returns true if the bitmaps were effectively equal, false otherwise. |
a660d684 | 614 | |
f510b7b2 | 615 | \membersection{wxBitmap::operator $!=$}\label{wxbitmapnotequal} |
a660d684 KB |
616 | |
617 | \func{bool}{operator $!=$}{\param{const wxBitmap\& }{bitmap}} | |
618 | ||
619 | Inequality operator. This operator tests whether the internal data pointers are | |
620 | unequal (a fast test). | |
621 | ||
622 | \wxheading{Parameters} | |
623 | ||
624 | \docparam{bitmap}{Bitmap to compare with 'this'} | |
625 | ||
626 | \wxheading{Return value} | |
627 | ||
cc81d32f | 628 | Returns true if the bitmaps were unequal, false otherwise. |
a660d684 | 629 |