1 \section{\class{wxImage
}}\label{wximage
}
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.
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.
13 be drawn in a device context, using
\helpref{wxDC::DrawBitmap
}{wxdcdrawbitmap
}.
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.
18 \wxheading{Alpha channel support
}
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. An alpha value of $
0$
23 corresponds to a transparent pixel (null opacity) while a value of $
255$
24 means that the pixel is
100\% opaque.
26 Unlike RGB data, not all images have an alpha channel and before using
27 \helpref{GetAlpha
}{wximagegetalpha
} you should check if this image contains
28 an alpha channel with
\helpref{HasAlpha
}{wximagehasalpha
}. Note that currently only
29 images loaded from PNG files with transparency information will have an alpha
30 channel but alpha support will be added to the other formats as well (as well
31 as support for saving images with alpha channel which also isn't implemented).
33 \wxheading{Available image handlers
}
35 The following image handlers are available.
{\bf wxBMPHandler
} is always
36 installed by default. To use other image formats, install the appropriate
37 handler with
\helpref{wxImage::AddHandler
}{wximageaddhandler
} or
38 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}.
42 \twocolitem{\indexit{wxBMPHandler
}}{For loading and saving, always installed.
}
43 \twocolitem{\indexit{wxPNGHandler
}}{For loading (including alpha support) and saving.
}
44 \twocolitem{\indexit{wxJPEGHandler
}}{For loading and saving.
}
45 \twocolitem{\indexit{wxGIFHandler
}}{Only for loading, due to legal issues.
}
46 \twocolitem{\indexit{wxPCXHandler
}}{For loading and saving (see below).
}
47 \twocolitem{\indexit{wxPNMHandler
}}{For loading and saving (see below).
}
48 \twocolitem{\indexit{wxTIFFHandler
}}{For loading and saving.
}
49 \twocolitem{\indexit{wxIFFHandler
}}{For loading only.
}
50 \twocolitem{\indexit{wxXPMHandler
}}{For loading and saving.
}
51 \twocolitem{\indexit{wxICOHandler
}}{For loading and saving.
}
52 \twocolitem{\indexit{wxCURHandler
}}{For loading and saving.
}
53 \twocolitem{\indexit{wxANIHandler
}}{For loading only.
}
56 When saving in PCX format,
{\bf wxPCXHandler
} will count the number of
57 different colours in the image; if there are
256 or less colours, it will
58 save as
8 bit, else it will save as
24 bit.
60 Loading PNMs only works for ASCII or raw RGB images. When saving in
61 PNM format,
{\bf wxPNMHandler
} will always save as raw RGB.
63 \wxheading{Derived from
}
65 \helpref{wxObject
}{wxobject
}
67 \wxheading{Include files
}
73 \helpref{wxBitmap
}{wxbitmap
},
74 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}
76 \latexignore{\rtfignore{\wxheading{Members
}}}
79 \membersection{wxImage::wxImage
}\label{wximagector
}
81 \func{}{wxImage
}{\void}
85 \func{}{wxImage
}{\param{const wxImage\&
}{image
}}
89 \func{}{wxImage
}{\param{const wxBitmap\&
}{ bitmap
}}
91 (Deprecated form, use
\helpref{wxBitmap::ConvertToImage
}{wxbitmapconverttoimage
}
92 instead.) Constructs an image from a platform-dependent bitmap. This preserves
93 mask information so that bitmaps and images can be converted back
94 and forth without loss in that respect.
96 \func{}{wxImage
}{\param{int
}{ width
},
\param{int
}{ height
},
\param{bool
}{ clear=true
}}
98 Creates an image with the given width and height. If
{\it clear
} is true, the new image will be initialized to black.
99 Otherwise, the image data will be uninitialized.
101 \func{}{wxImage
}{\param{int
}{ width
},
\param{int
}{ height
},
\param{unsigned char*
}{ data
},
\param{bool
}{ static
\_data =
\false}}
103 Creates an image from given data with the given width and height. If
104 {\it static
\_data} is true, then wxImage will not delete the actual
105 image data in its destructor, otherwise it will free it by calling
108 \func{}{wxImage
}{\param{const wxString\&
}{name
},
\param{long
}{ type = wxBITMAP
\_TYPE\_ANY},
\param{int
}{ index = -
1}}
110 \func{}{wxImage
}{\param{const wxString\&
}{name
},
\param{const wxString\&
}{ mimetype
},
\param{int
}{ index = -
1}}
112 Loads an image from a file.
114 \func{}{wxImage
}{\param{wxInputStream\&
}{stream
},
\param{long
}{ type = wxBITMAP
\_TYPE\_ANY},
\param{int
}{ index = -
1}}
116 \func{}{wxImage
}{\param{wxInputStream\&
}{stream
},
\param{const wxString\&
}{ mimetype
},
\param{int
}{ index = -
1}}
118 Loads an image from an input stream.
120 \func{}{wxImage
}{\param{const char**
}{xpmData
}}
122 Creates an image from XPM data.
124 \wxheading{Parameters
}
126 \docparam{width
}{Specifies the width of the image.
}
128 \docparam{height
}{Specifies the height of the image.
}
130 \docparam{name
}{Name of the file from which to load the image.
}
132 \docparam{stream
}{Opened input stream from which to load the image. Currently, the stream must support seeking.
}
134 \docparam{type
}{May be one of the following:
138 \twocolitem{\indexit{wxBITMAP
\_TYPE\_BMP}}{Load a Windows bitmap file.
}
139 \twocolitem{\indexit{wxBITMAP
\_TYPE\_GIF}}{Load a GIF bitmap file.
}
140 \twocolitem{\indexit{wxBITMAP
\_TYPE\_JPEG}}{Load a JPEG bitmap file.
}
141 \twocolitem{\indexit{wxBITMAP
\_TYPE\_PNG}}{Load a PNG bitmap file.
}
142 \twocolitem{\indexit{wxBITMAP
\_TYPE\_PCX}}{Load a PCX bitmap file.
}
143 \twocolitem{\indexit{wxBITMAP
\_TYPE\_PNM}}{Load a PNM bitmap file.
}
144 \twocolitem{\indexit{wxBITMAP
\_TYPE\_TIF}}{Load a TIFF bitmap file.
}
145 \twocolitem{\indexit{wxBITMAP
\_TYPE\_XPM}}{Load a XPM bitmap file.
}
146 \twocolitem{\indexit{wxBITMAP
\_TYPE\_ICO}}{Load a Windows icon file (ICO).
}
147 \twocolitem{\indexit{wxBITMAP
\_TYPE\_CUR}}{Load a Windows cursor file (CUR).
}
148 \twocolitem{\indexit{wxBITMAP
\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).
}
149 \twocolitem{\indexit{wxBITMAP
\_TYPE\_ANY}}{Will try to autodetect the format.
}
152 \docparam{mimetype
}{MIME type string (for example 'image/jpeg')
}
154 \docparam{index
}{Index of the image to load in the case that the image file contains multiple images.
155 This is only used by GIF, ICO and TIFF handlers. The default value (-
1) means
156 "choose the default image" and is interpreted as the first image (index=
0) by
157 the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.
}
159 \docparam{xpmData
}{A pointer to XPM image data.
}
163 Depending on how wxWidgets has been configured, not all formats may be available.
165 Note: any handler other than BMP must be previously
166 initialized with
\helpref{wxImage::AddHandler
}{wximageaddhandler
} or
167 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}.
169 Note: you can use
\helpref{GetOptionInt
}{wximagegetoptionint
} to get the
170 hotspot for loaded cursor file:
172 int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
173 int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
179 \helpref{wxImage::LoadFile
}{wximageloadfile
}
181 \pythonnote{Constructors supported by wxPython are:
\par
182 \indented{2cm
}{\begin{twocollist
}
183 \twocolitem{{\bf wxImage(name, flag)
}}{Loads an image from a file
}
184 \twocolitem{{\bf wxNullImage()
}}{Create a null image (has no size or
186 \twocolitem{{\bf wxEmptyImage(width, height)
}}{Creates an empty image
188 \twocolitem{{\bf wxImageFromMime(name, mimetype
}}{Creates an image from
189 the given file of the given mimetype
}
190 \twocolitem{{\bf wxImageFromBitmap(bitmap)
}}{Creates an image from a
191 platform-dependent bitmap
}
195 \perlnote{Constructors supported by wxPerl are:
\par
197 \item{Wx::Image->new( bitmap )
}
198 \item{Wx::Image->new( icon )
}
199 \item{Wx::Image->new( width, height )
}
200 \item{Wx::Image->new( width, height, data )
}
201 \item{Wx::Image->new( file, type, index )
}
202 \item{Wx::Image->new( file, mimetype, index )
}
203 \item{Wx::Image->new( stream, type, index )
}
204 \item{Wx::Image->new( stream, mimetype, index )
}
209 \membersection{wxImage::
\destruct{wxImage
}}\label{wximagedtor
}
211 \func{}{\destruct{wxImage
}}{\void}
216 \membersection{wxImage::AddHandler
}\label{wximageaddhandler
}
218 \func{static void
}{AddHandler
}{\param{wxImageHandler*
}{ handler
}}
220 Adds a handler to the end of the static list of format handlers.
222 \docparam{handler
}{A new image format handler object. There is usually only one instance
223 of a given handler class in an application session.
}
227 \helpref{wxImageHandler
}{wximagehandler
}
229 \func{bool
}{CanRead
}{\param{const wxString\&
}{ filename
}}
231 returns true if the current image handlers can read this file
233 \pythonnote{In wxPython this static method is named
{\tt wxImage
\_AddHandler}.
}
235 \membersection{wxImage::CleanUpHandlers
}\label{wximagecleanuphandlers
}
237 \func{static void
}{CleanUpHandlers
}{\void}
239 Deletes all image handlers.
241 This function is called by wxWidgets on exit.
244 \membersection{wxImage::ComputeHistogram
}\label{wximagecomputehistogram
}
246 \constfunc{unsigned long
}{ComputeHistogram
}{\param{wxImageHistogram\&
}{histogram
}}
248 Computes the histogram of the image.
{\it histogram
} is a reference to
249 wxImageHistogram object. wxImageHistogram is a specialization of
250 \helpref{wxHashMap
}{wxhashmap
} "template" and is defined as follows:
253 class WXDLLEXPORT wxImageHistogramEntry
256 wxImageHistogramEntry() : index(
0), value(
0)
{}
261 WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry,
262 wxIntegerHash, wxIntegerEqual,
266 \wxheading{Return value
}
268 Returns number of colours in the histogram.
271 \membersection{wxImage::ConvertAlphaToMask
}\label{wximageconvertalphatomask
}
273 \func{bool
}{ConvertAlphaToMask
}{\param{unsigned char
}{ threshold = $
128$
}}
275 If the image has alpha channel, this method converts it to mask. All pixels
276 with alpha value less than
\arg{threshold
} are replaced with mask colour
277 and the alpha channel is removed. Mask colour is chosen automatically using
278 \helpref{FindFirstUnusedColour
}{wximagefindfirstunusedcolour
}.
280 If the image image doesn't have alpha channel,
281 ConvertAlphaToMask does nothing.
283 \wxheading{Return value
}
285 \false if FindFirstUnusedColour returns
\false,
\true otherwise.
288 \membersection{wxImage::ConvertToBitmap
}\label{wximageconverttobitmap
}
290 \constfunc{wxBitmap
}{ConvertToBitmap
}{\void}
292 Deprecated, use equivalent
\helpref{wxBitmap constructor
}{wxbitmapctor
}
293 (which takes wxImage and depth as its arguments) instead.
296 \membersection{wxImage::ConvertToMono
}\label{wxbitmapconverttomono
}
298 \constfunc{wxImage
}{ConvertToMono
}{\param{unsigned char
}{ r
},
\param{unsigned char
}{ g
},
\param{unsigned char
}{ b
}}
300 Returns monochromatic version of the image. The returned image has white
301 colour where the original has
{\it (r,g,b)
} colour and black colour
305 \membersection{wxImage::Copy
}\label{wximagecopy
}
307 \constfunc{wxImage
}{Copy
}{\void}
309 Returns an identical copy of the image.
312 \membersection{wxImage::Create
}\label{wximagecreate
}
314 \func{bool
}{Create
}{\param{int
}{ width
},
\param{int
}{ height
},
\param{bool
}{ clear=true
}}
316 Creates a fresh image. If
{\it clear
} is true, the new image will be initialized to black.
317 Otherwise, the image data will be uninitialized.
319 \wxheading{Parameters
}
321 \docparam{width
}{The width of the image in pixels.
}
323 \docparam{height
}{The height of the image in pixels.
}
325 \wxheading{Return value
}
327 true if the call succeeded, false otherwise.
330 \membersection{wxImage::Destroy
}\label{wximagedestroy
}
332 \func{void
}{Destroy
}{\void}
334 Destroys the image data.
337 \membersection{wxImage::FindFirstUnusedColour
}\label{wximagefindfirstunusedcolour
}
339 \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}}
341 \wxheading{Parameters
}
343 \docparam{r,g,b
}{Pointers to variables to save the colour.
}
345 \docparam{startR,startG,startB
}{Initial values of the colour. Returned colour
346 will have RGB values equal to or greater than these.
}
348 Finds the first colour that is never used in the image. The search begins at
349 given initial colour and continues by increasing R, G and B components (in this
350 order) by
1 until an unused colour is found or the colour space exhausted.
352 \wxheading{Return value
}
354 Returns false if there is no unused colour left, true on success.
358 Note that this method involves computing the histogram, which is
359 computationally intensive operation.
362 \membersection{wxImage::FindHandler
}\label{wximagefindhandler
}
364 \func{static wxImageHandler*
}{FindHandler
}{\param{const wxString\&
}{name
}}
366 Finds the handler with the given name.
368 \func{static wxImageHandler*
}{FindHandler
}{\param{const wxString\&
}{extension
},
\param{long
}{ imageType
}}
370 Finds the handler associated with the given extension and type.
372 \func{static wxImageHandler*
}{FindHandler
}{\param{long
}{imageType
}}
374 Finds the handler associated with the given image type.
376 \func{static wxImageHandler*
}{FindHandlerMime
}{\param{const wxString\&
}{mimetype
}}
378 Finds the handler associated with the given MIME type.
380 \docparam{name
}{The handler name.
}
382 \docparam{extension
}{The file extension, such as ``bmp".
}
384 \docparam{imageType
}{The image type, such as wxBITMAP
\_TYPE\_BMP.
}
386 \docparam{mimetype
}{MIME type.
}
388 \wxheading{Return value
}
390 A pointer to the handler if found, NULL otherwise.
394 \helpref{wxImageHandler
}{wximagehandler
}
397 \membersection{wxImage::GetImageExtWildcard
}\label{wximagegetimageextwildcard
}
399 \func{static wxString
}{GetImageExtWildcard
}{\void}
401 Iterates all registered wxImageHandler objects, and returns a string containing file extension masks
402 suitable for passing to file open/save dialog boxes.
404 \wxheading{Return value
}
406 The format of the returned string is "
(*.ext1;*.ext2)|*.ext1;*.ext2".
408 It is usually a good idea to prepend a description before passing the result to the dialog.
413 wxFileDialog FileDlg( this, "Choose Image", ::wxGetWorkingDirectory(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxOPEN );
418 \helpref{wxImageHandler}{wximagehandler}
421 \membersection{wxImage::GetAlpha}\label{wximagegetalpha}
423 \constfunc{unsigned char}{GetAlpha}{\param{int}{ x}, \param{int}{ y}}
425 Returns the alpha value for the given pixel. This function may only be called
426 for the images with alpha channel, use \helpref{HasAlpha}{wximagehasalpha} to
429 The returned value is the {\it opacity} of the image, i.e. the value of $0$
430 corresponds to the transparent pixels while the value of $255$ -- to the opaque
433 \constfunc{unsigned char *}{GetAlpha}{\void}
435 Returns pointer to the array storing the alpha values for this image. This
436 pointer is {\tt NULL} for the images without the alpha channel. If the image
437 does have it, this pointer may be used to directly manipulate the alpha values
438 which are stored as the \helpref{RGB}{wximagegetdata} ones.
441 \membersection{wxImage::GetBlue}\label{wximagegetblue}
443 \constfunc{unsigned char}{GetBlue}{\param{int}{ x}, \param{int}{ y}}
445 Returns the blue intensity at the given coordinate.
448 \membersection{wxImage::GetData}\label{wximagegetdata}
450 \constfunc{unsigned char*}{GetData}{\void}
452 Returns the image data as an array. This is most often used when doing
453 direct image manipulation. The return value points to an array of
454 characters in RGBRGBRGB$\ldots$ format in the top-to-bottom, left-to-right
455 order, that is the first RGB triplet corresponds to the pixel first pixel of
456 the first row, the second one --- to the second pixel of the first row and so
457 on until the end of the first row, with second row following after it and so
460 You should not delete the returned pointer nor pass it to
461 \helpref{wxImage::SetData}{wximagesetdata}.
464 \membersection{wxImage::GetGreen}\label{wximagegetgreen}
466 \constfunc{unsigned char}{GetGreen}{\param{int}{ x}, \param{int}{ y}}
468 Returns the green intensity at the given coordinate.
471 \membersection{wxImage::GetImageCount}\label{wximagegetimagecount}
473 \func{static int}{GetImageCount}{\param{const wxString\&}{ filename}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
475 \func{static int}{GetImageCount}{\param{wxInputStream\&}{ stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
477 If the image file contains more than one image and the image handler is capable
478 of retrieving these individually, this function will return the number of
481 \docparam{name}{Name of the file to query.}
483 \docparam{stream}{Opened input stream with image data. Currently, the stream must support seeking.}
485 \docparam{type}{May be one of the following:
489 \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.}
490 \twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
491 \twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.}
492 \twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.}
493 \twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
494 \twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
495 \twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
496 \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
497 \twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
498 \twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
499 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
500 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
503 \wxheading{Return value}
505 Number of available images. For most image handlers, this is 1 (exceptions
506 are TIFF and ICO formats).
509 \membersection{wxImage::GetHandlers}\label{wximagegethandlers}
511 \func{static wxList\&}{GetHandlers}{\void}
513 Returns the static list of image format handlers.
517 \helpref{wxImageHandler}{wximagehandler}
520 \membersection{wxImage::GetHeight}\label{wximagegetheight}
522 \constfunc{int}{GetHeight}{\void}
524 Gets the height of the image in pixels.
527 \membersection{wxImage::GetMaskBlue}\label{wximagegetmaskblue}
529 \constfunc{unsigned char}{GetMaskBlue}{\void}
531 Gets the blue value of the mask colour.
534 \membersection{wxImage::GetMaskGreen}\label{wximagegetmaskgreen}
536 \constfunc{unsigned char}{GetMaskGreen}{\void}
538 Gets the green value of the mask colour.
541 \membersection{wxImage::GetMaskRed}\label{wximagegetmaskred}
543 \constfunc{unsigned char}{GetMaskRed}{\void}
545 Gets the red value of the mask colour.
548 \membersection{wxImage::GetOrFindMaskColour}\label{wximagegetgetorsetmaskcolour}
550 \constfunc{bool}{GetOrFindMaskColour}{\param{unsigned char}{ *r}, \param{unsigned char}{ *g}, \param{unsigned char}{ *b}}
552 Get the current mask colour or find a suitable unused colour that could be
553 used as a mask colour. Returns {\tt true} if the image currently has a mask.
556 \membersection{wxImage::GetPalette}\label{wximagegetpalette}
558 \constfunc{const wxPalette\&}{GetPalette}{\void}
560 Returns the palette associated with the image. Currently the palette is only
561 used when converting to wxBitmap under Windows.
563 Eventually wxImage handlers will set the palette if one exists in the image file.
566 \membersection{wxImage::GetRed}\label{wximagegetred}
568 \constfunc{unsigned char}{GetRed}{\param{int}{ x}, \param{int}{ y}}
570 Returns the red intensity at the given coordinate.
573 \membersection{wxImage::GetSubImage}\label{wximagegetsubimage}
575 \constfunc{wxImage}{GetSubImage}{\param{const wxRect\&}{ rect}}
577 Returns a sub image of the current one as long as the rect belongs entirely to
581 \membersection{wxImage::GetWidth}\label{wximagegetwidth}
583 \constfunc{int}{GetWidth}{\void}
585 Gets the width of the image in pixels.
589 \helpref{wxImage::GetHeight}{wximagegetheight}
592 \membersection{HSVValue::HSVValue}\label{hsvvaluehsvvalue}
594 \func{}{HSVValue}{\param{double }{h = 0.0}, \param{double }{s = 0.0}, \param{double }{v = 0.0}}
596 Constructor for HSVValue, an object that contains values for hue, saturation and value which
597 represent the value of a color. It is used by \helpref{wxImage::HSVtoRGB}{wximagehsvtorgb}
598 and \helpref{wxImage::RGBtoHSV}{wximagergbtohsv}, which
599 converts between HSV color space and RGB color space.
601 \pythonnote{use wxImage\_HSVValue in wxPython}
605 \membersection{wxImage::HSVtoRGB}\label{wximagehsvtorgb}
607 \func{wxImage::RGBValue}{HSVtoRGB}{\param{const HSVValue \& }{hsv}}
609 Converts a color in HSV color space to RGB color space.
612 \membersection{wxImage::HasAlpha}\label{wximagehasalpha}
614 \constfunc{bool}{HasAlpha}{\void}
616 Returns true if this image has alpha channel, false otherwise.
620 \helpref{GetAlpha}{wximagegetalpha}, \helpref{SetAlpha}{wximagesetalpha}
623 \membersection{wxImage::HasMask}\label{wximagehasmask}
625 \constfunc{bool}{HasMask}{\void}
627 Returns true if there is a mask active, false otherwise.
630 \membersection{wxImage::GetOption}\label{wximagegetoption}
632 \constfunc{wxString}{GetOption}{\param{const wxString\&}{ name}}
634 Gets a user-defined option. The function is case-insensitive to {\it name}.
636 For example, when saving as a JPEG file, the option {\bf quality} is
637 used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
641 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
642 \helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
643 \helpref{wxImage::HasOption}{wximagehasoption}
646 \membersection{wxImage::GetOptionInt}\label{wximagegetoptionint}
648 \constfunc{int}{GetOptionInt}{\param{const wxString\&}{ name}}
650 Gets a user-defined option as an integer. The function is case-insensitive to {\it name}.
652 If the given option is not present, the function returns $0$. Use
653 \helpref{wxImage::HasOption}{wximagehasoption} is $0$ is a possibly valid value
656 Options for wxPNGHandler
659 \twocolitem{wxIMAGE\_OPTION\_PNG\_FORMAT}{Format for saving a PNG file.}
660 \twocolitem{wxIMAGE\_OPTION\_PNG\_BITDEPTH}{Bit depth for every channel (R/G/B/A).}
663 Supported values for wxIMAGE\_OPTION\_PNG\_FORMAT:
666 \twocolitem{wxPNG\_TYPE\_COLOUR}{Stores RGB image.}
667 \twocolitem{wxPNG\_TYPE\_GREY}{Stores grey image, converts from RGB.}
668 \twocolitem{wxPNG\_TYPE\_GREY\_RED}{Stores grey image, uses red value as grey.}
674 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
675 \helpref{wxImage::GetOption}{wximagegetoption}
678 \membersection{wxImage::HasOption}\label{wximagehasoption}
680 \constfunc{bool}{HasOption}{\param{const wxString\&}{ name}}
682 Returns true if the given option is present. The function is case-insensitive to {\it name}.
686 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
687 \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
688 \helpref{wxImage::GetOptionInt}{wximagegetoptionint}
691 \membersection{wxImage::InitAlpha}\label{wximageinitalpha}
693 \func{void}{InitAlpha}{\void}
695 Initializes the image alpha channel data. It is an error to call it
696 if the image already has alpha data. If it doesn't, alpha data will be
697 by default initialized to all pixels being fully opaque. But if the image has a
698 a mask colour, all mask pixels will be completely transparent.
701 \membersection{wxImage::InitStandardHandlers}\label{wximageinitstandardhandlers}
703 \func{static void}{InitStandardHandlers}{\void}
705 Internal use only. Adds standard image format handlers. It only install BMP
706 for the time being, which is used by wxBitmap.
708 This function is called by wxWidgets on startup, and shouldn't be called by
713 \helpref{wxImageHandler}{wximagehandler},
714 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
717 \membersection{wxImage::InsertHandler}\label{wximageinserthandler}
719 \func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}}
721 Adds a handler at the start of the static list of format handlers.
723 \docparam{handler}{A new image format handler object. There is usually only one instance
724 of a given handler class in an application session.}
728 \helpref{wxImageHandler}{wximagehandler}
731 \membersection{wxImage::IsTransparent}\label{wximageistransparent}
733 \constfunc{bool}{IsTransparent}{\param{int }{x}, \param{int }{y}, \param{unsigned char}{ threshold = $128$}}
735 Returns \true if the given pixel is transparent, i.e. either has the mask
736 colour if this image has a mask or if this image has alpha channel and alpha
737 value of this pixel is strictly less than \arg{threshold}.
740 \membersection{wxImage::LoadFile}\label{wximageloadfile}
742 \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}}
744 \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
746 Loads an image from a file. If no handler type is provided, the library will
747 try to autodetect the format.
749 \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}, \param{int}{ index = -1}}
751 \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
753 Loads an image from an input stream.
755 \wxheading{Parameters}
757 \docparam{name}{Name of the file from which to load the image.}
759 \docparam{stream}{Opened input stream from which to load the image. Currently, the stream must support seeking.}
761 \docparam{type}{One of the following values:
765 \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.}
766 \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF image file.}
767 \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Load a JPEG image file.}
768 \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Load a PCX image file.}
769 \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.}
770 \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.}
771 \twocolitem{{\bf wxBITMAP\_TYPE\_TIF}}{Load a TIFF image file.}
772 \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load a XPM image file.}
773 \twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
774 \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
775 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
776 \twocolitem{{\bf wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
779 \docparam{mimetype}{MIME type string (for example 'image/jpeg')}
781 \docparam{index}{Index of the image to load in the case that the image file contains multiple images.
782 This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
783 "choose the default image" and is interpreted as the first image (index=0) by
784 the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
788 Depending on how wxWidgets has been configured, not all formats may be available.
790 Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
791 hotspot for loaded cursor file:
793 int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
794 int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
798 \wxheading{Return value}
800 true if the operation succeeded, false otherwise. If the optional index parameter is out of range,
801 false is returned and a call to wxLogError() takes place.
805 \helpref{wxImage::SaveFile}{wximagesavefile}
807 \pythonnote{In place of a single overloaded method name, wxPython
808 implements the following methods:\par
809 \indented{2cm}{\begin{twocollist}
810 \twocolitem{{\bf LoadFile(filename, type)}}{Loads an image of the given
812 \twocolitem{{\bf LoadMimeFile(filename, mimetype)}}{Loads an image of the given
813 mimetype from a file}
817 \perlnote{Methods supported by wxPerl are:\par
819 \item{bitmap->LoadFile( name, type )}
820 \item{bitmap->LoadFile( name, mimetype )}
826 \membersection{wxImage::Ok}\label{wximageok}
828 \constfunc{bool}{Ok}{\void}
830 Returns true if image data is present.
833 \membersection{RGBValue::RGBValue}\label{rgbvaluergbvalue}
835 \func{}{RGBValue}{\param{unsigned char }{r = 0}, \param{unsigned char }{g = 0}, \param{unsigned char }{b = 0}}
837 Constructor for RGBValue, an object that contains values for red, green and blud which
838 represent the value of a color. It is used by \helpref{wxImage::HSVtoRGB}{wximagehsvtorgb}
839 and \helpref{wxImage::RGBtoHSV}{wximagergbtohsv}, which
840 converts between HSV color space and RGB color space.
842 \pythonnote{use wxImage\_RGBValue in wxPython}
845 \membersection{wxImage::RGBtoHSV}\label{wximagergbtohsv}
847 \func{wxImage::HSVValue}{RGBtoHSV}{\param{const RGBValue\& }{rgb}}
849 Converts a color in RGB color space to HSV color space.
852 \membersection{wxImage::RemoveHandler}\label{wximageremovehandler}
854 \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}}
856 Finds the handler with the given name, and removes it. The handler
859 \docparam{name}{The handler name.}
861 \wxheading{Return value}
863 true if the handler was found and removed, false otherwise.
867 \helpref{wxImageHandler}{wximagehandler}
870 \membersection{wxImage::Mirror}\label{wximagemirror}
872 \constfunc{wxImage}{Mirror}{\param{bool}{ horizontally = true}}
874 Returns a mirrored copy of the image. The parameter {\it horizontally}
875 indicates the orientation.
878 \membersection{wxImage::Replace}\label{wximagereplace}
880 \func{void}{Replace}{\param{unsigned char}{ r1}, \param{unsigned char}{ g1}, \param{unsigned char}{ b1},
881 \param{unsigned char}{ r2}, \param{unsigned char}{ g2}, \param{unsigned char}{ b2}}
883 Replaces the colour specified by {\it r1,g1,b1} by the colour {\it r2,g2,b2}.
886 \membersection{wxImage::Rescale}\label{wximagerescale}
888 \func{wxImage \&}{Rescale}{\param{int}{ width}, \param{int}{ height}}
890 Changes the size of the image in-place by scaling it: after a call to this function,
891 the image will have the given width and height.
893 Returns the (modified) image itself.
897 \helpref{Scale}{wximagescale}
900 \membersection{wxImage::Resize}\label{wximageresize}
902 \func{wxImage \&}{Resize}{\param{const wxSize\&}{ size}, \param{const wxPoint&}{ pos}, \param{int}{ red = -1}, \param{int}{ green = -1}, \param{int}{ blue = -1}}
904 Changes the size of the image in-place without scaling it by adding either a border
905 with the given colour or cropping as necessary. The image is pasted into a new
906 image with the given {\it size} and background colour at the position {\it pos}
907 relative to the upper left of the new image. If {\it red = green = blue = -1}
908 then use either the current mask colour if set or find, use, and set a
909 suitable mask colour for any newly exposed areas.
911 Returns the (modified) image itself.
915 \helpref{Size}{wximagesize}
918 \membersection{wxImage::Rotate}\label{wximagerotate}
920 \func{wxImage}{Rotate}{\param{double}{ angle}, \param{const wxPoint\& }{rotationCentre},
921 \param{bool}{ interpolating = true}, \param{wxPoint*}{ offsetAfterRotation = NULL}}
923 Rotates the image about the given point, by {\it angle} radians. Passing true
924 to {\it interpolating} results in better image quality, but is slower. If the
925 image has a mask, then the mask colour is used for the uncovered pixels in the
926 rotated image background. Else, black (rgb 0, 0, 0) will be used.
928 Returns the rotated image, leaving this image intact.
931 \membersection{wxImage::RotateHue}\label{wximagerotatehue}
933 \func{void}{RotateHue}{\param{double}{ angle}}
935 Rotates the hue of each pixel in the image by {\it angle}, which is a double in
936 the range of -1.0 to +1.0, where -1.0 corresponds to -360 degrees and +1.0 corresponds
940 \membersection{wxImage::Rotate90}\label{wximagerotate90}
942 \constfunc{wxImage}{Rotate90}{\param{bool}{ clockwise = true}}
944 Returns a copy of the image rotated 90 degrees in the direction
945 indicated by {\it clockwise}.
948 \membersection{wxImage::SaveFile}\label{wximagesavefile}
950 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}}
952 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}}
954 Saves an image in the named file.
956 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}}
958 Saves an image in the named file. File type is determined from the extension of the
959 file name. Note that this function may fail if the extension is not recognized! You
960 can use one of the forms above to save images to files with non-standard extensions.
962 \constfunc{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int}{ type}}
964 \constfunc{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{const wxString\&}{ mimetype}}
966 Saves an image in the given stream.
968 \wxheading{Parameters}
970 \docparam{name}{Name of the file to save the image to.}
972 \docparam{stream}{Opened output stream to save the image to.}
974 \docparam{type}{Currently these types can be used:
978 \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a BMP image file.}
979 \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Save a JPEG image file.}
980 \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.}
981 \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Save a PCX image file (tries to save as 8-bit if possible, falls back to 24-bit otherwise).}
982 \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Save a PNM image file (as raw RGB always).}
983 \twocolitem{{\bf wxBITMAP\_TYPE\_TIFF}}{Save a TIFF image file.}
984 \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save a XPM image file.}
985 \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).}
986 \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Save a Windows cursor file (CUR).}
989 \docparam{mimetype}{MIME type.}
991 \wxheading{Return value}
993 true if the operation succeeded, false otherwise.
997 Depending on how wxWidgets has been configured, not all formats may be available.
999 Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to set the
1000 hotspot before saving an image into a cursor file (default hotspot is in
1001 the centre of the image):
1003 image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotspotX);
1004 image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotspotY);
1008 \wxheading{See also}
1010 \helpref{wxImage::LoadFile}{wximageloadfile}
1012 \pythonnote{In place of a single overloaded method name, wxPython
1013 implements the following methods:\par
1014 \indented{2cm}{\begin{twocollist}
1015 \twocolitem{{\bf SaveFile(filename, type)}}{Saves the image using the given
1016 type to the named file}
1017 \twocolitem{{\bf SaveMimeFile(filename, mimetype)}}{Saves the image using the given
1018 mimetype to the named file}
1022 \perlnote{Methods supported by wxPerl are:\par
1024 \item{bitmap->SaveFile( name, type )}
1025 \item{bitmap->SaveFile( name, mimetype )}
1030 \membersection{wxImage::Scale}\label{wximagescale}
1032 \constfunc{wxImage}{Scale}{\param{int}{ width}, \param{int}{ height}}
1034 Returns a scaled version of the image. This is also useful for
1035 scaling bitmaps in general as the only other way to scale bitmaps
1036 is to blit a wxMemoryDC into another wxMemoryDC.
1038 It may be mentioned that the GTK port uses this function internally
1039 to scale bitmaps when using mapping modes in wxDC.
1044 // get the bitmap from somewhere
1047 // rescale it to have size of 32*32
1048 if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 )
1050 wxImage image = bmp.ConvertToImage();
1051 bmp = wxBitmap(image.Scale(32, 32));
1053 // another possibility:
1054 image.Rescale(32, 32);
1060 \wxheading{See also}
1062 \helpref{Rescale}{wximagerescale}
1065 \membersection{wxImage::Size}\label{wximagesize}
1067 \constfunc{wxImage}{Size}{\param{const wxSize\&}{ size}, \param{const wxPoint&}{ pos}, \param{int}{ red = -1}, \param{int}{ green = -1}, \param{int}{ blue = -1}}
1069 Returns a resized version of this image without scaling it by adding either a border
1070 with the given colour or cropping as necessary. The image is pasted into a new
1071 image with the given {\it size} and background colour at the position {\it pos}
1072 relative to the upper left of the new image. If {\it red = green = blue = -1}
1073 then use either the current mask colour if set or find, use, and set a
1074 suitable mask colour for any newly exposed areas.
1076 \wxheading{See also}
1078 \helpref{Resize}{wximageresize}
1081 \membersection{wxImage::SetAlpha}\label{wximagesetalpha}
1083 \func{void}{SetAlpha}{\param{unsigned char *}{alpha = {\tt NULL}},\param{bool}{ static\_data = \false}}
1085 This function is similar to \helpref{SetData}{wximagesetdata} and has similar
1086 restrictions. The pointer passed to it may however be {\tt NULL} in which case
1087 the function will allocate the alpha array internally -- this is useful to add
1088 alpha channel data to an image which doesn't have any. If the pointer is not
1089 {\tt NULL}, it must have one byte for each image pixel and be allocated with
1090 {\tt malloc()}. wxImage takes ownership of the pointer and will free it unless
1091 \arg{static\_data} parameter is set.to \true -- in this case the caller should
1094 \func{void}{SetAlpha}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{alpha}}
1096 Sets the alpha value for the given pixel. This function should only be called
1097 if the image has alpha channel data, use \helpref{HasAlpha}{wximagehasalpha} to
1101 \membersection{wxImage::SetData}\label{wximagesetdata}
1103 \func{void}{SetData}{\param{unsigned char*}{data}}
1105 Sets the image data without performing checks. The data given must have
1106 the size (width*height*3) or results will be unexpected. Don't use this
1107 method if you aren't sure you know what you are doing.
1109 The data must have been allocated with {\tt malloc()}, {\large {\bf NOT}} with
1112 After this call the pointer to the data is owned by the wxImage object,
1113 that will be responsible for deleting it.
1114 Do not pass to this function a pointer obtained through
1115 \helpref{wxImage::GetData}{wximagegetdata}.
1118 \membersection{wxImage::SetMask}\label{wximagesetmask}
1120 \func{void}{SetMask}{\param{bool}{ hasMask = true}}
1122 Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.
1125 \membersection{wxImage::SetMaskColour}\label{wximagesetmaskcolour}
1127 \func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1129 Sets the mask colour for this image (and tells the image to use the mask).
1132 \membersection{wxImage::SetMaskFromImage}\label{wximagesetmaskfromimage}
1134 \func{bool}{SetMaskFromImage}{\param{const wxImage\&}{ mask}, \param{unsigned char}{ mr}, \param{unsigned char}{ mg}, \param{unsigned char}{ mb}}
1136 \wxheading{Parameters}
1138 \docparam{mask}{The mask image to extract mask shape from. Must have same dimensions as the image.}
1140 \docparam{mr,mg,mb}{RGB value of pixels in {\it mask} that will be used to create the mask.}
1142 Sets image's mask so that the pixels that have RGB value of {\it mr,mg,mb}
1143 in {\it mask} will be masked in the image. This is done by first finding an
1144 unused colour in the image, setting this colour as the mask colour and then
1145 using this colour to draw all pixels in the image who corresponding pixel
1146 in {\it mask} has given RGB value.
1148 \wxheading{Return value}
1150 Returns false if {\it mask} does not have same dimensions as the image or if
1151 there is no unused colour left. Returns true if the mask was successfully
1156 Note that this method involves computing the histogram, which is
1157 computationally intensive operation.
1160 \membersection{wxImage::SetOption}\label{wximagesetoption}
1162 \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{const wxString\&}{ value}}
1164 \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{int}{ value}}
1166 Sets a user-defined option. The function is case-insensitive to {\it name}.
1168 For example, when saving as a JPEG file, the option {\bf quality} is
1169 used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
1171 \wxheading{See also}
1173 \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
1174 \helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
1175 \helpref{wxImage::HasOption}{wximagehasoption}
1178 \membersection{wxImage::SetPalette}\label{wximagesetpalette}
1180 \func{void}{SetPalette}{\param{const wxPalette\&}{ palette}}
1182 Associates a palette with the image. The palette may be used when converting
1183 wxImage to wxBitmap (MSW only at present) or in file save operations (none as yet).
1186 \membersection{wxImage::SetRGB}\label{wximagesetrgb}
1188 \func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1190 Sets the pixel at the given coordinate. This routine performs bounds-checks
1191 for the coordinate so it can be considered a safe way to manipulate the
1192 data, but in some cases this might be too slow so that the data will have to
1193 be set directly. In that case you will have to get access to the image data
1194 using the \helpref{GetData}{wximagegetdata} method.
1197 \membersection{wxImage::SetRGB}\label{wximagesetrgbrect}
1199 \func{void}{SetRGB}{\param{wxRect \& }{rect}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1201 Sets the colour of the pixels within the given rectangle. This routine performs
1202 bounds-checks for the coordinate so it can be considered a safe way to manipulate the
1206 \membersection{wxImage::operator $=$}\label{wximageassign}
1208 \func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}
1210 Assignment operator. This operator does not copy any data, but instead
1211 passes a pointer to the data in {\it image} and increments a reference
1212 counter. It is a fast operation.
1214 \wxheading{Parameters}
1216 \docparam{image}{Image to assign.}
1218 \wxheading{Return value}
1220 Returns 'this' object.
1223 \membersection{wxImage::operator $==$}\label{wximageequal}
1225 \constfunc{bool}{operator $==$}{\param{const wxImage\& }{image}}
1227 Equality operator. This operator tests whether the internal data pointers are
1228 equal (a fast test).
1230 \wxheading{Parameters}
1232 \docparam{image}{Image to compare with 'this'}
1234 \wxheading{Return value}
1236 Returns true if the images were effectively equal, false otherwise.
1239 \membersection{wxImage::operator $!=$}\label{wximagenotequal}
1241 \constfunc{bool}{operator $!=$}{\param{const wxImage\& }{image}}
1243 Inequality operator. This operator tests whether the internal data pointers are
1244 unequal (a fast test).
1246 \wxheading{Parameters}
1248 \docparam{image}{Image to compare with 'this'}
1250 \wxheading{Return value}
1252 Returns true if the images were unequal, false otherwise.
1254 \section{\class{wxImageHandler}}\label{wximagehandler}
1256 This is the base class for implementing image file loading/saving, and image creation from data.
1257 It is used within wxImage and is not normally seen by the application.
1259 If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler
1260 and add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in your
1261 application initialisation.
1263 \wxheading{Note (Legal Issue)}
1265 This software is based in part on the work of the Independent JPEG Group.
1267 (Applies when wxWidgets is linked with JPEG support. wxJPEGHandler uses libjpeg
1270 \wxheading{Derived from}
1272 \helpref{wxObject}{wxobject}
1274 \wxheading{Include files}
1278 \wxheading{See also}
1280 \helpref{wxImage}{wximage},
1281 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
1283 \latexignore{\rtfignore{\wxheading{Members}}}
1286 \membersection{wxImageHandler::wxImageHandler}\label{wximagehandlerctor}
1288 \func{}{wxImageHandler}{\void}
1290 Default constructor. In your own default constructor, initialise the members
1291 m\_name, m\_extension and m\_type.
1294 \membersection{wxImageHandler::\destruct{wxImageHandler}}\label{wximagehandlerdtor}
1296 \func{}{\destruct{wxImageHandler}}{\void}
1298 Destroys the wxImageHandler object.
1301 \membersection{wxImageHandler::GetName}\label{wximagehandlergetname}
1303 \constfunc{wxString}{GetName}{\void}
1305 Gets the name of this handler.
1308 \membersection{wxImageHandler::GetExtension}\label{wximagehandlergetextension}
1310 \constfunc{wxString}{GetExtension}{\void}
1312 Gets the file extension associated with this handler.
1315 \membersection{wxImageHandler::GetImageCount}\label{wximagehandlergetimagecount}
1317 \func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}}
1319 If the image file contains more than one image and the image handler is capable
1320 of retrieving these individually, this function will return the number of
1323 \docparam{stream}{Opened input stream for reading image data. Currently, the stream must support seeking.}
1325 \wxheading{Return value}
1327 Number of available images. For most image handlers, this is 1 (exceptions
1328 are TIFF and ICO formats).
1331 \membersection{wxImageHandler::GetType}\label{wximagehandlergettype}
1333 \constfunc{long}{GetType}{\void}
1335 Gets the image type associated with this handler.
1338 \membersection{wxImageHandler::GetMimeType}\label{wximagehandlergetmimetype}
1340 \constfunc{wxString}{GetMimeType}{\void}
1342 Gets the MIME type associated with this handler.
1345 \membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile}
1347 \func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}, \param{bool}{ verbose=true}, \param{int}{ index=0}}
1349 Loads a image from a stream, putting the resulting data into {\it image}. If the image file contains
1350 more than one image and the image handler is capable of retrieving these individually, {\it index}
1351 indicates which image to read from the stream.
1353 \wxheading{Parameters}
1355 \docparam{image}{The image object which is to be affected by this operation.}
1357 \docparam{stream}{Opened input stream for reading image data.}
1359 \docparam{verbose}{If set to true, errors reported by the image handler will produce wxLogMessages.}
1361 \docparam{index}{The index of the image in the file (starting from zero).}
1363 \wxheading{Return value}
1365 true if the operation succeeded, false otherwise.
1367 \wxheading{See also}
1369 \helpref{wxImage::LoadFile}{wximageloadfile},
1370 \helpref{wxImage::SaveFile}{wximagesavefile},
1371 \helpref{wxImageHandler::SaveFile}{wximagehandlersavefile}
1374 \membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile}
1376 \func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}}
1378 Saves a image in the output stream.
1380 \wxheading{Parameters}
1382 \docparam{image}{The image object which is to be affected by this operation.}
1384 \docparam{stream}{Opened output stream for writing the data.}
1386 \wxheading{Return value}
1388 true if the operation succeeded, false otherwise.
1390 \wxheading{See also}
1392 \helpref{wxImage::LoadFile}{wximageloadfile},
1393 \helpref{wxImage::SaveFile}{wximagesavefile},
1394 \helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile}
1397 \membersection{wxImageHandler::SetName}\label{wximagehandlersetname}
1399 \func{void}{SetName}{\param{const wxString\& }{name}}
1401 Sets the handler name.
1403 \wxheading{Parameters}
1405 \docparam{name}{Handler name.}
1408 \membersection{wxImageHandler::SetExtension}\label{wximagehandlersetextension}
1410 \func{void}{SetExtension}{\param{const wxString\& }{extension}}
1412 Sets the handler extension.
1414 \wxheading{Parameters}
1416 \docparam{extension}{Handler extension.}
1419 \membersection{wxImageHandler::SetMimeType}\label{wximagehandlersetmimetype}
1421 \func{void}{SetMimeType}{\param{const wxString\& }{mimetype}}
1423 Sets the handler MIME type.
1425 \wxheading{Parameters}
1427 \docparam{mimename}{Handler MIME type.}
1430 \membersection{wxImageHandler::SetType}\label{wximagehandlersettype}
1432 \func{void}{SetType}{\param{long }{type}}
1434 Sets the handler type.
1436 \wxheading{Parameters}
1438 \docparam{name}{Handler type.}