]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/image.tex
added InitAlpha() (replaces patch 991168)
[wxWidgets.git] / docs / latex / wx / image.tex
1 \section{\class{wxImage}}\label{wximage}
2
3 This class encapsulates a platform-independent image. An image can be created
4 from data, or using \helpref{wxBitmap::ConvertToImage}{wxbitmapconverttoimage}. An image
5 can be loaded from a file in a variety of formats, and is extensible to new formats
6 via image format handlers. Functions are available to set and get image bits, so
7 it can be used for basic image manipulation.
8
9 A wxImage cannot (currently) be drawn directly to a \helpref{wxDC}{wxdc}. Instead,
10 a platform-specific \helpref{wxBitmap}{wxbitmap} object must be created from it using
11 the \helpref{wxBitmap::wxBitmap(wxImage,int depth)}{wxbitmapctor} constructor.
12 This bitmap can then
13 be drawn in a device context, using \helpref{wxDC::DrawBitmap}{wxdcdrawbitmap}.
14
15 One colour value of the image may be used as a mask colour which will lead to the automatic
16 creation of a \helpref{wxMask}{wxmask} object associated to the bitmap object.
17
18 \wxheading{Alpha channel support}
19
20 Starting from wxWidgets 2.5.0 wxImage supports alpha channel data, that is in
21 addition to a byte for the red, green and blue colour components for each pixel
22 it also stores a byte representing the pixel opacity. The alpha value of $0$
23 corresponds to a transparent pixel (null opacity) while the value of $255$
24 means that the pixel is 100\% opaque.
25
26 Unlike the RGB data, not all images have the alpha channel and before using
27 \helpref{GetAlpha}{wximagegetalpha} you should check if this image contains
28 alpha value with \helpref{HasAlpha}{wximagehasalpha}. In fact, currently only
29 images loaded from PNG files with transparency information will have alpha
30 channel but support for it will be added to the other formats as well (as well
31 as support for saving images with alpha channel which is not still implemented
32 either).
33
34 \wxheading{Available image handlers}
35
36 The following image handlers are available. {\bf wxBMPHandler} is always
37 installed by default. To use other image formats, install the appropriate
38 handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or
39 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}.
40
41 \twocolwidtha{5cm}%
42 \begin{twocollist}
43 \twocolitem{\indexit{wxBMPHandler}}{For loading and saving, always installed.}
44 \twocolitem{\indexit{wxPNGHandler}}{For loading (including alpha support) and saving.}
45 \twocolitem{\indexit{wxJPEGHandler}}{For loading and saving.}
46 \twocolitem{\indexit{wxGIFHandler}}{Only for loading, due to legal issues.}
47 \twocolitem{\indexit{wxPCXHandler}}{For loading and saving (see below).}
48 \twocolitem{\indexit{wxPNMHandler}}{For loading and saving (see below).}
49 \twocolitem{\indexit{wxTIFFHandler}}{For loading and saving.}
50 \twocolitem{\indexit{wxIFFHandler}}{For loading only.}
51 \twocolitem{\indexit{wxXPMHandler}}{For loading and saving.}
52 \twocolitem{\indexit{wxICOHandler}}{For loading and saving.}
53 \twocolitem{\indexit{wxCURHandler}}{For loading and saving.}
54 \twocolitem{\indexit{wxANIHandler}}{For loading only.}
55 \end{twocollist}
56
57 When saving in PCX format, {\bf wxPCXHandler} will count the number of
58 different colours in the image; if there are 256 or less colours, it will
59 save as 8 bit, else it will save as 24 bit.
60
61 Loading PNMs only works for ASCII or raw RGB images. When saving in
62 PNM format, {\bf wxPNMHandler} will always save as raw RGB.
63
64 \wxheading{Derived from}
65
66 \helpref{wxObject}{wxobject}
67
68 \wxheading{Include files}
69
70 <wx/image.h>
71
72 \wxheading{See also}
73
74 \helpref{wxBitmap}{wxbitmap},
75 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
76
77 \latexignore{\rtfignore{\wxheading{Members}}}
78
79
80 \membersection{wxImage::wxImage}\label{wximagector}
81
82 \func{}{wxImage}{\void}
83
84 Default constructor.
85
86 \func{}{wxImage}{\param{const wxImage\& }{image}}
87
88 Copy constructor.
89
90 \func{}{wxImage}{\param{const wxBitmap\&}{ bitmap}}
91
92 (Deprecated form, use \helpref{wxBitmap::ConvertToImage}{wxbitmapconverttoimage}
93 instead.) Constructs an image from a platform-dependent bitmap. This preserves
94 mask information so that bitmaps and images can be converted back
95 and forth without loss in that respect.
96
97 \func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{bool}{ clear=true}}
98
99 Creates an image with the given width and height. If {\it clear} is true, the new image will be initialized to black.
100 Otherwise, the image data will be uninitialized.
101
102 \func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{unsigned char*}{ data}, \param{bool}{ static\_data=false}}
103
104 Creates an image from given data with the given width and height. If
105 {\it static\_data} is true, then wxImage will not delete the actual
106 image data in its destructor, otherwise it will free it by calling
107 {\it free()}.
108
109 \func{}{wxImage}{\param{const wxString\& }{name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}}
110
111 \func{}{wxImage}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
112
113 Loads an image from a file.
114
115 \func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}}
116
117 \func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
118
119 Loads an image from an input stream.
120
121 \wxheading{Parameters}
122
123 \docparam{width}{Specifies the width of the image.}
124
125 \docparam{height}{Specifies the height of the image.}
126
127 \docparam{name}{Name of the file from which to load the image.}
128
129 \docparam{stream}{Opened input stream from which to load the image. Currently, the stream must support seeking.}
130
131 \docparam{type}{May be one of the following:
132
133 \twocolwidtha{5cm}%
134 \begin{twocollist}
135 \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.}
136 \twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
137 \twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.}
138 \twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.}
139 \twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
140 \twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
141 \twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
142 \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
143 \twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
144 \twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
145 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
146 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
147 \end{twocollist}}
148
149 \docparam{mimetype}{MIME type string (for example 'image/jpeg')}
150
151 \docparam{index}{Index of the image to load in the case that the image file contains multiple images.
152 This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
153 "choose the default image" and is interpreted as the first image (index=0) by
154 the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
155
156 \wxheading{Remarks}
157
158 Depending on how wxWidgets has been configured, not all formats may be available.
159
160 Note: any handler other than BMP must be previously
161 initialized with \helpref{wxImage::AddHandler}{wximageaddhandler} or
162 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}.
163
164 Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
165 hotspot for loaded cursor file:
166 \begin{verbatim}
167 int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
168 int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
169
170 \end{verbatim}
171
172 \wxheading{See also}
173
174 \helpref{wxImage::LoadFile}{wximageloadfile}
175
176 \pythonnote{Constructors supported by wxPython are:\par
177 \indented{2cm}{\begin{twocollist}
178 \twocolitem{{\bf wxImage(name, flag)}}{Loads an image from a file}
179 \twocolitem{{\bf wxNullImage()}}{Create a null image (has no size or
180 image data)}
181 \twocolitem{{\bf wxEmptyImage(width, height)}}{Creates an empty image
182 of the given size}
183 \twocolitem{{\bf wxImageFromMime(name, mimetype}}{Creates an image from
184 the given file of the given mimetype}
185 \twocolitem{{\bf wxImageFromBitmap(bitmap)}}{Creates an image from a
186 platform-dependent bitmap}
187 \end{twocollist}}
188 }
189
190 \perlnote{Constructors supported by wxPerl are:\par
191 \begin{itemize}
192 \item{Wx::Image->new( bitmap )}
193 \item{Wx::Image->new( icon )}
194 \item{Wx::Image->new( width, height )}
195 \item{Wx::Image->new( width, height, data )}
196 \item{Wx::Image->new( file, type, index )}
197 \item{Wx::Image->new( file, mimetype, index )}
198 \item{Wx::Image->new( stream, type, index )}
199 \item{Wx::Image->new( stream, mimetype, index )}
200 \end{itemize}
201 }
202
203
204 \membersection{wxImage::\destruct{wxImage}}\label{wximagedtor}
205
206 \func{}{\destruct{wxImage}}{\void}
207
208 Destructor.
209
210
211 \membersection{wxImage::AddHandler}\label{wximageaddhandler}
212
213 \func{static void}{AddHandler}{\param{wxImageHandler*}{ handler}}
214
215 Adds a handler to the end of the static list of format handlers.
216
217 \docparam{handler}{A new image format handler object. There is usually only one instance
218 of a given handler class in an application session.}
219
220 \wxheading{See also}
221
222 \helpref{wxImageHandler}{wximagehandler}
223
224 \func{bool}{CanRead}{\param{const wxString\&}{ filename}}
225
226 returns true if the current image handlers can read this file
227
228 \pythonnote{In wxPython this static method is named {\tt wxImage\_AddHandler}.}
229
230 \membersection{wxImage::CleanUpHandlers}\label{wximagecleanuphandlers}
231
232 \func{static void}{CleanUpHandlers}{\void}
233
234 Deletes all image handlers.
235
236 This function is called by wxWidgets on exit.
237
238
239 \membersection{wxImage::ComputeHistogram}\label{wximagecomputehistogram}
240
241 \constfunc{unsigned long}{ComputeHistogram}{\param{wxImageHistogram\& }{histogram}}
242
243 Computes the histogram of the image. {\it histogram} is a reference to
244 wxImageHistogram object. wxImageHistogram is a specialization of
245 \helpref{wxHashMap}{wxhashmap} "template" and is defined as follows:
246
247 \begin{verbatim}
248 class WXDLLEXPORT wxImageHistogramEntry
249 {
250 public:
251 wxImageHistogramEntry() : index(0), value(0) {}
252 unsigned long index;
253 unsigned long value;
254 };
255
256 WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry,
257 wxIntegerHash, wxIntegerEqual,
258 wxImageHistogram);
259 \end{verbatim}
260
261 \wxheading{Return value}
262
263 Returns number of colours in the histogram.
264
265
266 \membersection{wxImage::ConvertAlphaToMask}\label{wximageconvertalphatomask}
267
268 \func{bool}{ConvertAlphaToMask}{\param{unsigned char}{ threshold = 128}}
269
270 If the image has alpha channel, this method converts it to mask. All pixels
271 with alpha value less than \arg{threshold} are replaced with mask colour
272 and the alpha channel is removed. Mask colour is chosen automatically using
273 \helpref{FindFirstUnusedColour}{wximagefindfirstunusedcolour}.
274
275 If the image image doesn't have alpha channel,
276 ConvertAlphaToMask does nothing.
277
278 \wxheading{Return value}
279
280 \false if FindFirstUnusedColour returns \false, \true otherwise.
281
282
283 \membersection{wxImage::ConvertToBitmap}\label{wximageconverttobitmap}
284
285 \constfunc{wxBitmap}{ConvertToBitmap}{\void}
286
287 Deprecated, use equivalent \helpref{wxBitmap constructor}{wxbitmapctor}
288 (which takes wxImage and depth as its arguments) instead.
289
290
291 \membersection{wxImage::ConvertToMono}\label{wxbitmapconverttomono}
292
293 \constfunc{wxImage}{ConvertToMono}{\param{unsigned char}{ r}, \param{unsigned char}{ g}, \param{unsigned char}{ b}}
294
295 Returns monochromatic version of the image. The returned image has white
296 colour where the original has {\it (r,g,b)} colour and black colour
297 everywhere else.
298
299
300 \membersection{wxImage::Copy}\label{wximagecopy}
301
302 \constfunc{wxImage}{Copy}{\void}
303
304 Returns an identical copy of the image.
305
306
307 \membersection{wxImage::Create}\label{wximagecreate}
308
309 \func{bool}{Create}{\param{int}{ width}, \param{int}{ height}, \param{bool}{ clear=true}}
310
311 Creates a fresh image. If {\it clear} is true, the new image will be initialized to black.
312 Otherwise, the image data will be uninitialized.
313
314 \wxheading{Parameters}
315
316 \docparam{width}{The width of the image in pixels.}
317
318 \docparam{height}{The height of the image in pixels.}
319
320 \wxheading{Return value}
321
322 true if the call succeeded, false otherwise.
323
324
325 \membersection{wxImage::Destroy}\label{wximagedestroy}
326
327 \func{void}{Destroy}{\void}
328
329 Destroys the image data.
330
331
332 \membersection{wxImage::FindFirstUnusedColour}\label{wximagefindfirstunusedcolour}
333
334 \func{bool}{FindFirstUnusedColour}{\param{unsigned char *}{ r}, \param{unsigned char *}{ g}, \param{unsigned char *}{ b}, \param{unsigned char}{ startR = 1}, \param{unsigned char}{ startG = 0}, \param{unsigned char}{ startB = 0}}
335
336 \wxheading{Parameters}
337
338 \docparam{r,g,b}{Pointers to variables to save the colour.}
339
340 \docparam{startR,startG,startB}{Initial values of the colour. Returned colour
341 will have RGB values equal to or greater than these.}
342
343 Finds the first colour that is never used in the image. The search begins at
344 given initial colour and continues by increasing R, G and B components (in this
345 order) by 1 until an unused colour is found or the colour space exhausted.
346
347 \wxheading{Return value}
348
349 Returns false if there is no unused colour left, true on success.
350
351 \wxheading{Notes}
352
353 Note that this method involves computing the histogram, which is
354 computationally intensive operation.
355
356
357 \membersection{wxImage::FindHandler}\label{wximagefindhandler}
358
359 \func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{name}}
360
361 Finds the handler with the given name.
362
363 \func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ imageType}}
364
365 Finds the handler associated with the given extension and type.
366
367 \func{static wxImageHandler*}{FindHandler}{\param{long }{imageType}}
368
369 Finds the handler associated with the given image type.
370
371 \func{static wxImageHandler*}{FindHandlerMime}{\param{const wxString\& }{mimetype}}
372
373 Finds the handler associated with the given MIME type.
374
375 \docparam{name}{The handler name.}
376
377 \docparam{extension}{The file extension, such as ``bmp".}
378
379 \docparam{imageType}{The image type, such as wxBITMAP\_TYPE\_BMP.}
380
381 \docparam{mimetype}{MIME type.}
382
383 \wxheading{Return value}
384
385 A pointer to the handler if found, NULL otherwise.
386
387 \wxheading{See also}
388
389 \helpref{wxImageHandler}{wximagehandler}
390
391
392 \membersection{wxImage::GetImageExtWildcard}\label{wximagegetimageextwildcard}
393
394 \func{static wxString}{GetImageExtWildcard}{\void}
395
396 Iterates all registered wxImageHandler objects, and returns a string containing file extension masks
397 suitable for passing to file open/save dialog boxes.
398
399 \wxheading{Return value}
400
401 The format of the returned string is "(*.ext1;*.ext2)|*.ext1;*.ext2".
402
403 It is usually a good idea to prepend a description before passing the result to the dialog.
404
405 Example:
406
407 \begin{verbatim}
408 wxFileDialog FileDlg( this, "Choose Image", ::wxGetWorkingDirectory(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxOPEN );
409 \end{verbatim}
410
411 \wxheading{See also}
412
413 \helpref{wxImageHandler}{wximagehandler}
414
415
416 \membersection{wxImage::GetAlpha}\label{wximagegetalpha}
417
418 \constfunc{unsigned char}{GetAlpha}{\param{int}{ x}, \param{int}{ y}}
419
420 Returns the alpha value for the given pixel. This function may only be called
421 for the images with alpha channel, use \helpref{HasAlpha}{wximagehasalpha} to
422 check for this.
423
424 The returned value is the {\it opacity} of the image, i.e. the value of $0$
425 corresponds to the transparent pixels while the value of $255$ -- to the opaque
426 ones.
427
428 \constfunc{unsigned char *}{GetAlpha}{\void}
429
430 Returns pointer to the array storing the alpha values for this image. This
431 pointer is {\tt NULL} for the images without the alpha channel. If the image
432 does have it, this pointer may be used to directly manipulate the alpha values
433 which are stored as the \helpref{RGB}{wximagegetdata} ones.
434
435
436 \membersection{wxImage::GetBlue}\label{wximagegetblue}
437
438 \constfunc{unsigned char}{GetBlue}{\param{int}{ x}, \param{int}{ y}}
439
440 Returns the blue intensity at the given coordinate.
441
442
443 \membersection{wxImage::GetData}\label{wximagegetdata}
444
445 \constfunc{unsigned char*}{GetData}{\void}
446
447 Returns the image data as an array. This is most often used when doing
448 direct image manipulation. The return value points to an array of
449 characters in RGBRGBRGB$\ldots$ format in the top-to-bottom, left-to-right
450 order, that is the first RGB triplet corresponds to the pixel first pixel of
451 the first row, the second one --- to the second pixel of the first row and so
452 on until the end of the first row, with second row following after it and so
453 on.
454
455 You should not delete the returned pointer nor pass it to
456 \helpref{wxImage::SetData}{wximagesetdata}.
457
458
459 \membersection{wxImage::GetGreen}\label{wximagegetgreen}
460
461 \constfunc{unsigned char}{GetGreen}{\param{int}{ x}, \param{int}{ y}}
462
463 Returns the green intensity at the given coordinate.
464
465
466 \membersection{wxImage::GetImageCount}\label{wximagegetimagecount}
467
468 \func{static int}{GetImageCount}{\param{const wxString\&}{ filename}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
469
470 \func{static int}{GetImageCount}{\param{wxInputStream\&}{ stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
471
472 If the image file contains more than one image and the image handler is capable
473 of retrieving these individually, this function will return the number of
474 available images.
475
476 \docparam{name}{Name of the file to query.}
477
478 \docparam{stream}{Opened input stream with image data. Currently, the stream must support seeking.}
479
480 \docparam{type}{May be one of the following:
481
482 \twocolwidtha{5cm}%
483 \begin{twocollist}
484 \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.}
485 \twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
486 \twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.}
487 \twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.}
488 \twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
489 \twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
490 \twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
491 \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
492 \twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
493 \twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
494 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
495 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
496 \end{twocollist}}
497
498 \wxheading{Return value}
499
500 Number of available images. For most image handlers, this is 1 (exceptions
501 are TIFF and ICO formats).
502
503
504 \membersection{wxImage::GetHandlers}\label{wximagegethandlers}
505
506 \func{static wxList\&}{GetHandlers}{\void}
507
508 Returns the static list of image format handlers.
509
510 \wxheading{See also}
511
512 \helpref{wxImageHandler}{wximagehandler}
513
514
515 \membersection{wxImage::GetHeight}\label{wximagegetheight}
516
517 \constfunc{int}{GetHeight}{\void}
518
519 Gets the height of the image in pixels.
520
521
522 \membersection{wxImage::GetMaskBlue}\label{wximagegetmaskblue}
523
524 \constfunc{unsigned char}{GetMaskBlue}{\void}
525
526 Gets the blue value of the mask colour.
527
528
529 \membersection{wxImage::GetMaskGreen}\label{wximagegetmaskgreen}
530
531 \constfunc{unsigned char}{GetMaskGreen}{\void}
532
533 Gets the green value of the mask colour.
534
535
536 \membersection{wxImage::GetMaskRed}\label{wximagegetmaskred}
537
538 \constfunc{unsigned char}{GetMaskRed}{\void}
539
540 Gets the red value of the mask colour.
541
542
543 \membersection{wxImage::GetPalette}\label{wximagegetpalette}
544
545 \constfunc{const wxPalette\&}{GetPalette}{\void}
546
547 Returns the palette associated with the image. Currently the palette is only
548 used when converting to wxBitmap under Windows.
549
550 Eventually wxImage handlers will set the palette if one exists in the image file.
551
552
553 \membersection{wxImage::GetRed}\label{wximagegetred}
554
555 \constfunc{unsigned char}{GetRed}{\param{int}{ x}, \param{int}{ y}}
556
557 Returns the red intensity at the given coordinate.
558
559
560 \membersection{wxImage::GetSubImage}\label{wximagegetsubimage}
561
562 \constfunc{wxImage}{GetSubImage}{\param{const wxRect\&}{ rect}}
563
564 Returns a sub image of the current one as long as the rect belongs entirely to
565 the image.
566
567
568 \membersection{wxImage::GetWidth}\label{wximagegetwidth}
569
570 \constfunc{int}{GetWidth}{\void}
571
572 Gets the width of the image in pixels.
573
574 \wxheading{See also}
575
576 \helpref{wxImage::GetHeight}{wximagegetheight}
577
578
579 \membersection{wxImage::HasAlpha}\label{wximagehasalpha}
580
581 \constfunc{bool}{HasAlpha}{\void}
582
583 Returns true if this image has alpha channel, false otherwise.
584
585 \wxheading{See also}
586
587 \helpref{GetAlpha}{wximagegetalpha}, \helpref{SetAlpha}{wximagesetalpha}
588
589
590 \membersection{wxImage::HasMask}\label{wximagehasmask}
591
592 \constfunc{bool}{HasMask}{\void}
593
594 Returns true if there is a mask active, false otherwise.
595
596
597 \membersection{wxImage::GetOption}\label{wximagegetoption}
598
599 \constfunc{wxString}{GetOption}{\param{const wxString\&}{ name}}
600
601 Gets a user-defined option. The function is case-insensitive to {\it name}.
602
603 For example, when saving as a JPEG file, the option {\bf quality} is
604 used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
605
606 \wxheading{See also}
607
608 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
609 \helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
610 \helpref{wxImage::HasOption}{wximagehasoption}
611
612
613 \membersection{wxImage::GetOptionInt}\label{wximagegetoptionint}
614
615 \constfunc{int}{GetOptionInt}{\param{const wxString\&}{ name}}
616
617 Gets a user-defined option as an integer. The function is case-insensitive to {\it name}.
618
619 If the given option is not present, the function returns $0$. Use
620 \helpref{wxImage::HasOption}{wximagehasoption} is $0$ is a possibly valid value
621 for the option.
622
623 \wxheading{See also}
624
625 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
626 \helpref{wxImage::GetOption}{wximagegetoption}
627
628
629 \membersection{wxImage::HasOption}\label{wximagehasoption}
630
631 \constfunc{bool}{HasOption}{\param{const wxString\&}{ name}}
632
633 Returns true if the given option is present. The function is case-insensitive to {\it name}.
634
635 \wxheading{See also}
636
637 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
638 \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
639 \helpref{wxImage::GetOptionInt}{wximagegetoptionint}
640
641
642 \membersection{wxImage::InitAlpha}\label{wximageinitalpha}
643
644 \func{void}{InitAlpha}{\void}
645
646 Initializes the image alpha channel data. It is an error to call it
647 if the image already has alpha data. If it doesn't, alpha data will be
648 by default initialized to all pixels being fully opaque. But if the image has a
649 a mask colour, all mask pixels will be completely transparent.
650
651
652 \membersection{wxImage::InitStandardHandlers}\label{wximageinitstandardhandlers}
653
654 \func{static void}{InitStandardHandlers}{\void}
655
656 Internal use only. Adds standard image format handlers. It only install BMP
657 for the time being, which is used by wxBitmap.
658
659 This function is called by wxWidgets on startup, and shouldn't be called by
660 the user.
661
662 \wxheading{See also}
663
664 \helpref{wxImageHandler}{wximagehandler},
665 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
666
667
668 \membersection{wxImage::InsertHandler}\label{wximageinserthandler}
669
670 \func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}}
671
672 Adds a handler at the start of the static list of format handlers.
673
674 \docparam{handler}{A new image format handler object. There is usually only one instance
675 of a given handler class in an application session.}
676
677 \wxheading{See also}
678
679 \helpref{wxImageHandler}{wximagehandler}
680
681
682 \membersection{wxImage::LoadFile}\label{wximageloadfile}
683
684 \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}}
685
686 \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
687
688 Loads an image from a file. If no handler type is provided, the library will
689 try to autodetect the format.
690
691 \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}, \param{int}{ index = -1}}
692
693 \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
694
695 Loads an image from an input stream.
696
697 \wxheading{Parameters}
698
699 \docparam{name}{Name of the file from which to load the image.}
700
701 \docparam{stream}{Opened input stream from which to load the image. Currently, the stream must support seeking.}
702
703 \docparam{type}{One of the following values:
704
705 \twocolwidtha{5cm}%
706 \begin{twocollist}
707 \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.}
708 \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF image file.}
709 \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Load a JPEG image file.}
710 \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Load a PCX image file.}
711 \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.}
712 \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.}
713 \twocolitem{{\bf wxBITMAP\_TYPE\_TIF}}{Load a TIFF image file.}
714 \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load a XPM image file.}
715 \twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
716 \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
717 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
718 \twocolitem{{\bf wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
719 \end{twocollist}}
720
721 \docparam{mimetype}{MIME type string (for example 'image/jpeg')}
722
723 \docparam{index}{Index of the image to load in the case that the image file contains multiple images.
724 This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
725 "choose the default image" and is interpreted as the first image (index=0) by
726 the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
727
728 \wxheading{Remarks}
729
730 Depending on how wxWidgets has been configured, not all formats may be available.
731
732 Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
733 hotspot for loaded cursor file:
734 \begin{verbatim}
735 int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
736 int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
737
738 \end{verbatim}
739
740 \wxheading{Return value}
741
742 true if the operation succeeded, false otherwise. If the optional index parameter is out of range,
743 false is returned and a call to wxLogError() takes place.
744
745 \wxheading{See also}
746
747 \helpref{wxImage::SaveFile}{wximagesavefile}
748
749 \pythonnote{In place of a single overloaded method name, wxPython
750 implements the following methods:\par
751 \indented{2cm}{\begin{twocollist}
752 \twocolitem{{\bf LoadFile(filename, type)}}{Loads an image of the given
753 type from a file}
754 \twocolitem{{\bf LoadMimeFile(filename, mimetype)}}{Loads an image of the given
755 mimetype from a file}
756 \end{twocollist}}
757 }
758
759 \perlnote{Methods supported by wxPerl are:\par
760 \begin{itemize}
761 \item{bitmap->LoadFile( name, type )}
762 \item{bitmap->LoadFile( name, mimetype )}
763 \end{itemize}
764 }
765
766
767
768 \membersection{wxImage::Ok}\label{wximageok}
769
770 \constfunc{bool}{Ok}{\void}
771
772 Returns true if image data is present.
773
774
775 \membersection{wxImage::RemoveHandler}\label{wximageremovehandler}
776
777 \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}}
778
779 Finds the handler with the given name, and removes it. The handler
780 is not deleted.
781
782 \docparam{name}{The handler name.}
783
784 \wxheading{Return value}
785
786 true if the handler was found and removed, false otherwise.
787
788 \wxheading{See also}
789
790 \helpref{wxImageHandler}{wximagehandler}
791
792
793 \membersection{wxImage::Mirror}\label{wximagemirror}
794
795 \constfunc{wxImage}{Mirror}{\param{bool}{ horizontally = true}}
796
797 Returns a mirrored copy of the image. The parameter {\it horizontally}
798 indicates the orientation.
799
800
801 \membersection{wxImage::Replace}\label{wximagereplace}
802
803 \func{void}{Replace}{\param{unsigned char}{ r1}, \param{unsigned char}{ g1}, \param{unsigned char}{ b1},
804 \param{unsigned char}{ r2}, \param{unsigned char}{ g2}, \param{unsigned char}{ b2}}
805
806 Replaces the colour specified by {\it r1,g1,b1} by the colour {\it r2,g2,b2}.
807
808
809 \membersection{wxImage::Rescale}\label{wximagerescale}
810
811 \func{wxImage \&}{Rescale}{\param{int}{ width}, \param{int}{ height}}
812
813 Changes the size of the image in-place: after a call to this function, the
814 image will have the given width and height.
815
816 Returns the (modified) image itself.
817
818 \wxheading{See also}
819
820 \helpref{Scale}{wximagescale}
821
822
823 \membersection{wxImage::Rotate}\label{wximagerotate}
824
825 \func{wxImage}{Rotate}{\param{double}{ angle}, \param{const wxPoint\& }{rotationCentre},
826 \param{bool}{ interpolating = true}, \param{wxPoint*}{ offsetAfterRotation = NULL}}
827
828 Rotates the image about the given point, by {\it angle} radians. Passing true
829 to {\it interpolating} results in better image quality, but is slower. If the
830 image has a mask, then the mask colour is used for the uncovered pixels in the
831 rotated image background. Else, black (rgb 0, 0, 0) will be used.
832
833 Returns the rotated image, leaving this image intact.
834
835
836 \membersection{wxImage::Rotate90}\label{wximagerotate90}
837
838 \constfunc{wxImage}{Rotate90}{\param{bool}{ clockwise = true}}
839
840 Returns a copy of the image rotated 90 degrees in the direction
841 indicated by {\it clockwise}.
842
843
844 \membersection{wxImage::SaveFile}\label{wximagesavefile}
845
846 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}}
847
848 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}}
849
850 Saves an image in the named file.
851
852 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}}
853
854 Saves an image in the named file. File type is determined from the extension of the
855 file name. Note that this function may fail if the extension is not recognized! You
856 can use one of the forms above to save images to files with non-standard extensions.
857
858 \constfunc{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int}{ type}}
859
860 \constfunc{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{const wxString\&}{ mimetype}}
861
862 Saves an image in the given stream.
863
864 \wxheading{Parameters}
865
866 \docparam{name}{Name of the file to save the image to.}
867
868 \docparam{stream}{Opened output stream to save the image to.}
869
870 \docparam{type}{Currently these types can be used:
871
872 \twocolwidtha{5cm}%
873 \begin{twocollist}
874 \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a BMP image file.}
875 \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Save a JPEG image file.}
876 \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.}
877 \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Save a PCX image file (tries to save as 8-bit if possible, falls back to 24-bit otherwise).}
878 \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Save a PNM image file (as raw RGB always).}
879 \twocolitem{{\bf wxBITMAP\_TYPE\_TIFF}}{Save a TIFF image file.}
880 \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save a XPM image file.}
881 \twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Save a Windows icon file (ICO) (the size may be up to 255 wide by 127 high. A single image is saved in 8 colors at the size supplied).}
882 \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Save a Windows cursor file (CUR).}
883 \end{twocollist}}
884
885 \docparam{mimetype}{MIME type.}
886
887 \wxheading{Return value}
888
889 true if the operation succeeded, false otherwise.
890
891 \wxheading{Remarks}
892
893 Depending on how wxWidgets has been configured, not all formats may be available.
894
895 Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to set the
896 hotspot before saving an image into a cursor file (default hotspot is in
897 the centre of the image):
898 \begin{verbatim}
899 image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotspotX);
900 image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotspotY);
901
902 \end{verbatim}
903
904 \wxheading{See also}
905
906 \helpref{wxImage::LoadFile}{wximageloadfile}
907
908 \pythonnote{In place of a single overloaded method name, wxPython
909 implements the following methods:\par
910 \indented{2cm}{\begin{twocollist}
911 \twocolitem{{\bf SaveFile(filename, type)}}{Saves the image using the given
912 type to the named file}
913 \twocolitem{{\bf SaveMimeFile(filename, mimetype)}}{Saves the image using the given
914 mimetype to the named file}
915 \end{twocollist}}
916 }
917
918 \perlnote{Methods supported by wxPerl are:\par
919 \begin{itemize}
920 \item{bitmap->SaveFile( name, type )}
921 \item{bitmap->SaveFile( name, mimetype )}
922 \end{itemize}
923 }
924
925
926 \membersection{wxImage::Scale}\label{wximagescale}
927
928 \constfunc{wxImage}{Scale}{\param{int}{ width}, \param{int}{ height}}
929
930 Returns a scaled version of the image. This is also useful for
931 scaling bitmaps in general as the only other way to scale bitmaps
932 is to blit a wxMemoryDC into another wxMemoryDC.
933
934 It may be mentioned that the GTK port uses this function internally
935 to scale bitmaps when using mapping modes in wxDC.
936
937 Example:
938
939 \begin{verbatim}
940 // get the bitmap from somewhere
941 wxBitmap bmp = ...;
942
943 // rescale it to have size of 32*32
944 if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 )
945 {
946 wxImage image = bmp.ConvertToImage();
947 bmp = wxBitmap(image.Scale(32, 32));
948
949 // another possibility:
950 image.Rescale(32, 32);
951 bmp = image;
952 }
953
954 \end{verbatim}
955
956 \wxheading{See also}
957
958 \helpref{Rescale}{wximagerescale}
959
960
961 \membersection{wxImage::SetAlpha}\label{wximagesetalpha}
962
963 \func{void}{SetAlpha}{\param{unsigned char *}{alpha = {\tt NULL}}}
964
965 This function is similar to \helpref{SetData}{wximagesetdata} and has similar
966 restrictions. The pointer passed to it may however be {\tt NULL} in which case
967 the function will allocate the alpha array internally -- this is useful to add
968 alpha channel data to an image which doesn't have any. If the pointer is not
969 {\tt NULL}, it must have one byte for each image pixel and be allocated with
970 {\tt malloc()}. wxImage takes ownership of the pointer and will free it.
971
972 \func{void}{SetAlpha}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{alpha}}
973
974 Sets the alpha value for the given pixel. This function should only be called
975 if the image has alpha channel data, use \helpref{HasAlpha}{wximagehasalpha} to
976 check for this.
977
978
979 \membersection{wxImage::SetData}\label{wximagesetdata}
980
981 \func{void}{SetData}{\param{unsigned char*}{data}}
982
983 Sets the image data without performing checks. The data given must have
984 the size (width*height*3) or results will be unexpected. Don't use this
985 method if you aren't sure you know what you are doing.
986
987 The data must have been allocated with {\tt malloc()}, {\large {\bf NOT}} with
988 {\tt operator new}.
989
990 After this call the pointer to the data is owned by the wxImage object,
991 that will be responsible for deleting it.
992 Do not pass to this function a pointer obtained through
993 \helpref{wxImage::GetData}{wximagegetdata}.
994
995
996 \membersection{wxImage::SetMask}\label{wximagesetmask}
997
998 \func{void}{SetMask}{\param{bool}{ hasMask = true}}
999
1000 Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.
1001
1002
1003 \membersection{wxImage::SetMaskColour}\label{wximagesetmaskcolour}
1004
1005 \func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1006
1007 Sets the mask colour for this image (and tells the image to use the mask).
1008
1009
1010 \membersection{wxImage::SetMaskFromImage}\label{wximagesetmaskfromimage}
1011
1012 \func{bool}{SetMaskFromImage}{\param{const wxImage\&}{ mask}, \param{unsigned char}{ mr}, \param{unsigned char}{ mg}, \param{unsigned char}{ mb}}
1013
1014 \wxheading{Parameters}
1015
1016 \docparam{mask}{The mask image to extract mask shape from. Must have same dimensions as the image.}
1017
1018 \docparam{mr,mg,mb}{RGB value of pixels in {\it mask} that will be used to create the mask.}
1019
1020 Sets image's mask so that the pixels that have RGB value of {\it mr,mg,mb}
1021 in {\it mask} will be masked in the image. This is done by first finding an
1022 unused colour in the image, setting this colour as the mask colour and then
1023 using this colour to draw all pixels in the image who corresponding pixel
1024 in {\it mask} has given RGB value.
1025
1026 \wxheading{Return value}
1027
1028 Returns false if {\it mask} does not have same dimensions as the image or if
1029 there is no unused colour left. Returns true if the mask was successfully
1030 applied.
1031
1032 \wxheading{Notes}
1033
1034 Note that this method involves computing the histogram, which is
1035 computationally intensive operation.
1036
1037
1038 \membersection{wxImage::SetOption}\label{wximagesetoption}
1039
1040 \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{const wxString\&}{ value}}
1041
1042 \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{int}{ value}}
1043
1044 Sets a user-defined option. The function is case-insensitive to {\it name}.
1045
1046 For example, when saving as a JPEG file, the option {\bf quality} is
1047 used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
1048
1049 \wxheading{See also}
1050
1051 \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
1052 \helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
1053 \helpref{wxImage::HasOption}{wximagehasoption}
1054
1055
1056 \membersection{wxImage::SetPalette}\label{wximagesetpalette}
1057
1058 \func{void}{SetPalette}{\param{const wxPalette\&}{ palette}}
1059
1060 Associates a palette with the image. The palette may be used when converting
1061 wxImage to wxBitmap (MSW only at present) or in file save operations (none as yet).
1062
1063
1064 \membersection{wxImage::SetRGB}\label{wximagesetrgb}
1065
1066 \func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1067
1068 Sets the pixel at the given coordinate. This routine performs bounds-checks
1069 for the coordinate so it can be considered a safe way to manipulate the
1070 data, but in some cases this might be too slow so that the data will have to
1071 be set directly. In that case you will have to get access to the image data
1072 using the \helpref{GetData}{wximagegetdata} method.
1073
1074
1075 \membersection{wxImage::operator $=$}\label{wximageassign}
1076
1077 \func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}
1078
1079 Assignment operator. This operator does not copy any data, but instead
1080 passes a pointer to the data in {\it image} and increments a reference
1081 counter. It is a fast operation.
1082
1083 \wxheading{Parameters}
1084
1085 \docparam{image}{Image to assign.}
1086
1087 \wxheading{Return value}
1088
1089 Returns 'this' object.
1090
1091
1092 \membersection{wxImage::operator $==$}\label{wximageequal}
1093
1094 \constfunc{bool}{operator $==$}{\param{const wxImage\& }{image}}
1095
1096 Equality operator. This operator tests whether the internal data pointers are
1097 equal (a fast test).
1098
1099 \wxheading{Parameters}
1100
1101 \docparam{image}{Image to compare with 'this'}
1102
1103 \wxheading{Return value}
1104
1105 Returns true if the images were effectively equal, false otherwise.
1106
1107
1108 \membersection{wxImage::operator $!=$}\label{wximagenotequal}
1109
1110 \constfunc{bool}{operator $!=$}{\param{const wxImage\& }{image}}
1111
1112 Inequality operator. This operator tests whether the internal data pointers are
1113 unequal (a fast test).
1114
1115 \wxheading{Parameters}
1116
1117 \docparam{image}{Image to compare with 'this'}
1118
1119 \wxheading{Return value}
1120
1121 Returns true if the images were unequal, false otherwise.
1122
1123 \section{\class{wxImageHandler}}\label{wximagehandler}
1124
1125 This is the base class for implementing image file loading/saving, and image creation from data.
1126 It is used within wxImage and is not normally seen by the application.
1127
1128 If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler
1129 and add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in your
1130 application initialisation.
1131
1132 \wxheading{Note (Legal Issue)}
1133
1134 This software is based in part on the work of the Independent JPEG Group.
1135
1136 (Applies when wxWidgets is linked with JPEG support. wxJPEGHandler uses libjpeg
1137 created by IJG.)
1138
1139 \wxheading{Derived from}
1140
1141 \helpref{wxObject}{wxobject}
1142
1143 \wxheading{Include files}
1144
1145 <wx/image.h>
1146
1147 \wxheading{See also}
1148
1149 \helpref{wxImage}{wximage},
1150 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
1151
1152 \latexignore{\rtfignore{\wxheading{Members}}}
1153
1154
1155 \membersection{wxImageHandler::wxImageHandler}\label{wximagehandlerctor}
1156
1157 \func{}{wxImageHandler}{\void}
1158
1159 Default constructor. In your own default constructor, initialise the members
1160 m\_name, m\_extension and m\_type.
1161
1162
1163 \membersection{wxImageHandler::\destruct{wxImageHandler}}\label{wximagehandlerdtor}
1164
1165 \func{}{\destruct{wxImageHandler}}{\void}
1166
1167 Destroys the wxImageHandler object.
1168
1169
1170 \membersection{wxImageHandler::GetName}\label{wximagehandlergetname}
1171
1172 \constfunc{wxString}{GetName}{\void}
1173
1174 Gets the name of this handler.
1175
1176
1177 \membersection{wxImageHandler::GetExtension}\label{wximagehandlergetextension}
1178
1179 \constfunc{wxString}{GetExtension}{\void}
1180
1181 Gets the file extension associated with this handler.
1182
1183
1184 \membersection{wxImageHandler::GetImageCount}\label{wximagehandlergetimagecount}
1185
1186 \func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}}
1187
1188 If the image file contains more than one image and the image handler is capable
1189 of retrieving these individually, this function will return the number of
1190 available images.
1191
1192 \docparam{stream}{Opened input stream for reading image data. Currently, the stream must support seeking.}
1193
1194 \wxheading{Return value}
1195
1196 Number of available images. For most image handlers, this is 1 (exceptions
1197 are TIFF and ICO formats).
1198
1199
1200 \membersection{wxImageHandler::GetType}\label{wximagehandlergettype}
1201
1202 \constfunc{long}{GetType}{\void}
1203
1204 Gets the image type associated with this handler.
1205
1206
1207 \membersection{wxImageHandler::GetMimeType}\label{wximagehandlergetmimetype}
1208
1209 \constfunc{wxString}{GetMimeType}{\void}
1210
1211 Gets the MIME type associated with this handler.
1212
1213
1214 \membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile}
1215
1216 \func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}, \param{bool}{ verbose=true}, \param{int}{ index=0}}
1217
1218 Loads a image from a stream, putting the resulting data into {\it image}. If the image file contains
1219 more than one image and the image handler is capable of retrieving these individually, {\it index}
1220 indicates which image to read from the stream.
1221
1222 \wxheading{Parameters}
1223
1224 \docparam{image}{The image object which is to be affected by this operation.}
1225
1226 \docparam{stream}{Opened input stream for reading image data.}
1227
1228 \docparam{verbose}{If set to true, errors reported by the image handler will produce wxLogMessages.}
1229
1230 \docparam{index}{The index of the image in the file (starting from zero).}
1231
1232 \wxheading{Return value}
1233
1234 true if the operation succeeded, false otherwise.
1235
1236 \wxheading{See also}
1237
1238 \helpref{wxImage::LoadFile}{wximageloadfile},
1239 \helpref{wxImage::SaveFile}{wximagesavefile},
1240 \helpref{wxImageHandler::SaveFile}{wximagehandlersavefile}
1241
1242
1243 \membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile}
1244
1245 \func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}}
1246
1247 Saves a image in the output stream.
1248
1249 \wxheading{Parameters}
1250
1251 \docparam{image}{The image object which is to be affected by this operation.}
1252
1253 \docparam{stream}{Opened output stream for writing the data.}
1254
1255 \wxheading{Return value}
1256
1257 true if the operation succeeded, false otherwise.
1258
1259 \wxheading{See also}
1260
1261 \helpref{wxImage::LoadFile}{wximageloadfile},
1262 \helpref{wxImage::SaveFile}{wximagesavefile},
1263 \helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile}
1264
1265
1266 \membersection{wxImageHandler::SetName}\label{wximagehandlersetname}
1267
1268 \func{void}{SetName}{\param{const wxString\& }{name}}
1269
1270 Sets the handler name.
1271
1272 \wxheading{Parameters}
1273
1274 \docparam{name}{Handler name.}
1275
1276
1277 \membersection{wxImageHandler::SetExtension}\label{wximagehandlersetextension}
1278
1279 \func{void}{SetExtension}{\param{const wxString\& }{extension}}
1280
1281 Sets the handler extension.
1282
1283 \wxheading{Parameters}
1284
1285 \docparam{extension}{Handler extension.}
1286
1287
1288 \membersection{wxImageHandler::SetMimeType}\label{wximagehandlersetmimetype}
1289
1290 \func{void}{SetMimeType}{\param{const wxString\& }{mimetype}}
1291
1292 Sets the handler MIME type.
1293
1294 \wxheading{Parameters}
1295
1296 \docparam{mimename}{Handler MIME type.}
1297
1298
1299 \membersection{wxImageHandler::SetType}\label{wximagehandlersettype}
1300
1301 \func{void}{SetType}{\param{long }{type}}
1302
1303 Sets the handler type.
1304
1305 \wxheading{Parameters}
1306
1307 \docparam{name}{Handler type.}
1308