Make wxImage correction

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-04-10 12:35:55 +00:00
parent f05114174f
commit dd067e96c8

View File

@@ -170,198 +170,93 @@ class wxImage : public wxObject
public: public:
//@{ //@{
/** /**
Creates an image from XPM data. Creates an image from data in memory. If static_data is false
then the wxImage will take ownership of the data and free it
afterwards. For this, it has to be allocated with @e malloc.
@param width @param width
Specifies the width of the image. Specifies the width of the image.
@param height @param height
Specifies the height of the image. Specifies the height of the image.
@param data
A pointer to RGB data
@param apha
A pointer to alpha-channel data
*/
wxImage(int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
wxImage(int width, int height, unsigned char* data, bool static_data = false);
//@}
/**
Creates an image with the given size and clears it if requested.
Does not create an alpha channel.
*/
wxImage(int width, int height, bool clear = true);
/**
Creates an empty wxImage object. Does not create
an alpha channel.
@param width
Specifies the width of the image.
@param height
Specifies the height of the image.
@clear
Clear the image with zeros.
*/
wxImage();
/**
Creates an image from XPM data.
@param xpmData
A pointer to XPM image data.
*/
wxImage(const char* const* xpmData);
//@{
/**
@param name @param name
Name of the file from which to load the image. Name of the file from which to load the image.
@param stream @param stream
Opened input stream from which to load the image. Currently, the stream Opened input stream from which to load the image. Currently,
must support seeking. the stream must support seeking.
@param type @param type
May be one of the following: May be one of the following:
wxBITMAP_TYPE_BMP: Load a Windows bitmap file.
wxBITMAP_TYPE_GIF: Load a GIF bitmap file.
wxBITMAP_TYPE_JPEG: Load a JPEG bitmap file.
wxBITMAP_TYPE_PNG: Load a PNG bitmap file.
wxBITMAP_TYPE_PCX: Load a PCX bitmap file.
wxBITMAP_TYPE_PNM: Load a PNM bitmap file.
wxBITMAP_TYPE_BMP wxBITMAP_TYPE_TIF: Load a TIFF bitmap file.
wxBITMAP_TYPE_TGA: Load a TGA bitmap file.
wxBITMAP_TYPE_XPM: Load a XPM bitmap file.
wxBITMAP_TYPE_ICO: Load a Windows icon file (ICO).
wxBITMAP_TYPE_CUR: Load a Windows cursor file (CUR).
Load a Windows bitmap file. wxBITMAP_TYPE_ANI: Load a Windows animated cursor file (ANI).
wxBITMAP_TYPE_ANY: Will try to autodetect the format.
wxBITMAP_TYPE_GIF
Load a GIF bitmap file.
wxBITMAP_TYPE_JPEG
Load a JPEG bitmap file.
wxBITMAP_TYPE_PNG
Load a PNG bitmap file.
wxBITMAP_TYPE_PCX
Load a PCX bitmap file.
wxBITMAP_TYPE_PNM
Load a PNM bitmap file.
wxBITMAP_TYPE_TIF
Load a TIFF bitmap file.
wxBITMAP_TYPE_TGA
Load a TGA bitmap file.
wxBITMAP_TYPE_XPM
Load a XPM bitmap file.
wxBITMAP_TYPE_ICO
Load a Windows icon file (ICO).
wxBITMAP_TYPE_CUR
Load a Windows cursor file (CUR).
wxBITMAP_TYPE_ANI
Load a Windows animated cursor file (ANI).
wxBITMAP_TYPE_ANY
Will try to autodetect the format.
@param mimetype @param mimetype
MIME type string (for example 'image/jpeg') MIME type string (for example 'image/jpeg')
@param index @param index
Index of the image to load in the case that the image file contains Index of the image to load in the case that the image file contains
multiple images. multiple images. This is only used by GIF, ICO and TIFF handlers.
This is only used by GIF, ICO and TIFF handlers. The default value (-1) The default value (-1) means "choose the default image" and is
means interpreted as the first image (index=0) by the GIF and TIFF handler
"choose the default image" and is interpreted as the first image (index=0) and as the largest and most colourful one by the ICO handler.
by
the GIF and TIFF handler and as the largest and most colourful one by the
ICO handler.
@param xpmData
A pointer to XPM image data.
@remarks Depending on how wxWidgets has been configured, not all formats @remarks Depending on how wxWidgets has been configured, not all formats
may be available. may be available.
@see LoadFile() @see LoadFile()
*/ */
wxImage(); wxImage(const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1);
wxImage(const wxImage& image); wxImage(const wxString& name, const wxString& mimetype, int index = -1);
wxImage(const wxBitmap& bitmap); wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1);
wxImage(int width, int height, bool clear = true); wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1);
wxImage(int width, int height, unsigned char* data,
bool static_data = false);
wxImage(const wxString& name, long type = wxBITMAP_TYPE_ANY,
int index = -1);
wxImage(const wxString& name, const wxString& mimetype,
int index = -1);
wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY,
int index = -1);
wxImage(wxInputStream& stream, const wxString& mimetype,
int index = -1);
wxImage(const char* const* xpmData);
//@} //@}
/** /**
Destructor. Destructor.
@@ -572,143 +467,23 @@ public:
@param name @param name
Name of the file to query. Name of the file to query.
@param stream @param stream
Opened input stream with image data. Currently, the stream must support Opened input stream with image data. Currently, the stream must
seeking. support seeking.
@param type @param type
May be one of the following: May be one of the following:
wxBITMAP_TYPE_BMP: Load a Windows bitmap file.
wxBITMAP_TYPE_GIF: Load a GIF bitmap file.
wxBITMAP_TYPE_JPEG: Load a JPEG bitmap file.
wxBITMAP_TYPE_PNG: Load a PNG bitmap file.
wxBITMAP_TYPE_PCX: Load a PCX bitmap file.
wxBITMAP_TYPE_PNM: Load a PNM bitmap file.
wxBITMAP_TYPE_BMP wxBITMAP_TYPE_TIF: Load a TIFF bitmap file.
wxBITMAP_TYPE_TGA: Load a TGA bitmap file.
wxBITMAP_TYPE_XPM: Load a XPM bitmap file.
wxBITMAP_TYPE_ICO: Load a Windows icon file (ICO).
wxBITMAP_TYPE_CUR: Load a Windows cursor file (CUR).
Load a Windows bitmap file. wxBITMAP_TYPE_ANI: Load a Windows animated cursor file (ANI).
wxBITMAP_TYPE_ANY: Will try to autodetect the format.
wxBITMAP_TYPE_GIF
Load a GIF bitmap file.
wxBITMAP_TYPE_JPEG
Load a JPEG bitmap file.
wxBITMAP_TYPE_PNG
Load a PNG bitmap file.
wxBITMAP_TYPE_PCX
Load a PCX bitmap file.
wxBITMAP_TYPE_PNM
Load a PNM bitmap file.
wxBITMAP_TYPE_TIF
Load a TIFF bitmap file.
wxBITMAP_TYPE_XPM
Load a XPM bitmap file.
wxBITMAP_TYPE_ICO
Load a Windows icon file (ICO).
wxBITMAP_TYPE_CUR
Load a Windows cursor file (CUR).
wxBITMAP_TYPE_ANI
Load a Windows animated cursor file (ANI).
wxBITMAP_TYPE_ANY
Will try to autodetect the format.
@returns Number of available images. For most image handlers, this is 1 @returns Number of available images. For most image handlers, this is 1
(exceptions are TIFF and ICO formats). (exceptions are TIFF and ICO formats).
@@ -904,154 +679,31 @@ public:
@param name @param name
Name of the file from which to load the image. Name of the file from which to load the image.
@param stream @param stream
Opened input stream from which to load the image. Currently, the stream Opened input stream from which to load the image. Currently, the
must support seeking. stream must support seeking.
@param type @param type
One of the following values: May be one of the following:
wxBITMAP_TYPE_BMP: Load a Windows bitmap file.
wxBITMAP_TYPE_GIF: Load a GIF bitmap file.
wxBITMAP_TYPE_JPEG: Load a JPEG bitmap file.
wxBITMAP_TYPE_PNG: Load a PNG bitmap file.
wxBITMAP_TYPE_PCX: Load a PCX bitmap file.
wxBITMAP_TYPE_PNM: Load a PNM bitmap file.
wxBITMAP_TYPE_BMP wxBITMAP_TYPE_TIF: Load a TIFF bitmap file.
wxBITMAP_TYPE_TGA: Load a TGA bitmap file.
wxBITMAP_TYPE_XPM: Load a XPM bitmap file.
wxBITMAP_TYPE_ICO: Load a Windows icon file (ICO).
wxBITMAP_TYPE_CUR: Load a Windows cursor file (CUR).
Load a Windows image file. wxBITMAP_TYPE_ANI: Load a Windows animated cursor file (ANI).
wxBITMAP_TYPE_ANY: Will try to autodetect the format.
wxBITMAP_TYPE_GIF
Load a GIF image file.
wxBITMAP_TYPE_JPEG
Load a JPEG image file.
wxBITMAP_TYPE_PCX
Load a PCX image file.
wxBITMAP_TYPE_PNG
Load a PNG image file.
wxBITMAP_TYPE_PNM
Load a PNM image file.
wxBITMAP_TYPE_TIF
Load a TIFF image file.
wxBITMAP_TYPE_XPM
Load a XPM image file.
wxBITMAP_TYPE_ICO
Load a Windows icon file (ICO).
wxBITMAP_TYPE_CUR
Load a Windows cursor file (CUR).
wxBITMAP_TYPE_ANI
Load a Windows animated cursor file (ANI).
wxBITMAP_TYPE_ANY
Will try to autodetect the format.
@param mimetype @param mimetype
MIME type string (for example 'image/jpeg') MIME type string (for example 'image/jpeg')
@param index @param index
Index of the image to load in the case that the image file contains Index of the image to load in the case that the image file contains
multiple images. multiple images. This is only used by GIF, ICO and TIFF handlers.
This is only used by GIF, ICO and TIFF handlers. The default value (-1) The default value (-1) means "choose the default image" and is
means interpreted as the first image (index=0) by the GIF and TIFF handler
"choose the default image" and is interpreted as the first image (index=0) and as the largest and most colourful one by the ICO handler.
by
the GIF and TIFF handler and as the largest and most colourful one by the
ICO handler.
@returns @true if the operation succeeded, @false otherwise. If the @returns @true if the operation succeeded, @false otherwise. If the
optional index parameter is out of range, @false is optional index parameter is out of range, @false is
@@ -1183,108 +835,18 @@ public:
Opened output stream to save the image to. Opened output stream to save the image to.
@param type @param type
Currently these types can be used: Currently these types can be used:
wxBITMAP_TYPE_BMP: Save a BMP image file.
wxBITMAP_TYPE_JPEG: Save a JPEG image file.
wxBITMAP_TYPE_PNG: Save a PNG image file.
wxBITMAP_TYPE_PCX: Save a PCX image file (tries to save as 8-bit if possible,
falls back to 24-bit otherwise).
wxBITMAP_TYPE_PNM: Save a PNM image file (as raw RGB always).
wxBITMAP_TYPE_BMP wxBITMAP_TYPE_TIFF: Save a TIFF image file.
wxBITMAP_TYPE_XPM: Save a XPM image file.
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).
Save a BMP image file. wxBITMAP_TYPE_CUR: Save a Windows cursor file (CUR).
wxBITMAP_TYPE_JPEG
Save a JPEG image file.
wxBITMAP_TYPE_PNG
Save a PNG image file.
wxBITMAP_TYPE_PCX
Save a PCX image file (tries to save as 8-bit if possible, falls back to
24-bit otherwise).
wxBITMAP_TYPE_PNM
Save a PNM image file (as raw RGB always).
wxBITMAP_TYPE_TIFF
Save a TIFF image file.
wxBITMAP_TYPE_XPM
Save a XPM image file.
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).
wxBITMAP_TYPE_CUR
Save a Windows cursor file (CUR).
@param mimetype @param mimetype
MIME type. MIME type.
@@ -1324,32 +886,13 @@ public:
Example: Example:
@param quality @param quality
Determines what method to use for resampling the image. Can be one of the Determines what method to use for resampling the image.
following: Can be one of the following:
wxIMAGE_QUALITY_NORMAL: Uses the normal default scaling method of
pixel replication
wxIMAGE_QUALITY_HIGH: Uses bicubic and box averaging resampling
methods for upsampling and downsampling respectively
wxIMAGE_QUALITY_NORMAL
Uses the normal default scaling method of pixel replication
wxIMAGE_QUALITY_HIGH
Uses bicubic and box averaging resampling methods for upsampling and
downsampling respectively
@see Rescale() @see Rescale()
*/ */