1998-12-20 18:49:21 -05:00
\section { \class { wxImage} } \label { wximage}
This class encapsulates a platform-independent image. An image can be created
2001-04-21 19:18:05 -04:00
from data, or using \helpref { wxBitmap::ConvertToImage} { wxbitmapconverttoimage} . An image
1998-12-20 18:49:21 -05:00
can be loaded from a file in a variety of formats, and is extensible to new formats
via image format handlers. Functions are available to set and get image bits, so
it can be used for basic image manipulation.
1999-12-27 09:27:05 -05:00
A wxImage cannot (currently) be drawn directly to a \helpref { wxDC} { wxdc} . Instead,
a platform-specific \helpref { wxBitmap} { wxbitmap} object must be created from it using
2001-04-21 19:18:05 -04:00
the \helpref { wxBitmap::wxBitmap(wxImage,int depth)} { wxbitmapconstr} constructor.
This bitmap can then
1999-12-27 09:27:05 -05:00
be drawn in a device context, using \helpref { wxDC::DrawBitmap} { wxdcdrawbitmap} .
One colour value of the image may be used as a mask colour which will lead to the automatic
creation of a \helpref { wxMask} { wxmask} object associated to the bitmap object.
1999-01-09 10:53:52 -05:00
2000-01-21 00:56:25 -05:00
\wxheading { Available image handlers}
The following image handlers are available. { \bf wxBMPHandler} is always
2002-06-07 16:15:28 -04:00
installed by default. To use other image formats, install the appropriate
2000-03-14 19:21:49 -05:00
handler with \helpref { wxImage::AddHandler} { wximageaddhandler} or
2000-01-21 00:56:25 -05:00
\helpref { wxInitAllImageHandlers} { wxinitallimagehandlers} .
\twocolwidtha { 5cm} %
\begin { twocollist}
2002-03-17 06:34:32 -05:00
\twocolitem { \indexit { wxBMPHandler} } { For loading and saving, always installed.}
2000-12-22 08:34:13 -05:00
\twocolitem { \indexit { wxPNGHandler} } { For loading and saving.}
\twocolitem { \indexit { wxJPEGHandler} } { For loading and saving.}
\twocolitem { \indexit { wxGIFHandler} } { Only for loading, due to legal issues.}
\twocolitem { \indexit { wxPCXHandler} } { For loading and saving (see below).}
\twocolitem { \indexit { wxPNMHandler} } { For loading and saving (see below).}
2001-04-28 19:30:35 -04:00
\twocolitem { \indexit { wxTIFFHandler} } { For loading and saving.}
2002-03-17 06:34:32 -05:00
\twocolitem { \indexit { wxIFFHandler} } { For loading only.}
2001-04-28 19:30:35 -04:00
\twocolitem { \indexit { wxXPMHandler} } { For loading and saving.}
2001-11-27 13:14:09 -05:00
\twocolitem { \indexit { wxICOHandler} } { For loading and saving.}
2002-01-01 18:13:54 -05:00
\twocolitem { \indexit { wxCURHandler} } { For loading and saving.}
2002-03-17 06:34:32 -05:00
\twocolitem { \indexit { wxANIHandler} } { For loading only.}
2000-01-21 00:56:25 -05:00
\end { twocollist}
When saving in PCX format, { \bf wxPCXHandler} will count the number of
different colours in the image; if there are 256 or less colours, it will
save as 8 bit, else it will save as 24 bit.
Loading PNMs only works for ASCII or raw RGB images. When saving in
PNM format, { \bf wxPNMHandler} will always save as raw RGB.
1998-12-20 18:49:21 -05:00
\wxheading { Derived from}
\helpref { wxObject} { wxobject}
1999-02-15 15:41:29 -05:00
\wxheading { Include files}
<wx/image.h>
1998-12-20 18:49:21 -05:00
\wxheading { See also}
2000-01-30 08:43:37 -05:00
\helpref { wxBitmap} { wxbitmap} ,
1999-09-20 15:05:49 -04:00
\helpref { wxInitAllImageHandlers} { wxinitallimagehandlers}
1998-12-20 18:49:21 -05:00
\latexignore { \rtfignore { \wxheading { Members} } }
\membersection { wxImage::wxImage} \label { wximageconstr}
\func { } { wxImage} { \void }
Default constructor.
\func { } { wxImage} { \param { const wxImage\& } { image} }
Copy constructor.
\func { } { wxImage} { \param { const wxBitmap\& } { bitmap} }
2001-04-21 19:18:05 -04:00
(Deprecated form, use \helpref { wxBitmap::ConvertToImage} { wxbitmapconverttoimage}
instead.) Constructs an image from a platform-dependent bitmap. This preserves
1999-01-09 10:53:52 -05:00
mask information so that bitmaps and images can be converted back
and forth without loss in that respect.
1998-12-20 18:49:21 -05:00
\func { } { wxImage} { \param { int} { width} , \param { int} { height} }
Creates an image with the given width and height.
2003-01-17 19:16:34 -05:00
\func { } { wxImage} { \param { int} { width} , \param { int} { height} , \param { unsigned char*} { data} , \param { bool} { static\_ data=false} }
2000-07-15 15:51:35 -04:00
Creates an image from given data with the given width and height. If
2003-01-17 19:16:34 -05:00
{ \it static\_ data} is true, then wxImage will not delete the actual
2000-07-15 15:51:35 -04:00
image data in its destructor, otherwise it will free it by calling
{ \it free()} .
2002-01-01 18:13:54 -05:00
\func { } { wxImage} { \param { const wxString\& } { name} , \param { long} { type = wxBITMAP\_ TYPE\_ ANY} , \param { int} { index = -1} }
1998-12-20 18:49:21 -05:00
2002-01-01 18:13:54 -05:00
\func { } { wxImage} { \param { const wxString\& } { name} , \param { const wxString\& } { mimetype} , \param { int} { index = -1} }
1999-04-11 15:07:17 -04:00
1998-12-20 18:49:21 -05:00
Loads an image from a file.
2002-01-01 18:13:54 -05:00
\func { } { wxImage} { \param { wxInputStream\& } { stream} , \param { long} { type = wxBITMAP\_ TYPE\_ ANY} , \param { int} { index = -1} }
1999-01-10 07:04:02 -05:00
2002-01-01 18:13:54 -05:00
\func { } { wxImage} { \param { wxInputStream\& } { stream} , \param { const wxString\& } { mimetype} , \param { int} { index = -1} }
1999-04-11 15:07:17 -04:00
1999-01-10 07:04:02 -05:00
Loads an image from an input stream.
1998-12-20 18:49:21 -05:00
\wxheading { Parameters}
\docparam { width} { Specifies the width of the image.}
\docparam { height} { Specifies the height of the image.}
2000-01-24 19:33:42 -05:00
\docparam { name} { Name of the file from which to load the image.}
1998-12-20 18:49:21 -05:00
2000-01-24 19:33:42 -05:00
\docparam { stream} { Opened input stream from which to load the image. Currently, the stream must support seeking.}
1999-01-10 07:04:02 -05:00
1998-12-20 18:49:21 -05:00
\docparam { type} { May be one of the following:
1999-01-12 13:28:34 -05:00
\twocolwidtha { 5cm} %
1998-12-20 18:49:21 -05:00
\begin { twocollist}
2000-12-22 08:34:13 -05:00
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ BMP} } { Load a Windows bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ GIF} } { Load a GIF bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ JPEG} } { Load a JPEG bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ PNG} } { Load a PNG bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ PCX} } { Load a PCX bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ PNM} } { Load a PNM bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ TIF} } { Load a TIFF bitmap file.}
2001-04-28 19:30:35 -04:00
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ XPM} } { Load a XPM bitmap file.}
2002-01-01 18:13:54 -05:00
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ ICO} } { Load a Windows icon file (ICO).}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ CUR} } { Load a Windows cursor file (CUR).}
2002-01-13 07:01:42 -05:00
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ ANI} } { Load a Windows animated cursor file (ANI).}
2000-12-22 08:34:13 -05:00
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ ANY} } { Will try to autodetect the format.}
2000-01-24 19:33:42 -05:00
\end { twocollist} }
1998-12-20 18:49:21 -05:00
1999-04-11 15:07:17 -04:00
\docparam { mimetype} { MIME type string (for example 'image/jpeg')}
2002-01-01 18:13:54 -05:00
\docparam { index} { Index of the image to load in the case that the image file contains multiple images.
2002-03-15 18:59:09 -05:00
This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
2002-01-01 18:13:54 -05:00
"choose the default image" and is interpreted as the first image (index=0) by
2002-03-15 18:59:09 -05:00
the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
2002-01-01 18:13:54 -05:00
2000-01-24 19:33:42 -05:00
\wxheading { Remarks}
Depending on how wxWindows has been configured, not all formats may be available.
2000-03-14 19:21:49 -05:00
Note: any handler other than BMP must be previously
initialized with \helpref { wxImage::AddHandler} { wximageaddhandler} or
2000-01-24 19:33:42 -05:00
\helpref { wxInitAllImageHandlers} { wxinitallimagehandlers} .
1999-02-04 05:58:33 -05:00
2002-01-01 18:13:54 -05:00
Note: you can use \helpref { GetOptionInt} { wximagegetoptionint} to get the
hotspot for loaded cursor file:
\begin { verbatim}
2002-02-15 20:45:30 -05:00
int hotspot_ x = image.GetOptionInt(wxIMAGE_ OPTION_ CUR_ HOTSPOT_ X);
int hotspot_ y = image.GetOptionInt(wxIMAGE_ OPTION_ CUR_ HOTSPOT_ Y);
2002-01-01 18:13:54 -05:00
\end { verbatim}
1998-12-20 18:49:21 -05:00
\wxheading { See also}
\helpref { wxImage::LoadFile} { wximageloadfile}
1999-04-29 12:12:07 -04:00
\pythonnote { Constructors supported by wxPython are:\par
\indented { 2cm} { \begin { twocollist}
1999-12-25 15:34:56 -05:00
\twocolitem { { \bf wxImage(name, flag)} } { Loads an image from a file}
\twocolitem { { \bf wxNullImage()} } { Create a null image (has no size or
1999-04-29 12:12:07 -04:00
image data)}
1999-12-25 15:34:56 -05:00
\twocolitem { { \bf wxEmptyImage(width, height)} } { Creates an empty image
1999-04-29 12:12:07 -04:00
of the given size}
1999-12-25 15:34:56 -05:00
\twocolitem { { \bf wxImageFromMime(name, mimetype} } { Creates an image from
1999-04-29 12:12:07 -04:00
the given file of the given mimetype}
1999-12-25 15:34:56 -05:00
\twocolitem { { \bf wxImageFromBitmap(bitmap)} } { Creates an image from a
1999-04-29 12:12:07 -04:00
platform-dependent bitmap}
\end { twocollist} }
}
2000-12-20 11:10:46 -05:00
\perlnote { Constructors supported by wxPerl are:\par
\begin { itemize}
\item { Wx::Image->new( bitmap )}
\item { Wx::Image->new( width, height )}
\item { Wx::Image->new( name, type )}
\item { Wx::Image->new( name, mimetype )}
\end { itemize}
}
1998-12-20 18:49:21 -05:00
\membersection { wxImage::\destruct { wxImage} }
\func { } { \destruct { wxImage} } { \void }
Destructor.
\membersection { wxImage::AddHandler} \label { wximageaddhandler}
\func { static void} { AddHandler} { \param { wxImageHandler*} { handler} }
Adds a handler to the end of the static list of format handlers.
\docparam { handler} { A new image format handler object. There is usually only one instance
of a given handler class in an application session.}
\wxheading { See also}
\helpref { wxImageHandler} { wximagehandler}
2002-03-17 06:34:32 -05:00
\func { bool} { CanRead} { \param { const wxString\& } { filename} }
2003-01-17 19:16:34 -05:00
returns true if the current image handlers can read this file
2002-03-17 06:34:32 -05:00
2001-05-24 06:39:33 -04:00
\pythonnote { In wxPython this static method is named { \tt wxImage\_ AddHandler} .}
1998-12-20 18:49:21 -05:00
\membersection { wxImage::CleanUpHandlers}
\func { static void} { CleanUpHandlers} { \void }
Deletes all image handlers.
This function is called by wxWindows on exit.
2002-02-07 19:16:44 -05:00
\membersection { wxImage::ComputeHistogram} \label { wximagecomputehistogram}
\constfunc { unsigned long} { ComputeHistogram} { \param { wxImageHistogram\& } { histogram} }
Computes the histogram of the image. { \it histogram} is a reference to
wxImageHistogram object. wxImageHistogram is a specialization of
\helpref { wxHashMap} { wxhashmap} "template" and is defined as follows:
\begin { verbatim}
class WXDLLEXPORT wxImageHistogramEntry
{
public:
wxImageHistogramEntry() : index(0), value(0) { }
unsigned long index;
unsigned long value;
} ;
WX_ DECLARE_ EXPORTED_ HASH_ MAP(unsigned long, wxImageHistogramEntry,
wxIntegerHash, wxIntegerEqual,
wxImageHistogram);
\end { verbatim}
\wxheading { Return value}
Returns number of colours in the histogram.
1998-12-20 18:49:21 -05:00
\membersection { wxImage::ConvertToBitmap} \label { wximageconverttobitmap}
\constfunc { wxBitmap} { ConvertToBitmap} { \void }
2001-04-21 19:18:05 -04:00
Deprecated, use equivalent \helpref { wxBitmap constructor} { wxbitmapconstr}
(which takes wxImage and depth as its arguments) instead.
1999-12-27 09:27:05 -05:00
2001-04-21 19:18:05 -04:00
\membersection { wxImage::ConvertToMono} \label { wxbitmapconverttomono}
1998-12-20 18:49:21 -05:00
2001-04-21 19:18:05 -04:00
\constfunc { wxImage} { ConvertToMono} { \param { unsigned char} { r} , \param { unsigned char} { g} , \param { unsigned char} { b} }
Returns monochromatic version of the image. The returned image has white
colour where the original has { \it (r,g,b)} colour and black colour
everywhere else.
2000-08-08 02:11:51 -04:00
2000-07-15 15:51:35 -04:00
\membersection { wxImage::Copy} \label { wximagecopy}
\constfunc { wxImage} { Copy} { \void }
Returns an identical copy of the image.
1998-12-20 18:49:21 -05:00
\membersection { wxImage::Create} \label { wximagecreate}
\func { bool} { Create} { \param { int} { width} , \param { int} { height} }
Creates a fresh image.
\wxheading { Parameters}
\docparam { width} { The width of the image in pixels.}
\docparam { height} { The height of the image in pixels.}
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
true if the call succeeded, false otherwise.
1998-12-20 18:49:21 -05:00
\membersection { wxImage::Destroy} \label { wximagedestroy}
\func { bool} { Destroy} { \void }
Destroys the image data.
2001-11-27 13:14:09 -05:00
\membersection { wxImage::FindFirstUnusedColour} \label { wximagefindfirstunusedcolour}
\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} }
\wxheading { Parameters}
\docparam { r,g,b} { Pointers to variables to save the colour.}
\docparam { startR,startG,startB} { Initial values of the colour. Returned colour
will have RGB values equal to or greater than these.}
Finds the first colour that is never used in the image. The search begins at
given initial colour and continues by increasing R, G and B components (in this
order) by 1 until an unused colour is found or the colour space exhausted.
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
Returns false if there is no unused colour left, true on success.
2001-11-27 13:14:09 -05:00
\wxheading { Notes}
Note that this method involves computing the histogram, which is
computationally intensive operation.
1998-12-20 18:49:21 -05:00
\membersection { wxImage::FindHandler}
\func { static wxImageHandler*} { FindHandler} { \param { const wxString\& } { name} }
Finds the handler with the given name.
\func { static wxImageHandler*} { FindHandler} { \param { const wxString\& } { extension} , \param { long} { imageType} }
Finds the handler associated with the given extension and type.
\func { static wxImageHandler*} { FindHandler} { \param { long } { imageType} }
Finds the handler associated with the given image type.
1999-04-11 15:07:17 -04:00
\func { static wxImageHandler*} { FindHandlerMime} { \param { const wxString\& } { mimetype} }
Finds the handler associated with the given MIME type.
1998-12-20 18:49:21 -05:00
\docparam { name} { The handler name.}
\docparam { extension} { The file extension, such as ``bmp".}
1999-01-12 12:53:45 -05:00
\docparam { imageType} { The image type, such as wxBITMAP\_ TYPE\_ BMP.}
1998-12-20 18:49:21 -05:00
1999-04-11 15:07:17 -04:00
\docparam { mimetype} { MIME type.}
1998-12-20 18:49:21 -05:00
\wxheading { Return value}
A pointer to the handler if found, NULL otherwise.
\wxheading { See also}
\helpref { wxImageHandler} { wximagehandler}
\membersection { wxImage::GetBlue} \label { wximagegetblue}
\constfunc { unsigned char} { GetBlue} { \param { int} { x} , \param { int} { y} }
Returns the blue intensity at the given coordinate.
\membersection { wxImage::GetData} \label { wximagegetdata}
\constfunc { unsigned char*} { GetData} { \void }
1999-01-09 10:53:52 -05:00
Returns the image data as an array. This is most often used when doing
direct image manipulation. The return value points to an array of
2002-06-26 11:43:52 -04:00
characters in RGBRGBRGB$ \ldots $ format.
1998-12-20 18:49:21 -05:00
2002-07-06 17:16:35 -04:00
You should not delete the returned pointer nor pass it to
\helpref { wxImage::SetData} { wximagesetdata} .
1998-12-20 18:49:21 -05:00
\membersection { wxImage::GetGreen} \label { wximagegetgreen}
\constfunc { unsigned char} { GetGreen} { \param { int} { x} , \param { int} { y} }
Returns the green intensity at the given coordinate.
2002-01-02 12:09:43 -05:00
\membersection { wxImage::GetImageCount} \label { wximagegetimagecount}
2002-01-01 18:13:54 -05:00
2002-01-02 12:09:43 -05:00
\func { static int} { GetImageCount} { \param { const wxString\& } { filename} , \param { long} { type = wxBITMAP\_ TYPE\_ ANY} }
2002-01-01 18:13:54 -05:00
2002-01-02 12:09:43 -05:00
\func { static int} { GetImageCount} { \param { wxInputStream\& } { stream} , \param { long} { type = wxBITMAP\_ TYPE\_ ANY} }
2002-01-01 18:13:54 -05:00
If the image file contains more than one image and the image handler is capable
of retrieving these individually, this function will return the number of
available images.
\docparam { name} { Name of the file to query.}
\docparam { stream} { Opened input stream with image data. Currently, the stream must support seeking.}
\docparam { type} { May be one of the following:
\twocolwidtha { 5cm} %
\begin { twocollist}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ BMP} } { Load a Windows bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ GIF} } { Load a GIF bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ JPEG} } { Load a JPEG bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ PNG} } { Load a PNG bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ PCX} } { Load a PCX bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ PNM} } { Load a PNM bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ TIF} } { Load a TIFF bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ XPM} } { Load a XPM bitmap file.}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ ICO} } { Load a Windows icon file (ICO).}
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ CUR} } { Load a Windows cursor file (CUR).}
2002-01-13 07:01:42 -05:00
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ ANI} } { Load a Windows animated cursor file (ANI).}
2002-01-01 18:13:54 -05:00
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ ANY} } { Will try to autodetect the format.}
\end { twocollist} }
\wxheading { Return value}
Number of available images. For most image handlers, this is 1 (exceptions
are TIFF and ICO formats).
1998-12-20 18:49:21 -05:00
\membersection { wxImage::GetHandlers}
\func { static wxList\& } { GetHandlers} { \void }
Returns the static list of image format handlers.
\wxheading { See also}
\helpref { wxImageHandler} { wximagehandler}
\membersection { wxImage::GetHeight} \label { wximagegetheight}
\constfunc { int} { GetHeight} { \void }
Gets the height of the image in pixels.
\membersection { wxImage::GetMaskBlue} \label { wximagegetmaskblue}
\constfunc { unsigned char} { GetMaskBlue} { \void }
Gets the blue value of the mask colour.
\membersection { wxImage::GetMaskGreen} \label { wximagegetmaskgreen}
\constfunc { unsigned char} { GetMaskGreen} { \void }
Gets the green value of the mask colour.
\membersection { wxImage::GetMaskRed} \label { wximagegetmaskred}
\constfunc { unsigned char} { GetMaskRed} { \void }
Gets the red value of the mask colour.
2000-08-08 02:11:51 -04:00
\membersection { wxImage::GetPalette} \label { wximagegetpalette}
\constfunc { const wxPalette\& } { GetPalette} { \void }
Returns the palette associated with the image. Currently the palette is only
2001-04-21 19:18:05 -04:00
used when converting to wxBitmap under Windows.
2000-08-08 02:11:51 -04:00
Eventually wxImage handlers will set the palette if one exists in the image file.
2003-01-24 20:09:42 -05:00
\membersection { wxImage::GetRed} \label { wximagegetred}
\constfunc { unsigned char} { GetRed} { \param { int} { x} , \param { int} { y} }
Returns the red intensity at the given coordinate.
1999-11-01 13:20:39 -05:00
\membersection { wxImage::GetSubImage} \label { wximagegetsubimage}
1999-12-27 09:27:05 -05:00
\constfunc { wxImage} { GetSubImage} { \param { const wxRect\& } { rect} }
1999-11-01 13:20:39 -05:00
Returns a sub image of the current one as long as the rect belongs entirely to
the image.
1998-12-20 18:49:21 -05:00
\membersection { wxImage::GetWidth} \label { wximagegetwidth}
\constfunc { int} { GetWidth} { \void }
Gets the width of the image in pixels.
\wxheading { See also}
\helpref { wxImage::GetHeight} { wximagegetheight}
\membersection { wxImage::HasMask} \label { wximagehasmask}
\constfunc { bool} { HasMask} { \void }
2003-01-17 19:16:34 -05:00
Returns true if there is a mask active, false otherwise.
1998-12-20 18:49:21 -05:00
2000-07-29 07:44:57 -04:00
\membersection { wxImage::GetOption} \label { wximagegetoption}
\constfunc { wxString} { GetOption} { \param { const wxString\& } { name} }
Gets a user-defined option. The function is case-insensitive to { \it name} .
For example, when saving as a JPEG file, the option { \bf quality} is
used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
\wxheading { See also}
\helpref { wxImage::SetOption} { wximagesetoption} ,\rtfsp
\helpref { wxImage::GetOptionInt} { wximagegetoptionint} ,\rtfsp
\helpref { wxImage::HasOption} { wximagehasoption}
\membersection { wxImage::GetOptionInt} \label { wximagegetoptionint}
\constfunc { int} { GetOptionInt} { \param { const wxString\& } { name} }
Gets a user-defined option as an integer. The function is case-insensitive to { \it name} .
\wxheading { See also}
\helpref { wxImage::SetOption} { wximagesetoption} ,\rtfsp
\helpref { wxImage::GetOption} { wximagegetoption} ,\rtfsp
\helpref { wxImage::HasOption} { wximagehasoption}
\membersection { wxImage::HasOption} \label { wximagehasoption}
\constfunc { bool} { HasOption} { \param { const wxString\& } { name} }
2003-01-17 19:16:34 -05:00
Returns true if the given option is present. The function is case-insensitive to { \it name} .
2000-07-29 07:44:57 -04:00
\wxheading { See also}
\helpref { wxImage::SetOption} { wximagesetoption} ,\rtfsp
\helpref { wxImage::GetOption} { wximagegetoption} ,\rtfsp
\helpref { wxImage::GetOptionInt} { wximagegetoptionint}
1998-12-20 18:49:21 -05:00
\membersection { wxImage::InitStandardHandlers}
\func { static void} { InitStandardHandlers} { \void }
1999-09-20 05:03:37 -04:00
Internal use only. Adds standard image format handlers. It only install BMP
2000-01-24 19:33:42 -05:00
for the time being, which is used by wxBitmap.
1998-12-20 18:49:21 -05:00
1999-09-20 05:03:37 -04:00
This function is called by wxWindows on startup, and shouldn't be called by
the user.
1998-12-20 18:49:21 -05:00
\wxheading { See also}
2000-03-14 19:21:49 -05:00
\helpref { wxImageHandler} { wximagehandler} ,
1999-09-20 15:05:49 -04:00
\helpref { wxInitAllImageHandlers} { wxinitallimagehandlers}
1998-12-20 18:49:21 -05:00
\membersection { wxImage::InsertHandler}
\func { static void} { InsertHandler} { \param { wxImageHandler*} { handler} }
Adds a handler at the start of the static list of format handlers.
\docparam { handler} { A new image format handler object. There is usually only one instance
of a given handler class in an application session.}
\wxheading { See also}
\helpref { wxImageHandler} { wximagehandler}
\membersection { wxImage::LoadFile} \label { wximageloadfile}
2002-01-01 18:13:54 -05:00
\func { bool} { LoadFile} { \param { const wxString\& } { name} , \param { long} { type = wxBITMAP\_ TYPE\_ ANY} , \param { int} { index = -1} }
1998-12-20 18:49:21 -05:00
2002-01-01 18:13:54 -05:00
\func { bool} { LoadFile} { \param { const wxString\& } { name} , \param { const wxString\& } { mimetype} , \param { int} { index = -1} }
1999-04-11 15:07:17 -04:00
1999-09-20 05:03:37 -04:00
Loads an image from a file. If no handler type is provided, the library will
2000-01-24 19:33:42 -05:00
try to autodetect the format.
1998-12-20 18:49:21 -05:00
2002-01-01 18:13:54 -05:00
\func { bool} { LoadFile} { \param { wxInputStream\& } { stream} , \param { long} { type} , \param { int} { index = -1} }
1999-01-10 07:04:02 -05:00
2002-01-01 18:13:54 -05:00
\func { bool} { LoadFile} { \param { wxInputStream\& } { stream} , \param { const wxString\& } { mimetype} , \param { int} { index = -1} }
1999-04-11 15:07:17 -04:00
1999-01-10 07:04:02 -05:00
Loads an image from an input stream.
1998-12-20 18:49:21 -05:00
\wxheading { Parameters}
2000-01-24 19:33:42 -05:00
\docparam { name} { Name of the file from which to load the image.}
1998-12-20 18:49:21 -05:00
2000-01-24 19:33:42 -05:00
\docparam { stream} { Opened input stream from which to load the image. Currently, the stream must support seeking.}
1999-01-10 07:04:02 -05:00
1998-12-20 18:49:21 -05:00
\docparam { type} { One of the following values:
1999-01-12 13:28:34 -05:00
\twocolwidtha { 5cm} %
1998-12-20 18:49:21 -05:00
\begin { twocollist}
1999-01-12 12:53:45 -05:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ BMP} } { Load a Windows image file.}
1999-09-20 05:03:37 -04:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ GIF} } { Load a GIF image file.}
1999-01-27 13:20:53 -05:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ JPEG} } { Load a JPEG image file.}
1999-09-20 05:03:37 -04:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ PCX} } { Load a PCX image file.}
\twocolitem { { \bf wxBITMAP\_ TYPE\_ PNG} } { Load a PNG image file.}
\twocolitem { { \bf wxBITMAP\_ TYPE\_ PNM} } { Load a PNM image file.}
2000-01-24 19:33:42 -05:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ TIF} } { Load a TIFF image file.}
2001-04-28 19:30:35 -04:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ XPM} } { Load a XPM image file.}
2002-01-01 18:13:54 -05:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ ICO} } { Load a Windows icon file (ICO).}
\twocolitem { { \bf wxBITMAP\_ TYPE\_ CUR} } { Load a Windows cursor file (CUR).}
2002-01-13 07:01:42 -05:00
\twocolitem { \indexit { wxBITMAP\_ TYPE\_ ANI} } { Load a Windows animated cursor file (ANI).}
2000-01-24 19:33:42 -05:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ ANY} } { Will try to autodetect the format.}
\end { twocollist} }
1998-12-20 18:49:21 -05:00
1999-04-11 15:07:17 -04:00
\docparam { mimetype} { MIME type string (for example 'image/jpeg')}
2002-01-01 18:13:54 -05:00
\docparam { index} { Index of the image to load in the case that the image file contains multiple images.
2002-03-15 18:59:09 -05:00
This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
2002-01-01 18:13:54 -05:00
"choose the default image" and is interpreted as the first image (index=0) by
2002-03-15 18:59:09 -05:00
the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
2002-01-01 18:13:54 -05:00
2000-01-24 19:33:42 -05:00
\wxheading { Remarks}
Depending on how wxWindows has been configured, not all formats may be available.
2002-01-01 18:13:54 -05:00
Note: you can use \helpref { GetOptionInt} { wximagegetoptionint} to get the
hotspot for loaded cursor file:
\begin { verbatim}
2002-02-15 20:45:30 -05:00
int hotspot_ x = image.GetOptionInt(wxIMAGE_ OPTION_ CUR_ HOTSPOT_ X);
int hotspot_ y = image.GetOptionInt(wxIMAGE_ OPTION_ CUR_ HOTSPOT_ Y);
2002-01-01 18:13:54 -05:00
\end { verbatim}
2001-11-27 13:14:09 -05:00
1998-12-20 18:49:21 -05:00
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
true if the operation succeeded, false otherwise. If the optional index parameter is out of range,
false is returned and a call to wxLogError() takes place.
1998-12-20 18:49:21 -05:00
\wxheading { See also}
\helpref { wxImage::SaveFile} { wximagesavefile}
1999-04-29 12:12:07 -04:00
\pythonnote { In place of a single overloaded method name, wxPython
implements the following methods:\par
\indented { 2cm} { \begin { twocollist}
1999-12-25 15:34:56 -05:00
\twocolitem { { \bf LoadFile(filename, type)} } { Loads an image of the given
1999-04-29 12:12:07 -04:00
type from a file}
1999-12-25 15:34:56 -05:00
\twocolitem { { \bf LoadMimeFile(filename, mimetype)} } { Loads an image of the given
1999-04-29 12:12:07 -04:00
mimetype from a file}
\end { twocollist} }
}
2000-12-20 11:10:46 -05:00
\perlnote { Methods supported by wxPerl are:\par
\begin { itemize}
2000-12-22 08:34:13 -05:00
\item { bitmap->LoadFile( name, type )}
\item { bitmap->LoadFile( name, mimetype )}
2000-12-20 11:10:46 -05:00
\end { itemize}
}
1999-04-29 12:12:07 -04:00
1998-12-20 18:49:21 -05:00
\membersection { wxImage::Ok} \label { wximageok}
\constfunc { bool} { Ok} { \void }
2003-01-17 19:16:34 -05:00
Returns true if image data is present.
1998-12-20 18:49:21 -05:00
\membersection { wxImage::RemoveHandler}
\func { static bool} { RemoveHandler} { \param { const wxString\& } { name} }
Finds the handler with the given name, and removes it. The handler
is not deleted.
\docparam { name} { The handler name.}
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
true if the handler was found and removed, false otherwise.
1998-12-20 18:49:21 -05:00
\wxheading { See also}
\helpref { wxImageHandler} { wximagehandler}
\membersection { wxImage::SaveFile} \label { wximagesavefile}
2002-02-07 19:16:44 -05:00
\constfunc { bool} { SaveFile} { \param { const wxString\& } { name} , \param { int} { type} }
1998-12-20 18:49:21 -05:00
2002-02-07 19:16:44 -05:00
\constfunc { bool} { SaveFile} { \param { const wxString\& } { name} , \param { const wxString\& } { mimetype} }
1999-04-11 15:07:17 -04:00
2002-03-17 06:34:32 -05:00
Saves an image in the named file.
\constfunc { bool} { SaveFile} { \param { const wxString\& } { name} }
Saves an image in the named file. File type is determined from the extension of the
file name. Note that this function may fail if the extension is not recognized! You
can use one of the forms above to save images to files with non-standard extensions.
1998-12-20 18:49:21 -05:00
2002-02-07 19:16:44 -05:00
\constfunc { bool} { SaveFile} { \param { wxOutputStream\& } { stream} , \param { int} { type} }
1999-01-10 07:04:02 -05:00
2002-02-07 19:16:44 -05:00
\constfunc { bool} { SaveFile} { \param { wxOutputStream\& } { stream} , \param { const wxString\& } { mimetype} }
1999-04-11 15:07:17 -04:00
2002-03-17 06:34:32 -05:00
Saves an image in the given stream.
1999-01-10 07:04:02 -05:00
1998-12-20 18:49:21 -05:00
\wxheading { Parameters}
2000-01-24 19:33:42 -05:00
\docparam { name} { Name of the file to save the image to.}
1998-12-20 18:49:21 -05:00
2000-01-24 19:33:42 -05:00
\docparam { stream} { Opened output stream to save the image to.}
1999-01-10 07:04:02 -05:00
2002-03-17 06:34:32 -05:00
\docparam { type} { Currently these types can be used:
1998-12-20 18:49:21 -05:00
1999-01-12 13:28:34 -05:00
\twocolwidtha { 5cm} %
1998-12-20 18:49:21 -05:00
\begin { twocollist}
2002-03-17 06:34:32 -05:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ BMP} } { Save a BMP image file.}
1999-01-27 13:20:53 -05:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ JPEG} } { Save a JPEG image file.}
2000-01-24 19:33:42 -05:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ PNG} } { Save a PNG image file.}
\twocolitem { { \bf wxBITMAP\_ TYPE\_ PCX} } { Save a PCX image file (tries to save as 8-bit if possible, falls back to 24-bit otherwise).}
\twocolitem { { \bf wxBITMAP\_ TYPE\_ PNM} } { Save a PNM image file (as raw RGB always).}
2001-04-28 19:30:35 -04:00
\twocolitem { { \bf wxBITMAP\_ TYPE\_ TIFF} } { Save a TIFF image file.}
\twocolitem { { \bf wxBITMAP\_ TYPE\_ XPM} } { Save a XPM image file.}
2002-01-01 18:13:54 -05:00
\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).}
\twocolitem { { \bf wxBITMAP\_ TYPE\_ CUR} } { Save a Windows cursor file (CUR).}
2000-01-24 19:33:42 -05:00
\end { twocollist} }
1998-12-20 18:49:21 -05:00
1999-04-11 15:07:17 -04:00
\docparam { mimetype} { MIME type.}
1998-12-20 18:49:21 -05:00
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
true if the operation succeeded, false otherwise.
1998-12-20 18:49:21 -05:00
\wxheading { Remarks}
Depending on how wxWindows has been configured, not all formats may be available.
2002-01-01 18:13:54 -05:00
Note: you can use \helpref { GetOptionInt} { wximagegetoptionint} to set the
hotspot before saving an image into a cursor file (default hotspot is in
the centre of the image):
\begin { verbatim}
2002-02-15 20:45:30 -05:00
image.SetOption(wxIMAGE_ OPTION_ CUR_ HOTSPOT_ X, hotspotX);
image.SetOption(wxIMAGE_ OPTION_ CUR_ HOTSPOT_ Y, hotspotY);
2002-01-01 18:13:54 -05:00
\end { verbatim}
1998-12-20 18:49:21 -05:00
\wxheading { See also}
\helpref { wxImage::LoadFile} { wximageloadfile}
1999-04-29 12:12:07 -04:00
\pythonnote { In place of a single overloaded method name, wxPython
implements the following methods:\par
\indented { 2cm} { \begin { twocollist}
1999-12-25 15:34:56 -05:00
\twocolitem { { \bf SaveFile(filename, type)} } { Saves the image using the given
1999-04-29 12:12:07 -04:00
type to the named file}
1999-12-25 15:34:56 -05:00
\twocolitem { { \bf SaveMimeFile(filename, mimetype)} } { Saves the image using the given
1999-04-29 12:12:07 -04:00
mimetype to the named file}
\end { twocollist} }
}
2000-12-20 11:10:46 -05:00
\perlnote { Methods supported by wxPerl are:\par
\begin { itemize}
2000-12-22 08:34:13 -05:00
\item { bitmap->SaveFile( name, type )}
\item { bitmap->SaveFile( name, mimetype )}
2000-12-20 11:10:46 -05:00
\end { itemize}
}
2000-07-15 15:51:35 -04:00
\membersection { wxImage::Mirror} \label { wximagemirror}
2003-01-17 19:16:34 -05:00
\constfunc { wxImage} { Mirror} { \param { bool} { horizontally = true} }
2000-07-15 15:51:35 -04:00
Returns a mirrored copy of the image. The parameter { \it horizontally}
indicates the orientation.
1999-12-27 09:27:05 -05:00
\membersection { wxImage::Replace} \label { wximagereplace}
\func { void} { Replace} { \param { unsigned char} { r1} , \param { unsigned char} { g1} , \param { unsigned char} { b1} ,
\param { unsigned char} { r2} , \param { unsigned char} { g2} , \param { unsigned char} { b2} }
Replaces the colour specified by { \it r1,g1,b1} by the colour { \it r2,g2,b2} .
1999-07-05 17:08:29 -04:00
\membersection { wxImage::Rescale} \label { wximagerescale}
1999-12-16 18:13:23 -05:00
\func { wxImage \& } { Rescale} { \param { int} { width} , \param { int} { height} }
1999-07-05 17:08:29 -04:00
1999-08-19 14:41:41 -04:00
Changes the size of the image in-place: after a call to this function, the
image will have the given width and height.
1999-07-05 17:08:29 -04:00
1999-12-16 18:13:23 -05:00
Returns the (modified) image itself.
1999-07-05 17:08:29 -04:00
\wxheading { See also}
\helpref { Scale} { wximagescale}
2000-03-06 16:00:02 -05:00
\membersection { wxImage::Rotate} \label { wximagerotate}
2000-02-06 09:51:36 -05:00
\func { wxImage} { Rotate} { \param { double} { angle} , \param { const wxPoint\& } { rotationCentre} ,
2003-01-17 19:16:34 -05:00
\param { bool} { interpolating = true} , \param { wxPoint*} { offsetAfterRotation = NULL} }
2000-02-06 09:51:36 -05:00
2003-01-17 19:16:34 -05:00
Rotates the image about the given point, by { \it angle} radians. Passing true
2000-03-06 11:31:05 -05:00
to { \it interpolating} results in better image quality, but is slower. If the
image has a mask, then the mask colour is used for the uncovered pixels in the
rotated image background. Else, black (rgb 0, 0, 0) will be used.
2000-02-06 09:51:36 -05:00
Returns the rotated image, leaving this image intact.
2000-07-15 15:51:35 -04:00
\membersection { wxImage::Rotate90} \label { wximagerotate90}
2003-01-17 19:16:34 -05:00
\constfunc { wxImage} { Rotate90} { \param { bool} { clockwise = true} }
2000-07-15 15:51:35 -04:00
Returns a copy of the image rotated 90 degrees in the direction
indicated by { \it clockwise} .
1998-12-20 18:49:21 -05:00
\membersection { wxImage::Scale} \label { wximagescale}
1999-07-05 17:08:29 -04:00
\constfunc { wxImage} { Scale} { \param { int} { width} , \param { int} { height} }
1998-12-20 18:49:21 -05:00
1999-01-09 10:53:52 -05:00
Returns a scaled version of the image. This is also useful for
scaling bitmaps in general as the only other way to scale bitmaps
1999-07-05 17:08:29 -04:00
is to blit a wxMemoryDC into another wxMemoryDC.
1999-12-27 09:27:05 -05:00
It may be mentioned that the GTK port uses this function internally
2000-07-15 15:51:35 -04:00
to scale bitmaps when using mapping modes in wxDC.
1999-07-05 17:08:29 -04:00
Example:
\begin { verbatim}
// get the bitmap from somewhere
wxBitmap bmp = ...;
// rescale it to have size of 32*32
if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 )
{
wxImage image(bmp);
2001-04-21 19:18:05 -04:00
bmp = wxBitmap(image.Scale(32, 32));
1999-07-05 17:08:29 -04:00
// another possibility:
image.Rescale(32, 32);
bmp = image;
}
\end { verbatim}
\wxheading { See also}
\helpref { Rescale} { wximagerescale}
1998-12-20 18:49:21 -05:00
\membersection { wxImage::SetData} \label { wximagesetdata}
\func { void} { SetData} { \param { unsigned char*} { data} }
1999-04-29 12:12:07 -04:00
Sets the image data without performing checks. The data given must have
1999-01-09 10:53:52 -05:00
the size (width*height*3) or results will be unexpected. Don't use this
method if you aren't sure you know what you are doing.
1998-12-20 18:49:21 -05:00
2002-07-06 17:16:35 -04:00
The data must have been allocated with malloc(), NOT with operator new.
After this call the pointer to the data is owned by the wxImage object,
that will be responsible for deleting it.
Do not pass to this function a pointer obtained through
\helpref { wxImage::GetData} { wximagegetdata} .
1998-12-20 18:49:21 -05:00
\membersection { wxImage::SetMask} \label { wximagesetmask}
2003-01-17 19:16:34 -05:00
\func { void} { SetMask} { \param { bool} { hasMask = true} }
1998-12-20 18:49:21 -05:00
Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.
\membersection { wxImage::SetMaskColour} \label { wximagesetmaskcolour}
2003-02-13 13:28:36 -05:00
\func { void} { SetMaskColour} { \param { unsigned char } { red} , \param { unsigned char } { green} , \param { unsigned char } { blue} }
1998-12-20 18:49:21 -05:00
1999-01-27 12:15:34 -05:00
Sets the mask colour for this image (and tells the image to use the mask).
1998-12-20 18:49:21 -05:00
2001-11-27 13:14:09 -05:00
\membersection { wxImage::SetMaskFromImage} \label { wximagesetmaskfromimage}
\func { bool} { SetMaskFromImage} { \param { const wxImage\& } { mask} , \param { unsigned char} { mr} , \param { unsigned char} { mg} , \param { unsigned char} { mb} }
\wxheading { Parameters}
\docparam { mask} { The mask image to extract mask shape from. Must have same dimensions as the image.}
\docparam { mr,mg,mb} { RGB value of pixels in { \it mask} that will be used to create the mask.}
Sets image's mask so that the pixels that have RGB value of { \it mr,mg,mb}
in { \it mask} will be masked in the image. This is done by first finding an
unused colour in the image, setting this colour as the mask colour and then
using this colour to draw all pixels in the image who corresponding pixel
in { \it mask} has given RGB value.
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
Returns false if { \it mask} does not have same dimensions as the image or if
there is no unused colour left. Returns true if the mask was successfully
2001-11-27 13:14:09 -05:00
applied.
\wxheading { Notes}
Note that this method involves computing the histogram, which is
computationally intensive operation.
2000-07-29 07:44:57 -04:00
\membersection { wxImage::SetOption} \label { wximagesetoption}
\func { void} { SetOption} { \param { const wxString\& } { name} , \param { const wxString\& } { value} }
\func { void} { SetOption} { \param { const wxString\& } { name} , \param { int} { value} }
Sets a user-defined option. The function is case-insensitive to { \it name} .
For example, when saving as a JPEG file, the option { \bf quality} is
used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
\wxheading { See also}
\helpref { wxImage::GetOption} { wximagegetoption} ,\rtfsp
\helpref { wxImage::GetOptionInt} { wximagegetoptionint} ,\rtfsp
\helpref { wxImage::HasOption} { wximagehasoption}
2000-08-08 02:11:51 -04:00
\membersection { wxImage::SetPalette} \label { wximagesetpalette}
\func { void} { SetPalette} { \param { const wxPalette\& } { palette} }
2001-04-21 19:18:05 -04:00
Associates a palette with the image. The palette may be used when converting
wxImage to wxBitmap (MSW only at present) or in file save operations (none as yet).
2000-08-08 02:11:51 -04:00
1998-12-20 18:49:21 -05:00
\membersection { wxImage::SetRGB} \label { wximagesetrgb}
2000-07-15 15:51:35 -04:00
\func { void} { SetRGB} { \param { int } { x} , \param { int } { y} , \param { unsigned char } { red} , \param { unsigned char } { green} , \param { unsigned char } { blue} }
1998-12-20 18:49:21 -05:00
1999-01-09 10:53:52 -05:00
Sets the pixel at the given coordinate. This routine performs bounds-checks
for the coordinate so it can be considered a safe way to manipulate the
data, but in some cases this might be too slow so that the data will have to
1999-12-27 09:27:05 -05:00
be set directly. In that case you will have to get access to the image data
using the \helpref { GetData} { wximagegetdata} method.
1998-12-20 18:49:21 -05:00
\membersection { wxImage::operator $ = $ }
\func { wxImage\& } { operator $ = $ } { \param { const wxImage\& } { image} }
Assignment operator. This operator does not copy any data, but instead
passes a pointer to the data in { \it image} and increments a reference
counter. It is a fast operation.
\wxheading { Parameters}
\docparam { image} { Image to assign.}
\wxheading { Return value}
Returns 'this' object.
\membersection { wxImage::operator $ = = $ }
2002-12-04 09:11:26 -05:00
\constfunc { bool} { operator $ = = $ } { \param { const wxImage\& } { image} }
1998-12-20 18:49:21 -05:00
Equality operator. This operator tests whether the internal data pointers are
equal (a fast test).
\wxheading { Parameters}
\docparam { image} { Image to compare with 'this'}
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
Returns true if the images were effectively equal, false otherwise.
1998-12-20 18:49:21 -05:00
\membersection { wxImage::operator $ ! = $ }
2002-12-04 09:11:26 -05:00
\constfunc { bool} { operator $ ! = $ } { \param { const wxImage\& } { image} }
1998-12-20 18:49:21 -05:00
Inequality operator. This operator tests whether the internal data pointers are
unequal (a fast test).
\wxheading { Parameters}
\docparam { image} { Image to compare with 'this'}
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
Returns true if the images were unequal, false otherwise.
1998-12-20 18:49:21 -05:00
\section { \class { wxImageHandler} } \label { wximagehandler}
This is the base class for implementing image file loading/saving, and image creation from data.
It is used within wxImage and is not normally seen by the application.
If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler
and add the handler using \helpref { wxImage::AddHandler} { wximageaddhandler} in your
application initialisation.
1999-01-27 13:20:53 -05:00
\wxheading { Note (Legal Issue)}
1999-02-15 15:41:29 -05:00
This software is based in part on the work of the Independent JPEG Group.
1999-01-27 13:20:53 -05:00
(Applies when wxWindows is linked with JPEG support. wxJPEGHandler uses libjpeg
created by IJG.)
1998-12-20 18:49:21 -05:00
\wxheading { Derived from}
\helpref { wxObject} { wxobject}
1999-02-15 15:41:29 -05:00
\wxheading { Include files}
<wx/image.h>
1998-12-20 18:49:21 -05:00
\wxheading { See also}
2000-03-14 19:21:49 -05:00
\helpref { wxImage} { wximage} ,
1999-09-20 15:05:49 -04:00
\helpref { wxInitAllImageHandlers} { wxinitallimagehandlers}
1998-12-20 18:49:21 -05:00
\latexignore { \rtfignore { \wxheading { Members} } }
\membersection { wxImageHandler::wxImageHandler} \label { wximagehandlerconstr}
\func { } { wxImageHandler} { \void }
Default constructor. In your own default constructor, initialise the members
m\_ name, m\_ extension and m\_ type.
\membersection { wxImageHandler::\destruct { wxImageHandler} }
\func { } { \destruct { wxImageHandler} } { \void }
Destroys the wxImageHandler object.
\membersection { wxImageHandler::GetName}
\constfunc { wxString} { GetName} { \void }
Gets the name of this handler.
\membersection { wxImageHandler::GetExtension}
\constfunc { wxString} { GetExtension} { \void }
Gets the file extension associated with this handler.
2002-01-02 12:09:43 -05:00
\membersection { wxImageHandler::GetImageCount} \label { wximagehandlergetimagecount}
1999-12-01 09:08:42 -05:00
2002-01-02 12:09:43 -05:00
\func { int} { GetImageCount} { \param { wxInputStream\& } { stream} }
1999-12-01 09:08:42 -05:00
If the image file contains more than one image and the image handler is capable
of retrieving these individually, this function will return the number of
available images.
2000-01-24 19:33:42 -05:00
\docparam { stream} { Opened input stream for reading image data. Currently, the stream must support seeking.}
1999-12-01 09:08:42 -05:00
\wxheading { Return value}
2002-01-01 18:13:54 -05:00
Number of available images. For most image handlers, this is 1 (exceptions
are TIFF and ICO formats).
1999-12-01 09:08:42 -05:00
1998-12-20 18:49:21 -05:00
\membersection { wxImageHandler::GetType}
\constfunc { long} { GetType} { \void }
Gets the image type associated with this handler.
1999-04-11 15:07:17 -04:00
\membersection { wxImageHandler::GetMimeType}
\constfunc { wxString} { GetMimeType} { \void }
Gets the MIME type associated with this handler.
1998-12-20 18:49:21 -05:00
\membersection { wxImageHandler::LoadFile} \label { wximagehandlerloadfile}
2003-01-17 19:16:34 -05:00
\func { bool} { LoadFile} { \param { wxImage* } { image} , \param { wxInputStream\& } { stream} , \param { bool} { verbose=true} , \param { int} { index=0} }
1998-12-20 18:49:21 -05:00
1999-12-01 09:08:42 -05:00
Loads a image from a stream, putting the resulting data into { \it image} . If the image file contains
more than one image and the image handler is capable of retrieving these individually, { \it index}
indicates which image to read from the stream.
1998-12-20 18:49:21 -05:00
\wxheading { Parameters}
\docparam { image} { The image object which is to be affected by this operation.}
2000-01-24 19:33:42 -05:00
\docparam { stream} { Opened input stream for reading image data.}
1999-12-01 09:08:42 -05:00
2003-01-17 19:16:34 -05:00
\docparam { verbose} { If set to true, errors reported by the image handler will produce wxLogMessages.}
1999-12-01 09:08:42 -05:00
\docparam { index} { The index of the image in the file (starting from zero).}
1998-12-20 18:49:21 -05:00
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
true if the operation succeeded, false otherwise.
1998-12-20 18:49:21 -05:00
\wxheading { See also}
2000-03-14 19:21:49 -05:00
\helpref { wxImage::LoadFile} { wximageloadfile} ,
\helpref { wxImage::SaveFile} { wximagesavefile} ,
1998-12-20 18:49:21 -05:00
\helpref { wxImageHandler::SaveFile} { wximagehandlersavefile}
\membersection { wxImageHandler::SaveFile} \label { wximagehandlersavefile}
1999-01-10 07:04:02 -05:00
\func { bool} { SaveFile} { \param { wxImage* } { image} , \param { wxOutputStream\& } { stream} }
1998-12-20 18:49:21 -05:00
1999-01-10 07:04:02 -05:00
Saves a image in the output stream.
1998-12-20 18:49:21 -05:00
\wxheading { Parameters}
\docparam { image} { The image object which is to be affected by this operation.}
2000-01-24 19:33:42 -05:00
\docparam { stream} { Opened output stream for writing the data.}
1998-12-20 18:49:21 -05:00
\wxheading { Return value}
2003-01-17 19:16:34 -05:00
true if the operation succeeded, false otherwise.
1998-12-20 18:49:21 -05:00
\wxheading { See also}
2000-03-14 19:21:49 -05:00
\helpref { wxImage::LoadFile} { wximageloadfile} ,
\helpref { wxImage::SaveFile} { wximagesavefile} ,
1998-12-20 18:49:21 -05:00
\helpref { wxImageHandler::LoadFile} { wximagehandlerloadfile}
\membersection { wxImageHandler::SetName}
\func { void} { SetName} { \param { const wxString\& } { name} }
Sets the handler name.
\wxheading { Parameters}
\docparam { name} { Handler name.}
\membersection { wxImageHandler::SetExtension}
\func { void} { SetExtension} { \param { const wxString\& } { extension} }
Sets the handler extension.
\wxheading { Parameters}
\docparam { extension} { Handler extension.}
2000-07-15 15:51:35 -04:00
\membersection { wxImageHandler::SetMimeType} \label { wximagehandlersetmimetype}
1998-12-20 18:49:21 -05:00
2000-07-15 15:51:35 -04:00
\func { void} { SetMimeType} { \param { const wxString\& } { mimetype} }
1998-12-20 18:49:21 -05:00
2000-07-15 15:51:35 -04:00
Sets the handler MIME type.
1998-12-20 18:49:21 -05:00
\wxheading { Parameters}
2000-07-15 15:51:35 -04:00
\docparam { mimename} { Handler MIME type.}
1999-04-11 15:07:17 -04:00
2000-07-15 15:51:35 -04:00
\membersection { wxImageHandler::SetType}
1999-04-11 15:07:17 -04:00
2000-07-15 15:51:35 -04:00
\func { void} { SetType} { \param { long } { type} }
1999-04-11 15:07:17 -04:00
2000-07-15 15:51:35 -04:00
Sets the handler type.
1999-04-11 15:07:17 -04:00
\wxheading { Parameters}
2000-07-15 15:51:35 -04:00
\docparam { name} { Handler type.}
1999-04-11 15:07:17 -04:00