1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxImage documentation
4 %% Author: wxWidgets Team
8 %% Copyright: (c) wxWidgets Team
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxImage
}}\label{wximage
}
14 This class encapsulates a platform-independent image. An image can be created
15 from data, or using
\helpref{wxBitmap::ConvertToImage
}{wxbitmapconverttoimage
}. An image
16 can be loaded from a file in a variety of formats, and is extensible to new formats
17 via image format handlers. Functions are available to set and get image bits, so
18 it can be used for basic image manipulation.
20 A wxImage cannot (currently) be drawn directly to a
\helpref{wxDC
}{wxdc
}. Instead,
21 a platform-specific
\helpref{wxBitmap
}{wxbitmap
} object must be created from it using
22 the
\helpref{wxBitmap::wxBitmap(wxImage,int depth)
}{wxbitmapctor
} constructor.
24 be drawn in a device context, using
\helpref{wxDC::DrawBitmap
}{wxdcdrawbitmap
}.
26 One colour value of the image may be used as a mask colour which will lead to the automatic
27 creation of a
\helpref{wxMask
}{wxmask
} object associated to the bitmap object.
29 \wxheading{Alpha channel support
}
31 Starting from wxWidgets
2.5.0 wxImage supports alpha channel data, that is in
32 addition to a byte for the red, green and blue colour components for each pixel
33 it also stores a byte representing the pixel opacity. An alpha value of $
0$
34 corresponds to a transparent pixel (null opacity) while a value of $
255$
35 means that the pixel is
100\% opaque.
37 Unlike RGB data, not all images have an alpha channel and before using
38 \helpref{GetAlpha
}{wximagegetalpha
} you should check if this image contains
39 an alpha channel with
\helpref{HasAlpha
}{wximagehasalpha
}. Note that currently only
40 images loaded from PNG files with transparency information will have an alpha
41 channel but alpha support will be added to the other formats as well (as well
42 as support for saving images with alpha channel which also isn't implemented).
44 \wxheading{Available image handlers
}
46 The following image handlers are available.
{\bf wxBMPHandler
} is always
47 installed by default. To use other image formats, install the appropriate
48 handler with
\helpref{wxImage::AddHandler
}{wximageaddhandler
} or
49 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}.
53 \twocolitem{\indexit{wxBMPHandler
}}{For loading and saving, always installed.
}
54 \twocolitem{\indexit{wxPNGHandler
}}{For loading (including alpha support) and saving.
}
55 \twocolitem{\indexit{wxJPEGHandler
}}{For loading and saving.
}
56 \twocolitem{\indexit{wxGIFHandler
}}{Only for loading, due to legal issues.
}
57 \twocolitem{\indexit{wxPCXHandler
}}{For loading and saving (see below).
}
58 \twocolitem{\indexit{wxPNMHandler
}}{For loading and saving (see below).
}
59 \twocolitem{\indexit{wxTIFFHandler
}}{For loading and saving.
}
60 \twocolitem{\indexit{wxIFFHandler
}}{For loading only.
}
61 \twocolitem{\indexit{wxXPMHandler
}}{For loading and saving.
}
62 \twocolitem{\indexit{wxICOHandler
}}{For loading and saving.
}
63 \twocolitem{\indexit{wxCURHandler
}}{For loading and saving.
}
64 \twocolitem{\indexit{wxANIHandler
}}{For loading only.
}
67 When saving in PCX format,
{\bf wxPCXHandler
} will count the number of
68 different colours in the image; if there are
256 or less colours, it will
69 save as
8 bit, else it will save as
24 bit.
71 Loading PNMs only works for ASCII or raw RGB images. When saving in
72 PNM format,
{\bf wxPNMHandler
} will always save as raw RGB.
74 \wxheading{Derived from
}
76 \helpref{wxObject
}{wxobject
}
78 \wxheading{Include files
}
84 \helpref{wxBitmap
}{wxbitmap
},
85 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}
87 \latexignore{\rtfignore{\wxheading{Members
}}}
90 \membersection{wxImage::wxImage
}\label{wximagector
}
92 \func{}{wxImage
}{\void}
96 \func{}{wxImage
}{\param{const wxImage\&
}{image
}}
100 \func{}{wxImage
}{\param{const wxBitmap\&
}{ bitmap
}}
102 (Deprecated form, use
\helpref{wxBitmap::ConvertToImage
}{wxbitmapconverttoimage
}
103 instead.) Constructs an image from a platform-dependent bitmap. This preserves
104 mask information so that bitmaps and images can be converted back
105 and forth without loss in that respect.
107 \func{}{wxImage
}{\param{int
}{ width
},
\param{int
}{ height
},
\param{bool
}{ clear=true
}}
109 Creates an image with the given width and height. If
{\it clear
} is true, the new image will be initialized to black.
110 Otherwise, the image data will be uninitialized.
112 \func{}{wxImage
}{\param{int
}{ width
},
\param{int
}{ height
},
\param{unsigned char*
}{ data
},
\param{bool
}{ static
\_data =
\false}}
114 Creates an image from given data with the given width and height. If
115 {\it static
\_data} is true, then wxImage will not delete the actual
116 image data in its destructor, otherwise it will free it by calling
119 \func{}{wxImage
}{\param{const wxString\&
}{name
},
\param{long
}{ type = wxBITMAP
\_TYPE\_ANY},
\param{int
}{ index = -
1}}
121 \func{}{wxImage
}{\param{const wxString\&
}{name
},
\param{const wxString\&
}{ mimetype
},
\param{int
}{ index = -
1}}
123 Loads an image from a file.
125 \func{}{wxImage
}{\param{wxInputStream\&
}{stream
},
\param{long
}{ type = wxBITMAP
\_TYPE\_ANY},
\param{int
}{ index = -
1}}
127 \func{}{wxImage
}{\param{wxInputStream\&
}{stream
},
\param{const wxString\&
}{ mimetype
},
\param{int
}{ index = -
1}}
129 Loads an image from an input stream.
131 \func{}{wxImage
}{\param{const char**
}{xpmData
}}
133 Creates an image from XPM data.
135 \wxheading{Parameters
}
137 \docparam{width
}{Specifies the width of the image.
}
139 \docparam{height
}{Specifies the height of the image.
}
141 \docparam{name
}{Name of the file from which to load the image.
}
143 \docparam{stream
}{Opened input stream from which to load the image. Currently, the stream must support seeking.
}
145 \docparam{type
}{May be one of the following:
149 \twocolitem{\indexit{wxBITMAP
\_TYPE\_BMP}}{Load a Windows bitmap file.
}
150 \twocolitem{\indexit{wxBITMAP
\_TYPE\_GIF}}{Load a GIF bitmap file.
}
151 \twocolitem{\indexit{wxBITMAP
\_TYPE\_JPEG}}{Load a JPEG bitmap file.
}
152 \twocolitem{\indexit{wxBITMAP
\_TYPE\_PNG}}{Load a PNG bitmap file.
}
153 \twocolitem{\indexit{wxBITMAP
\_TYPE\_PCX}}{Load a PCX bitmap file.
}
154 \twocolitem{\indexit{wxBITMAP
\_TYPE\_PNM}}{Load a PNM bitmap file.
}
155 \twocolitem{\indexit{wxBITMAP
\_TYPE\_TIF}}{Load a TIFF bitmap file.
}
156 \twocolitem{\indexit{wxBITMAP
\_TYPE\_XPM}}{Load a XPM bitmap file.
}
157 \twocolitem{\indexit{wxBITMAP
\_TYPE\_ICO}}{Load a Windows icon file (ICO).
}
158 \twocolitem{\indexit{wxBITMAP
\_TYPE\_CUR}}{Load a Windows cursor file (CUR).
}
159 \twocolitem{\indexit{wxBITMAP
\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).
}
160 \twocolitem{\indexit{wxBITMAP
\_TYPE\_ANY}}{Will try to autodetect the format.
}
163 \docparam{mimetype
}{MIME type string (for example 'image/jpeg')
}
165 \docparam{index
}{Index of the image to load in the case that the image file contains multiple images.
166 This is only used by GIF, ICO and TIFF handlers. The default value (-
1) means
167 "choose the default image" and is interpreted as the first image (index=
0) by
168 the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.
}
170 \docparam{xpmData
}{A pointer to XPM image data.
}
174 Depending on how wxWidgets has been configured, not all formats may be available.
176 Note: any handler other than BMP must be previously
177 initialized with
\helpref{wxImage::AddHandler
}{wximageaddhandler
} or
178 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}.
180 Note: you can use
\helpref{GetOptionInt
}{wximagegetoptionint
} to get the
181 hotspot for loaded cursor file:
183 int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
184 int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
190 \helpref{wxImage::LoadFile
}{wximageloadfile
}
192 \pythonnote{Constructors supported by wxPython are:
\par
193 \indented{2cm
}{\begin{twocollist
}
194 \twocolitem{{\bf wxImage(name, flag)
}}{Loads an image from a file
}
195 \twocolitem{{\bf wxNullImage()
}}{Create a null image (has no size or
197 \twocolitem{{\bf wxEmptyImage(width, height)
}}{Creates an empty image
199 \twocolitem{{\bf wxImageFromMime(name, mimetype
}}{Creates an image from
200 the given file of the given mimetype
}
201 \twocolitem{{\bf wxImageFromBitmap(bitmap)
}}{Creates an image from a
202 platform-dependent bitmap
}
206 \perlnote{Constructors supported by wxPerl are:
\par
208 \item{Wx::Image->new( bitmap )
}
209 \item{Wx::Image->new( icon )
}
210 \item{Wx::Image->new( width, height )
}
211 \item{Wx::Image->new( width, height, data )
}
212 \item{Wx::Image->new( file, type, index )
}
213 \item{Wx::Image->new( file, mimetype, index )
}
214 \item{Wx::Image->new( stream, type, index )
}
215 \item{Wx::Image->new( stream, mimetype, index )
}
220 \membersection{wxImage::
\destruct{wxImage
}}\label{wximagedtor
}
222 \func{}{\destruct{wxImage
}}{\void}
227 \membersection{wxImage::AddHandler
}\label{wximageaddhandler
}
229 \func{static void
}{AddHandler
}{\param{wxImageHandler*
}{ handler
}}
231 Adds a handler to the end of the static list of format handlers.
233 \docparam{handler
}{A new image format handler object. There is usually only one instance
234 of a given handler class in an application session.
}
238 \helpref{wxImageHandler
}{wximagehandler
}
240 \func{bool
}{CanRead
}{\param{const wxString\&
}{ filename
}}
242 returns true if the current image handlers can read this file
244 \pythonnote{In wxPython this static method is named
{\tt wxImage
\_AddHandler}.
}
246 \membersection{wxImage::CleanUpHandlers
}\label{wximagecleanuphandlers
}
248 \func{static void
}{CleanUpHandlers
}{\void}
250 Deletes all image handlers.
252 This function is called by wxWidgets on exit.
255 \membersection{wxImage::ComputeHistogram
}\label{wximagecomputehistogram
}
257 \constfunc{unsigned long
}{ComputeHistogram
}{\param{wxImageHistogram\&
}{histogram
}}
259 Computes the histogram of the image.
{\it histogram
} is a reference to
260 wxImageHistogram object. wxImageHistogram is a specialization of
261 \helpref{wxHashMap
}{wxhashmap
} "template" and is defined as follows:
264 class WXDLLEXPORT wxImageHistogramEntry
267 wxImageHistogramEntry() : index(
0), value(
0)
{}
272 WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry,
273 wxIntegerHash, wxIntegerEqual,
277 \wxheading{Return value
}
279 Returns number of colours in the histogram.
282 \membersection{wxImage::ConvertAlphaToMask
}\label{wximageconvertalphatomask
}
284 \func{bool
}{ConvertAlphaToMask
}{\param{unsigned char
}{ threshold = $
128$
}}
286 If the image has alpha channel, this method converts it to mask. All pixels
287 with alpha value less than
\arg{threshold
} are replaced with mask colour
288 and the alpha channel is removed. Mask colour is chosen automatically using
289 \helpref{FindFirstUnusedColour
}{wximagefindfirstunusedcolour
}.
291 If the image image doesn't have alpha channel,
292 ConvertAlphaToMask does nothing.
294 \wxheading{Return value
}
296 \false if FindFirstUnusedColour returns
\false,
\true otherwise.
299 \membersection{wxImage::ConvertToBitmap
}\label{wximageconverttobitmap
}
301 \constfunc{wxBitmap
}{ConvertToBitmap
}{\void}
303 Deprecated, use equivalent
\helpref{wxBitmap constructor
}{wxbitmapctor
}
304 (which takes wxImage and depth as its arguments) instead.
307 \membersection{wxImage::ConvertToMono
}\label{wxbitmapconverttomono
}
309 \constfunc{wxImage
}{ConvertToMono
}{\param{unsigned char
}{ r
},
\param{unsigned char
}{ g
},
\param{unsigned char
}{ b
}}
311 Returns monochromatic version of the image. The returned image has white
312 colour where the original has
{\it (r,g,b)
} colour and black colour
316 \membersection{wxImage::Copy
}\label{wximagecopy
}
318 \constfunc{wxImage
}{Copy
}{\void}
320 Returns an identical copy of the image.
323 \membersection{wxImage::Create
}\label{wximagecreate
}
325 \func{bool
}{Create
}{\param{int
}{ width
},
\param{int
}{ height
},
\param{bool
}{ clear=true
}}
327 Creates a fresh image. If
{\it clear
} is true, the new image will be initialized to black.
328 Otherwise, the image data will be uninitialized.
330 \wxheading{Parameters
}
332 \docparam{width
}{The width of the image in pixels.
}
334 \docparam{height
}{The height of the image in pixels.
}
336 \wxheading{Return value
}
338 true if the call succeeded, false otherwise.
341 \membersection{wxImage::Destroy
}\label{wximagedestroy
}
343 \func{void
}{Destroy
}{\void}
345 Destroys the image data.
348 \membersection{wxImage::FindFirstUnusedColour
}\label{wximagefindfirstunusedcolour
}
350 \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}}
352 \wxheading{Parameters
}
354 \docparam{r,g,b
}{Pointers to variables to save the colour.
}
356 \docparam{startR,startG,startB
}{Initial values of the colour. Returned colour
357 will have RGB values equal to or greater than these.
}
359 Finds the first colour that is never used in the image. The search begins at
360 given initial colour and continues by increasing R, G and B components (in this
361 order) by
1 until an unused colour is found or the colour space exhausted.
363 \wxheading{Return value
}
365 Returns false if there is no unused colour left, true on success.
369 Note that this method involves computing the histogram, which is
370 computationally intensive operation.
373 \membersection{wxImage::FindHandler
}\label{wximagefindhandler
}
375 \func{static wxImageHandler*
}{FindHandler
}{\param{const wxString\&
}{name
}}
377 Finds the handler with the given name.
379 \func{static wxImageHandler*
}{FindHandler
}{\param{const wxString\&
}{extension
},
\param{long
}{ imageType
}}
381 Finds the handler associated with the given extension and type.
383 \func{static wxImageHandler*
}{FindHandler
}{\param{long
}{imageType
}}
385 Finds the handler associated with the given image type.
387 \func{static wxImageHandler*
}{FindHandlerMime
}{\param{const wxString\&
}{mimetype
}}
389 Finds the handler associated with the given MIME type.
391 \docparam{name
}{The handler name.
}
393 \docparam{extension
}{The file extension, such as ``bmp".
}
395 \docparam{imageType
}{The image type, such as wxBITMAP
\_TYPE\_BMP.
}
397 \docparam{mimetype
}{MIME type.
}
399 \wxheading{Return value
}
401 A pointer to the handler if found, NULL otherwise.
405 \helpref{wxImageHandler
}{wximagehandler
}
408 \membersection{wxImage::GetImageExtWildcard
}\label{wximagegetimageextwildcard
}
410 \func{static wxString
}{GetImageExtWildcard
}{\void}
412 Iterates all registered wxImageHandler objects, and returns a string containing file extension masks
413 suitable for passing to file open/save dialog boxes.
415 \wxheading{Return value
}
417 The format of the returned string is "
(*.ext1;*.ext2)|*.ext1;*.ext2".
419 It is usually a good idea to prepend a description before passing the result to the dialog.
424 wxFileDialog FileDlg( this, "Choose Image", ::wxGetCwd(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxOPEN );
429 \helpref{wxImageHandler}{wximagehandler}
432 \membersection{wxImage::GetAlpha}\label{wximagegetalpha}
434 \constfunc{unsigned char}{GetAlpha}{\param{int}{ x}, \param{int}{ y}}
436 Returns the alpha value for the given pixel. This function may only be called
437 for the images with alpha channel, use \helpref{HasAlpha}{wximagehasalpha} to
440 The returned value is the {\it opacity} of the image, i.e. the value of $0$
441 corresponds to the transparent pixels while the value of $255$ -- to the opaque
444 \constfunc{unsigned char *}{GetAlpha}{\void}
446 Returns pointer to the array storing the alpha values for this image. This
447 pointer is {\tt NULL} for the images without the alpha channel. If the image
448 does have it, this pointer may be used to directly manipulate the alpha values
449 which are stored as the \helpref{RGB}{wximagegetdata} ones.
452 \membersection{wxImage::GetBlue}\label{wximagegetblue}
454 \constfunc{unsigned char}{GetBlue}{\param{int}{ x}, \param{int}{ y}}
456 Returns the blue intensity at the given coordinate.
459 \membersection{wxImage::GetData}\label{wximagegetdata}
461 \constfunc{unsigned char*}{GetData}{\void}
463 Returns the image data as an array. This is most often used when doing
464 direct image manipulation. The return value points to an array of
465 characters in RGBRGBRGB$\ldots$ format in the top-to-bottom, left-to-right
466 order, that is the first RGB triplet corresponds to the pixel first pixel of
467 the first row, the second one --- to the second pixel of the first row and so
468 on until the end of the first row, with second row following after it and so
471 You should not delete the returned pointer nor pass it to
472 \helpref{wxImage::SetData}{wximagesetdata}.
475 \membersection{wxImage::GetGreen}\label{wximagegetgreen}
477 \constfunc{unsigned char}{GetGreen}{\param{int}{ x}, \param{int}{ y}}
479 Returns the green intensity at the given coordinate.
482 \membersection{wxImage::GetImageCount}\label{wximagegetimagecount}
484 \func{static int}{GetImageCount}{\param{const wxString\&}{ filename}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
486 \func{static int}{GetImageCount}{\param{wxInputStream\&}{ stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
488 If the image file contains more than one image and the image handler is capable
489 of retrieving these individually, this function will return the number of
492 \docparam{name}{Name of the file to query.}
494 \docparam{stream}{Opened input stream with image data. Currently, the stream must support seeking.}
496 \docparam{type}{May be one of the following:
500 \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.}
501 \twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
502 \twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.}
503 \twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.}
504 \twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
505 \twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
506 \twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
507 \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
508 \twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
509 \twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
510 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
511 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
514 \wxheading{Return value}
516 Number of available images. For most image handlers, this is 1 (exceptions
517 are TIFF and ICO formats).
520 \membersection{wxImage::GetHandlers}\label{wximagegethandlers}
522 \func{static wxList\&}{GetHandlers}{\void}
524 Returns the static list of image format handlers.
528 \helpref{wxImageHandler}{wximagehandler}
531 \membersection{wxImage::GetHeight}\label{wximagegetheight}
533 \constfunc{int}{GetHeight}{\void}
535 Gets the height of the image in pixels.
538 \membersection{wxImage::GetMaskBlue}\label{wximagegetmaskblue}
540 \constfunc{unsigned char}{GetMaskBlue}{\void}
542 Gets the blue value of the mask colour.
545 \membersection{wxImage::GetMaskGreen}\label{wximagegetmaskgreen}
547 \constfunc{unsigned char}{GetMaskGreen}{\void}
549 Gets the green value of the mask colour.
552 \membersection{wxImage::GetMaskRed}\label{wximagegetmaskred}
554 \constfunc{unsigned char}{GetMaskRed}{\void}
556 Gets the red value of the mask colour.
559 \membersection{wxImage::GetOrFindMaskColour}\label{wximagegetgetorsetmaskcolour}
561 \constfunc{bool}{GetOrFindMaskColour}{\param{unsigned char}{ *r}, \param{unsigned char}{ *g}, \param{unsigned char}{ *b}}
563 Get the current mask colour or find a suitable unused colour that could be
564 used as a mask colour. Returns {\tt true} if the image currently has a mask.
567 \membersection{wxImage::GetPalette}\label{wximagegetpalette}
569 \constfunc{const wxPalette\&}{GetPalette}{\void}
571 Returns the palette associated with the image. Currently the palette is only
572 used when converting to wxBitmap under Windows.
574 Eventually wxImage handlers will set the palette if one exists in the image file.
577 \membersection{wxImage::GetRed}\label{wximagegetred}
579 \constfunc{unsigned char}{GetRed}{\param{int}{ x}, \param{int}{ y}}
581 Returns the red intensity at the given coordinate.
584 \membersection{wxImage::GetSubImage}\label{wximagegetsubimage}
586 \constfunc{wxImage}{GetSubImage}{\param{const wxRect\&}{ rect}}
588 Returns a sub image of the current one as long as the rect belongs entirely to
592 \membersection{wxImage::GetWidth}\label{wximagegetwidth}
594 \constfunc{int}{GetWidth}{\void}
596 Gets the width of the image in pixels.
600 \helpref{wxImage::GetHeight}{wximagegetheight}
603 \membersection{HSVValue::HSVValue}\label{hsvvaluehsvvalue}
605 \func{}{HSVValue}{\param{double }{h = 0.0}, \param{double }{s = 0.0}, \param{double }{v = 0.0}}
607 Constructor for HSVValue, an object that contains values for hue, saturation and value which
608 represent the value of a color. It is used by \helpref{wxImage::HSVtoRGB}{wximagehsvtorgb}
609 and \helpref{wxImage::RGBtoHSV}{wximagergbtohsv}, which
610 converts between HSV color space and RGB color space.
612 \pythonnote{use wxImage\_HSVValue in wxPython}
616 \membersection{wxImage::HSVtoRGB}\label{wximagehsvtorgb}
618 \func{wxImage::RGBValue}{HSVtoRGB}{\param{const HSVValue \& }{hsv}}
620 Converts a color in HSV color space to RGB color space.
623 \membersection{wxImage::HasAlpha}\label{wximagehasalpha}
625 \constfunc{bool}{HasAlpha}{\void}
627 Returns true if this image has alpha channel, false otherwise.
631 \helpref{GetAlpha}{wximagegetalpha}, \helpref{SetAlpha}{wximagesetalpha}
634 \membersection{wxImage::HasMask}\label{wximagehasmask}
636 \constfunc{bool}{HasMask}{\void}
638 Returns true if there is a mask active, false otherwise.
641 \membersection{wxImage::GetOption}\label{wximagegetoption}
643 \constfunc{wxString}{GetOption}{\param{const wxString\&}{ name}}
645 Gets a user-defined option. The function is case-insensitive to {\it name}.
647 For example, when saving as a JPEG file, the option {\bf quality} is
648 used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
652 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
653 \helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
654 \helpref{wxImage::HasOption}{wximagehasoption}
657 \membersection{wxImage::GetOptionInt}\label{wximagegetoptionint}
659 \constfunc{int}{GetOptionInt}{\param{const wxString\&}{ name}}
661 Gets a user-defined option as an integer. The function is case-insensitive to {\it name}.
663 If the given option is not present, the function returns $0$. Use
664 \helpref{wxImage::HasOption}{wximagehasoption} is $0$ is a possibly valid value
667 Options for wxPNGHandler
670 \twocolitem{wxIMAGE\_OPTION\_PNG\_FORMAT}{Format for saving a PNG file.}
671 \twocolitem{wxIMAGE\_OPTION\_PNG\_BITDEPTH}{Bit depth for every channel (R/G/B/A).}
674 Supported values for wxIMAGE\_OPTION\_PNG\_FORMAT:
677 \twocolitem{wxPNG\_TYPE\_COLOUR}{Stores RGB image.}
678 \twocolitem{wxPNG\_TYPE\_GREY}{Stores grey image, converts from RGB.}
679 \twocolitem{wxPNG\_TYPE\_GREY\_RED}{Stores grey image, uses red value as grey.}
685 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
686 \helpref{wxImage::GetOption}{wximagegetoption}
689 \membersection{wxImage::HasOption}\label{wximagehasoption}
691 \constfunc{bool}{HasOption}{\param{const wxString\&}{ name}}
693 Returns true if the given option is present. The function is case-insensitive to {\it name}.
697 \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
698 \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
699 \helpref{wxImage::GetOptionInt}{wximagegetoptionint}
702 \membersection{wxImage::InitAlpha}\label{wximageinitalpha}
704 \func{void}{InitAlpha}{\void}
706 Initializes the image alpha channel data. It is an error to call it
707 if the image already has alpha data. If it doesn't, alpha data will be
708 by default initialized to all pixels being fully opaque. But if the image has a
709 a mask colour, all mask pixels will be completely transparent.
712 \membersection{wxImage::InitStandardHandlers}\label{wximageinitstandardhandlers}
714 \func{static void}{InitStandardHandlers}{\void}
716 Internal use only. Adds standard image format handlers. It only install BMP
717 for the time being, which is used by wxBitmap.
719 This function is called by wxWidgets on startup, and shouldn't be called by
724 \helpref{wxImageHandler}{wximagehandler},
725 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
728 \membersection{wxImage::InsertHandler}\label{wximageinserthandler}
730 \func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}}
732 Adds a handler at the start of the static list of format handlers.
734 \docparam{handler}{A new image format handler object. There is usually only one instance
735 of a given handler class in an application session.}
739 \helpref{wxImageHandler}{wximagehandler}
742 \membersection{wxImage::IsTransparent}\label{wximageistransparent}
744 \constfunc{bool}{IsTransparent}{\param{int }{x}, \param{int }{y}, \param{unsigned char}{ threshold = $128$}}
746 Returns \true if the given pixel is transparent, i.e. either has the mask
747 colour if this image has a mask or if this image has alpha channel and alpha
748 value of this pixel is strictly less than \arg{threshold}.
751 \membersection{wxImage::LoadFile}\label{wximageloadfile}
753 \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}}
755 \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
757 Loads an image from a file. If no handler type is provided, the library will
758 try to autodetect the format.
760 \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}, \param{int}{ index = -1}}
762 \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
764 Loads an image from an input stream.
766 \wxheading{Parameters}
768 \docparam{name}{Name of the file from which to load the image.}
770 \docparam{stream}{Opened input stream from which to load the image. Currently, the stream must support seeking.}
772 \docparam{type}{One of the following values:
776 \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.}
777 \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF image file.}
778 \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Load a JPEG image file.}
779 \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Load a PCX image file.}
780 \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.}
781 \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.}
782 \twocolitem{{\bf wxBITMAP\_TYPE\_TIF}}{Load a TIFF image file.}
783 \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load a XPM image file.}
784 \twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
785 \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
786 \twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
787 \twocolitem{{\bf wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
790 \docparam{mimetype}{MIME type string (for example 'image/jpeg')}
792 \docparam{index}{Index of the image to load in the case that the image file contains multiple images.
793 This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
794 "choose the default image" and is interpreted as the first image (index=0) by
795 the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
799 Depending on how wxWidgets has been configured, not all formats may be available.
801 Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
802 hotspot for loaded cursor file:
804 int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
805 int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
809 \wxheading{Return value}
811 true if the operation succeeded, false otherwise. If the optional index parameter is out of range,
812 false is returned and a call to wxLogError() takes place.
816 \helpref{wxImage::SaveFile}{wximagesavefile}
818 \pythonnote{In place of a single overloaded method name, wxPython
819 implements the following methods:\par
820 \indented{2cm}{\begin{twocollist}
821 \twocolitem{{\bf LoadFile(filename, type)}}{Loads an image of the given
823 \twocolitem{{\bf LoadMimeFile(filename, mimetype)}}{Loads an image of the given
824 mimetype from a file}
828 \perlnote{Methods supported by wxPerl are:\par
830 \item{bitmap->LoadFile( name, type )}
831 \item{bitmap->LoadFile( name, mimetype )}
837 \membersection{wxImage::Ok}\label{wximageok}
839 \constfunc{bool}{Ok}{\void}
841 Returns true if image data is present.
844 \membersection{RGBValue::RGBValue}\label{rgbvaluergbvalue}
846 \func{}{RGBValue}{\param{unsigned char }{r = 0}, \param{unsigned char }{g = 0}, \param{unsigned char }{b = 0}}
848 Constructor for RGBValue, an object that contains values for red, green and blud which
849 represent the value of a color. It is used by \helpref{wxImage::HSVtoRGB}{wximagehsvtorgb}
850 and \helpref{wxImage::RGBtoHSV}{wximagergbtohsv}, which
851 converts between HSV color space and RGB color space.
853 \pythonnote{use wxImage\_RGBValue in wxPython}
856 \membersection{wxImage::RGBtoHSV}\label{wximagergbtohsv}
858 \func{wxImage::HSVValue}{RGBtoHSV}{\param{const RGBValue\& }{rgb}}
860 Converts a color in RGB color space to HSV color space.
863 \membersection{wxImage::RemoveHandler}\label{wximageremovehandler}
865 \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}}
867 Finds the handler with the given name, and removes it. The handler
870 \docparam{name}{The handler name.}
872 \wxheading{Return value}
874 true if the handler was found and removed, false otherwise.
878 \helpref{wxImageHandler}{wximagehandler}
881 \membersection{wxImage::Mirror}\label{wximagemirror}
883 \constfunc{wxImage}{Mirror}{\param{bool}{ horizontally = true}}
885 Returns a mirrored copy of the image. The parameter {\it horizontally}
886 indicates the orientation.
889 \membersection{wxImage::Replace}\label{wximagereplace}
891 \func{void}{Replace}{\param{unsigned char}{ r1}, \param{unsigned char}{ g1}, \param{unsigned char}{ b1},
892 \param{unsigned char}{ r2}, \param{unsigned char}{ g2}, \param{unsigned char}{ b2}}
894 Replaces the colour specified by {\it r1,g1,b1} by the colour {\it r2,g2,b2}.
897 \membersection{wxImage::Rescale}\label{wximagerescale}
899 \func{wxImage \&}{Rescale}{\param{int}{ width}, \param{int}{ height}}
901 Changes the size of the image in-place by scaling it: after a call to this function,
902 the image will have the given width and height.
904 Returns the (modified) image itself.
908 \helpref{Scale}{wximagescale}
911 \membersection{wxImage::Resize}\label{wximageresize}
913 \func{wxImage \&}{Resize}{\param{const wxSize\&}{ size}, \param{const wxPoint&}{ pos}, \param{int}{ red = -1}, \param{int}{ green = -1}, \param{int}{ blue = -1}}
915 Changes the size of the image in-place without scaling it by adding either a border
916 with the given colour or cropping as necessary. The image is pasted into a new
917 image with the given {\it size} and background colour at the position {\it pos}
918 relative to the upper left of the new image. If {\it red = green = blue = -1}
919 then use either the current mask colour if set or find, use, and set a
920 suitable mask colour for any newly exposed areas.
922 Returns the (modified) image itself.
926 \helpref{Size}{wximagesize}
929 \membersection{wxImage::Rotate}\label{wximagerotate}
931 \func{wxImage}{Rotate}{\param{double}{ angle}, \param{const wxPoint\& }{rotationCentre},
932 \param{bool}{ interpolating = true}, \param{wxPoint*}{ offsetAfterRotation = NULL}}
934 Rotates the image about the given point, by {\it angle} radians. Passing true
935 to {\it interpolating} results in better image quality, but is slower. If the
936 image has a mask, then the mask colour is used for the uncovered pixels in the
937 rotated image background. Else, black (rgb 0, 0, 0) will be used.
939 Returns the rotated image, leaving this image intact.
942 \membersection{wxImage::RotateHue}\label{wximagerotatehue}
944 \func{void}{RotateHue}{\param{double}{ angle}}
946 Rotates the hue of each pixel in the image by {\it angle}, which is a double in
947 the range of -1.0 to +1.0, where -1.0 corresponds to -360 degrees and +1.0 corresponds
951 \membersection{wxImage::Rotate90}\label{wximagerotate90}
953 \constfunc{wxImage}{Rotate90}{\param{bool}{ clockwise = true}}
955 Returns a copy of the image rotated 90 degrees in the direction
956 indicated by {\it clockwise}.
959 \membersection{wxImage::SaveFile}\label{wximagesavefile}
961 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}}
963 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}}
965 Saves an image in the named file.
967 \constfunc{bool}{SaveFile}{\param{const wxString\& }{name}}
969 Saves an image in the named file. File type is determined from the extension of the
970 file name. Note that this function may fail if the extension is not recognized! You
971 can use one of the forms above to save images to files with non-standard extensions.
973 \constfunc{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int}{ type}}
975 \constfunc{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{const wxString\&}{ mimetype}}
977 Saves an image in the given stream.
979 \wxheading{Parameters}
981 \docparam{name}{Name of the file to save the image to.}
983 \docparam{stream}{Opened output stream to save the image to.}
985 \docparam{type}{Currently these types can be used:
989 \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a BMP image file.}
990 \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Save a JPEG image file.}
991 \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.}
992 \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Save a PCX image file (tries to save as 8-bit if possible, falls back to 24-bit otherwise).}
993 \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Save a PNM image file (as raw RGB always).}
994 \twocolitem{{\bf wxBITMAP\_TYPE\_TIFF}}{Save a TIFF image file.}
995 \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save a XPM image file.}
996 \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).}
997 \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Save a Windows cursor file (CUR).}
1000 \docparam{mimetype}{MIME type.}
1002 \wxheading{Return value}
1004 true if the operation succeeded, false otherwise.
1008 Depending on how wxWidgets has been configured, not all formats may be available.
1010 Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to set the
1011 hotspot before saving an image into a cursor file (default hotspot is in
1012 the centre of the image):
1014 image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotspotX);
1015 image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotspotY);
1019 \wxheading{See also}
1021 \helpref{wxImage::LoadFile}{wximageloadfile}
1023 \pythonnote{In place of a single overloaded method name, wxPython
1024 implements the following methods:\par
1025 \indented{2cm}{\begin{twocollist}
1026 \twocolitem{{\bf SaveFile(filename, type)}}{Saves the image using the given
1027 type to the named file}
1028 \twocolitem{{\bf SaveMimeFile(filename, mimetype)}}{Saves the image using the given
1029 mimetype to the named file}
1033 \perlnote{Methods supported by wxPerl are:\par
1035 \item{bitmap->SaveFile( name, type )}
1036 \item{bitmap->SaveFile( name, mimetype )}
1041 \membersection{wxImage::Scale}\label{wximagescale}
1043 \constfunc{wxImage}{Scale}{\param{int}{ width}, \param{int}{ height}}
1045 Returns a scaled version of the image. This is also useful for
1046 scaling bitmaps in general as the only other way to scale bitmaps
1047 is to blit a wxMemoryDC into another wxMemoryDC.
1049 It may be mentioned that the GTK port uses this function internally
1050 to scale bitmaps when using mapping modes in wxDC.
1055 // get the bitmap from somewhere
1058 // rescale it to have size of 32*32
1059 if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 )
1061 wxImage image = bmp.ConvertToImage();
1062 bmp = wxBitmap(image.Scale(32, 32));
1064 // another possibility:
1065 image.Rescale(32, 32);
1071 \wxheading{See also}
1073 \helpref{Rescale}{wximagerescale}
1076 \membersection{wxImage::Size}\label{wximagesize}
1078 \constfunc{wxImage}{Size}{\param{const wxSize\&}{ size}, \param{const wxPoint&}{ pos}, \param{int}{ red = -1}, \param{int}{ green = -1}, \param{int}{ blue = -1}}
1080 Returns a resized version of this image without scaling it by adding either a border
1081 with the given colour or cropping as necessary. The image is pasted into a new
1082 image with the given {\it size} and background colour at the position {\it pos}
1083 relative to the upper left of the new image. If {\it red = green = blue = -1}
1084 then use either the current mask colour if set or find, use, and set a
1085 suitable mask colour for any newly exposed areas.
1087 \wxheading{See also}
1089 \helpref{Resize}{wximageresize}
1092 \membersection{wxImage::SetAlpha}\label{wximagesetalpha}
1094 \func{void}{SetAlpha}{\param{unsigned char *}{alpha = {\tt NULL}},\param{bool}{ static\_data = \false}}
1096 This function is similar to \helpref{SetData}{wximagesetdata} and has similar
1097 restrictions. The pointer passed to it may however be {\tt NULL} in which case
1098 the function will allocate the alpha array internally -- this is useful to add
1099 alpha channel data to an image which doesn't have any. If the pointer is not
1100 {\tt NULL}, it must have one byte for each image pixel and be allocated with
1101 {\tt malloc()}. wxImage takes ownership of the pointer and will free it unless
1102 \arg{static\_data} parameter is set to \true -- in this case the caller should
1105 \func{void}{SetAlpha}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{alpha}}
1107 Sets the alpha value for the given pixel. This function should only be called
1108 if the image has alpha channel data, use \helpref{HasAlpha}{wximagehasalpha} to
1112 \membersection{wxImage::SetData}\label{wximagesetdata}
1114 \func{void}{SetData}{\param{unsigned char*}{data}}
1116 Sets the image data without performing checks. The data given must have
1117 the size (width*height*3) or results will be unexpected. Don't use this
1118 method if you aren't sure you know what you are doing.
1120 The data must have been allocated with {\tt malloc()}, {\large {\bf NOT}} with
1123 After this call the pointer to the data is owned by the wxImage object,
1124 that will be responsible for deleting it.
1125 Do not pass to this function a pointer obtained through
1126 \helpref{wxImage::GetData}{wximagegetdata}.
1129 \membersection{wxImage::SetMask}\label{wximagesetmask}
1131 \func{void}{SetMask}{\param{bool}{ hasMask = true}}
1133 Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.
1136 \membersection{wxImage::SetMaskColour}\label{wximagesetmaskcolour}
1138 \func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1140 Sets the mask colour for this image (and tells the image to use the mask).
1143 \membersection{wxImage::SetMaskFromImage}\label{wximagesetmaskfromimage}
1145 \func{bool}{SetMaskFromImage}{\param{const wxImage\&}{ mask}, \param{unsigned char}{ mr}, \param{unsigned char}{ mg}, \param{unsigned char}{ mb}}
1147 \wxheading{Parameters}
1149 \docparam{mask}{The mask image to extract mask shape from. Must have same dimensions as the image.}
1151 \docparam{mr,mg,mb}{RGB value of pixels in {\it mask} that will be used to create the mask.}
1153 Sets image's mask so that the pixels that have RGB value of {\it mr,mg,mb}
1154 in {\it mask} will be masked in the image. This is done by first finding an
1155 unused colour in the image, setting this colour as the mask colour and then
1156 using this colour to draw all pixels in the image who corresponding pixel
1157 in {\it mask} has given RGB value.
1159 \wxheading{Return value}
1161 Returns false if {\it mask} does not have same dimensions as the image or if
1162 there is no unused colour left. Returns true if the mask was successfully
1167 Note that this method involves computing the histogram, which is
1168 computationally intensive operation.
1171 \membersection{wxImage::SetOption}\label{wximagesetoption}
1173 \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{const wxString\&}{ value}}
1175 \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{int}{ value}}
1177 Sets a user-defined option. The function is case-insensitive to {\it name}.
1179 For example, when saving as a JPEG file, the option {\bf quality} is
1180 used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
1182 \wxheading{See also}
1184 \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
1185 \helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
1186 \helpref{wxImage::HasOption}{wximagehasoption}
1189 \membersection{wxImage::SetPalette}\label{wximagesetpalette}
1191 \func{void}{SetPalette}{\param{const wxPalette\&}{ palette}}
1193 Associates a palette with the image. The palette may be used when converting
1194 wxImage to wxBitmap (MSW only at present) or in file save operations (none as yet).
1197 \membersection{wxImage::SetRGB}\label{wximagesetrgb}
1199 \func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1201 Sets the pixel at the given coordinate. This routine performs bounds-checks
1202 for the coordinate so it can be considered a safe way to manipulate the
1203 data, but in some cases this might be too slow so that the data will have to
1204 be set directly. In that case you will have to get access to the image data
1205 using the \helpref{GetData}{wximagegetdata} method.
1208 \membersection{wxImage::SetRGB}\label{wximagesetrgbrect}
1210 \func{void}{SetRGB}{\param{wxRect \& }{rect}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1212 Sets the colour of the pixels within the given rectangle. This routine performs
1213 bounds-checks for the coordinate so it can be considered a safe way to manipulate the
1217 \membersection{wxImage::operator $=$}\label{wximageassign}
1219 \func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}
1221 Assignment operator. This operator does not copy any data, but instead
1222 passes a pointer to the data in {\it image} and increments a reference
1223 counter. It is a fast operation.
1225 \wxheading{Parameters}
1227 \docparam{image}{Image to assign.}
1229 \wxheading{Return value}
1231 Returns 'this' object.
1234 \membersection{wxImage::operator $==$}\label{wximageequal}
1236 \constfunc{bool}{operator $==$}{\param{const wxImage\& }{image}}
1238 Equality operator. This operator tests whether the internal data pointers are
1239 equal (a fast test).
1241 \wxheading{Parameters}
1243 \docparam{image}{Image to compare with 'this'}
1245 \wxheading{Return value}
1247 Returns true if the images were effectively equal, false otherwise.
1250 \membersection{wxImage::operator $!=$}\label{wximagenotequal}
1252 \constfunc{bool}{operator $!=$}{\param{const wxImage\& }{image}}
1254 Inequality operator. This operator tests whether the internal data pointers are
1255 unequal (a fast test).
1257 \wxheading{Parameters}
1259 \docparam{image}{Image to compare with 'this'}
1261 \wxheading{Return value}
1263 Returns true if the images were unequal, false otherwise.
1265 \section{\class{wxImageHandler}}\label{wximagehandler}
1267 This is the base class for implementing image file loading/saving, and image creation from data.
1268 It is used within wxImage and is not normally seen by the application.
1270 If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler
1271 and add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in your
1272 application initialisation.
1274 \wxheading{Note (Legal Issue)}
1276 This software is based in part on the work of the Independent JPEG Group.
1278 (Applies when wxWidgets is linked with JPEG support. wxJPEGHandler uses libjpeg
1281 \wxheading{Derived from}
1283 \helpref{wxObject}{wxobject}
1285 \wxheading{Include files}
1289 \wxheading{See also}
1291 \helpref{wxImage}{wximage},
1292 \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
1294 \latexignore{\rtfignore{\wxheading{Members}}}
1297 \membersection{wxImageHandler::wxImageHandler}\label{wximagehandlerctor}
1299 \func{}{wxImageHandler}{\void}
1301 Default constructor. In your own default constructor, initialise the members
1302 m\_name, m\_extension and m\_type.
1305 \membersection{wxImageHandler::\destruct{wxImageHandler}}\label{wximagehandlerdtor}
1307 \func{}{\destruct{wxImageHandler}}{\void}
1309 Destroys the wxImageHandler object.
1312 \membersection{wxImageHandler::GetName}\label{wximagehandlergetname}
1314 \constfunc{wxString}{GetName}{\void}
1316 Gets the name of this handler.
1319 \membersection{wxImageHandler::GetExtension}\label{wximagehandlergetextension}
1321 \constfunc{wxString}{GetExtension}{\void}
1323 Gets the file extension associated with this handler.
1326 \membersection{wxImageHandler::GetImageCount}\label{wximagehandlergetimagecount}
1328 \func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}}
1330 If the image file contains more than one image and the image handler is capable
1331 of retrieving these individually, this function will return the number of
1334 \docparam{stream}{Opened input stream for reading image data. Currently, the stream must support seeking.}
1336 \wxheading{Return value}
1338 Number of available images. For most image handlers, this is 1 (exceptions
1339 are TIFF and ICO formats).
1342 \membersection{wxImageHandler::GetType}\label{wximagehandlergettype}
1344 \constfunc{long}{GetType}{\void}
1346 Gets the image type associated with this handler.
1349 \membersection{wxImageHandler::GetMimeType}\label{wximagehandlergetmimetype}
1351 \constfunc{wxString}{GetMimeType}{\void}
1353 Gets the MIME type associated with this handler.
1356 \membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile}
1358 \func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}, \param{bool}{ verbose=true}, \param{int}{ index=0}}
1360 Loads a image from a stream, putting the resulting data into {\it image}. If the image file contains
1361 more than one image and the image handler is capable of retrieving these individually, {\it index}
1362 indicates which image to read from the stream.
1364 \wxheading{Parameters}
1366 \docparam{image}{The image object which is to be affected by this operation.}
1368 \docparam{stream}{Opened input stream for reading image data.}
1370 \docparam{verbose}{If set to true, errors reported by the image handler will produce wxLogMessages.}
1372 \docparam{index}{The index of the image in the file (starting from zero).}
1374 \wxheading{Return value}
1376 true if the operation succeeded, false otherwise.
1378 \wxheading{See also}
1380 \helpref{wxImage::LoadFile}{wximageloadfile},
1381 \helpref{wxImage::SaveFile}{wximagesavefile},
1382 \helpref{wxImageHandler::SaveFile}{wximagehandlersavefile}
1385 \membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile}
1387 \func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}}
1389 Saves a image in the output stream.
1391 \wxheading{Parameters}
1393 \docparam{image}{The image object which is to be affected by this operation.}
1395 \docparam{stream}{Opened output stream for writing the data.}
1397 \wxheading{Return value}
1399 true if the operation succeeded, false otherwise.
1401 \wxheading{See also}
1403 \helpref{wxImage::LoadFile}{wximageloadfile},
1404 \helpref{wxImage::SaveFile}{wximagesavefile},
1405 \helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile}
1408 \membersection{wxImageHandler::SetName}\label{wximagehandlersetname}
1410 \func{void}{SetName}{\param{const wxString\& }{name}}
1412 Sets the handler name.
1414 \wxheading{Parameters}
1416 \docparam{name}{Handler name.}
1419 \membersection{wxImageHandler::SetExtension}\label{wximagehandlersetextension}
1421 \func{void}{SetExtension}{\param{const wxString\& }{extension}}
1423 Sets the handler extension.
1425 \wxheading{Parameters}
1427 \docparam{extension}{Handler extension.}
1430 \membersection{wxImageHandler::SetMimeType}\label{wximagehandlersetmimetype}
1432 \func{void}{SetMimeType}{\param{const wxString\& }{mimetype}}
1434 Sets the handler MIME type.
1436 \wxheading{Parameters}
1438 \docparam{mimename}{Handler MIME type.}
1441 \membersection{wxImageHandler::SetType}\label{wximagehandlersettype}
1443 \func{void}{SetType}{\param{long }{type}}
1445 Sets the handler type.
1447 \wxheading{Parameters}
1449 \docparam{name}{Handler type.}