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