change longs used for bitmap types to wxBitmapType (#9126)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53999 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -186,6 +186,10 @@ Changes in behaviour which may result in compilation errors
|
|||||||
wxConfig now tries to convert all unknown types to wxString automatically.
|
wxConfig now tries to convert all unknown types to wxString automatically.
|
||||||
The simplest solution is to cast the enum value to int.
|
The simplest solution is to cast the enum value to int.
|
||||||
|
|
||||||
|
- Several wxImage methods which previously had "long bitmaptype" parameters
|
||||||
|
have been changed to accept "wxBitmapType bitmaptype", please use enum
|
||||||
|
wxBitmapType in your code.
|
||||||
|
|
||||||
Deprecated methods and their replacements
|
Deprecated methods and their replacements
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ public:
|
|||||||
wxIconBundle();
|
wxIconBundle();
|
||||||
|
|
||||||
// initializes the bundle with the icon(s) found in the file
|
// initializes the bundle with the icon(s) found in the file
|
||||||
wxIconBundle(const wxString& file, long type);
|
wxIconBundle(const wxString& file, wxBitmapType type);
|
||||||
|
|
||||||
// initializes the bundle with a single icon
|
// initializes the bundle with a single icon
|
||||||
wxIconBundle(const wxIcon& icon);
|
wxIconBundle(const wxIcon& icon);
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
// adds all the icons contained in the file to the collection,
|
// adds all the icons contained in the file to the collection,
|
||||||
// if the collection already contains icons with the same
|
// if the collection already contains icons with the same
|
||||||
// width and height, they are replaced
|
// width and height, they are replaced
|
||||||
void AddIcon(const wxString& file, long type);
|
void AddIcon(const wxString& file, wxBitmapType type);
|
||||||
|
|
||||||
// adds the icon to the collection, if the collection already
|
// adds the icon to the collection, if the collection already
|
||||||
// contains an icon with the same width and height, it is
|
// contains an icon with the same width and height, it is
|
||||||
|
@@ -90,7 +90,7 @@ class WXDLLIMPEXP_CORE wxImageHandler: public wxObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxImageHandler()
|
wxImageHandler()
|
||||||
: m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(0)
|
: m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(wxBITMAP_TYPE_INVALID)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
@@ -105,11 +105,11 @@ public:
|
|||||||
|
|
||||||
void SetName(const wxString& name) { m_name = name; }
|
void SetName(const wxString& name) { m_name = name; }
|
||||||
void SetExtension(const wxString& ext) { m_extension = ext; }
|
void SetExtension(const wxString& ext) { m_extension = ext; }
|
||||||
void SetType(long type) { m_type = type; }
|
void SetType(wxBitmapType type) { m_type = type; }
|
||||||
void SetMimeType(const wxString& type) { m_mime = type; }
|
void SetMimeType(const wxString& type) { m_mime = type; }
|
||||||
const wxString& GetName() const { return m_name; }
|
const wxString& GetName() const { return m_name; }
|
||||||
const wxString& GetExtension() const { return m_extension; }
|
const wxString& GetExtension() const { return m_extension; }
|
||||||
long GetType() const { return m_type; }
|
wxBitmapType GetType() const { return m_type; }
|
||||||
const wxString& GetMimeType() const { return m_mime; }
|
const wxString& GetMimeType() const { return m_mime; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -130,7 +130,7 @@ protected:
|
|||||||
wxString m_name;
|
wxString m_name;
|
||||||
wxString m_extension;
|
wxString m_extension;
|
||||||
wxString m_mime;
|
wxString m_mime;
|
||||||
long m_type;
|
wxBitmapType m_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_CLASS(wxImageHandler)
|
DECLARE_CLASS(wxImageHandler)
|
||||||
@@ -208,16 +208,16 @@ public:
|
|||||||
double value;
|
double value;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxImage(){}
|
wxImage() {}
|
||||||
wxImage( int width, int height, bool clear = true );
|
wxImage( int width, int height, bool clear = true );
|
||||||
wxImage( int width, int height, unsigned char* data, bool static_data = false );
|
wxImage( int width, int height, unsigned char* data, bool static_data = false );
|
||||||
wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
|
wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
|
||||||
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
wxImage( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 );
|
||||||
wxImage( const wxString& name, const wxString& mimetype, int index = -1 );
|
wxImage( const wxString& name, const wxString& mimetype, int index = -1 );
|
||||||
wxImage( const char* const* xpmData );
|
wxImage( const char* const* xpmData );
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
wxImage( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 );
|
||||||
wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 );
|
wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 );
|
||||||
#endif // wxUSE_STREAMS
|
#endif // wxUSE_STREAMS
|
||||||
|
|
||||||
@@ -327,23 +327,23 @@ public:
|
|||||||
bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b );
|
bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b );
|
||||||
|
|
||||||
static bool CanRead( const wxString& name );
|
static bool CanRead( const wxString& name );
|
||||||
static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY );
|
static int GetImageCount( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY );
|
||||||
virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
virtual bool LoadFile( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 );
|
||||||
virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 );
|
virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 );
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
static bool CanRead( wxInputStream& stream );
|
static bool CanRead( wxInputStream& stream );
|
||||||
static int GetImageCount( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY );
|
static int GetImageCount( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY );
|
||||||
virtual bool LoadFile( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
virtual bool LoadFile( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 );
|
||||||
virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 );
|
virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual bool SaveFile( const wxString& name ) const;
|
virtual bool SaveFile( const wxString& name ) const;
|
||||||
virtual bool SaveFile( const wxString& name, int type ) const;
|
virtual bool SaveFile( const wxString& name, wxBitmapType type ) const;
|
||||||
virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const;
|
virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const;
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool SaveFile( wxOutputStream& stream, int type ) const;
|
virtual bool SaveFile( wxOutputStream& stream, wxBitmapType type ) const;
|
||||||
virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const;
|
virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -412,8 +412,8 @@ public:
|
|||||||
static void InsertHandler( wxImageHandler *handler );
|
static void InsertHandler( wxImageHandler *handler );
|
||||||
static bool RemoveHandler( const wxString& name );
|
static bool RemoveHandler( const wxString& name );
|
||||||
static wxImageHandler *FindHandler( const wxString& name );
|
static wxImageHandler *FindHandler( const wxString& name );
|
||||||
static wxImageHandler *FindHandler( const wxString& extension, long imageType );
|
static wxImageHandler *FindHandler( const wxString& extension, wxBitmapType imageType );
|
||||||
static wxImageHandler *FindHandler( long imageType );
|
static wxImageHandler *FindHandler( wxBitmapType imageType );
|
||||||
static wxImageHandler *FindHandlerMime( const wxString& mimetype );
|
static wxImageHandler *FindHandlerMime( const wxString& mimetype );
|
||||||
|
|
||||||
static wxString GetImageExtWildcard();
|
static wxString GetImageExtWildcard();
|
||||||
|
@@ -28,7 +28,7 @@ public:
|
|||||||
Copy constructor.
|
Copy constructor.
|
||||||
*/
|
*/
|
||||||
wxIconBundle();
|
wxIconBundle();
|
||||||
wxIconBundle(const wxString& file, long type);
|
wxIconBundle(const wxString& file, wxBitmapType type);
|
||||||
wxIconBundle(const wxIcon& icon);
|
wxIconBundle(const wxIcon& icon);
|
||||||
wxIconBundle(const wxIconBundle& ic);
|
wxIconBundle(const wxIconBundle& ic);
|
||||||
//@}
|
//@}
|
||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
contains an icon with the same width and height, it is
|
contains an icon with the same width and height, it is
|
||||||
replaced by the new one.
|
replaced by the new one.
|
||||||
*/
|
*/
|
||||||
void AddIcon(const wxString& file, long type);
|
void AddIcon(const wxString& file, wxBitmapType type);
|
||||||
void AddIcon(const wxIcon& icon);
|
void AddIcon(const wxIcon& icon);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
@@ -74,7 +74,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Gets the image type associated with this handler.
|
Gets the image type associated with this handler.
|
||||||
*/
|
*/
|
||||||
long GetType() const;
|
wxBitmapType GetType() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads a image from a stream, putting the resulting data into @e image. If the
|
Loads a image from a stream, putting the resulting data into @e image. If the
|
||||||
@@ -170,16 +170,16 @@ public:
|
|||||||
class wxImage : public wxObject
|
class wxImage : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an empty wxImage object without an alpha channel.
|
Creates an empty wxImage object without an alpha channel.
|
||||||
*/
|
*/
|
||||||
wxImage();
|
wxImage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an image with the given size and clears it if requested.
|
Creates an image with the given size and clears it if requested.
|
||||||
Does not create an alpha channel.
|
Does not create an alpha channel.
|
||||||
|
|
||||||
@param width
|
@param width
|
||||||
Specifies the width of the image.
|
Specifies the width of the image.
|
||||||
@param height
|
@param height
|
||||||
@@ -188,12 +188,12 @@ public:
|
|||||||
Clear the image with zeros.
|
Clear the image with zeros.
|
||||||
*/
|
*/
|
||||||
wxImage(int width, int height, bool clear = true);
|
wxImage(int width, int height, bool clear = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an image from data in memory. If static_data is false
|
Creates an image from data in memory. If static_data is false
|
||||||
then the wxImage will take ownership of the data and free it
|
then the wxImage will take ownership of the data and free it
|
||||||
afterwards. For this, it has to be allocated with @e malloc.
|
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
|
||||||
@@ -202,15 +202,15 @@ public:
|
|||||||
A pointer to RGB data
|
A pointer to RGB data
|
||||||
@param static_data
|
@param static_data
|
||||||
Indicates if the data should be free'd after use
|
Indicates if the data should be free'd after use
|
||||||
|
|
||||||
*/
|
*/
|
||||||
wxImage(int width, int height, unsigned char* data, bool static_data = false);
|
wxImage(int width, int height, unsigned char* data, bool static_data = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an image from data in memory. If static_data is false
|
Creates an image from data in memory. If static_data is false
|
||||||
then the wxImage will take ownership of the data and free it
|
then the wxImage will take ownership of the data and free it
|
||||||
afterwards. For this, it has to be allocated with @e malloc.
|
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
|
||||||
@@ -221,21 +221,21 @@ public:
|
|||||||
A pointer to alpha-channel data
|
A pointer to alpha-channel data
|
||||||
@param static_data
|
@param static_data
|
||||||
Indicates if the data should be free'd after use
|
Indicates if the data should be free'd after use
|
||||||
|
|
||||||
*/
|
*/
|
||||||
wxImage(int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
|
wxImage(int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an image from XPM data.
|
Creates an image from XPM data.
|
||||||
|
|
||||||
@param xpmData
|
@param xpmData
|
||||||
A pointer to XPM image data.
|
A pointer to XPM image data.
|
||||||
*/
|
*/
|
||||||
wxImage(const char* const* xpmData);
|
wxImage(const char* const* xpmData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an image from a file.
|
Creates an image from a file.
|
||||||
|
|
||||||
@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 type
|
@param type
|
||||||
@@ -265,11 +265,11 @@ public:
|
|||||||
|
|
||||||
@see LoadFile()
|
@see LoadFile()
|
||||||
*/
|
*/
|
||||||
wxImage(const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1);
|
wxImage(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an image from a file using MIME-types to specify the type.
|
Creates an image from a file using MIME-types to specify the type.
|
||||||
|
|
||||||
@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 type
|
@param type
|
||||||
@@ -280,10 +280,10 @@ public:
|
|||||||
See above
|
See above
|
||||||
*/
|
*/
|
||||||
wxImage(const wxString& name, const wxString& mimetype, int index = -1);
|
wxImage(const wxString& name, const wxString& mimetype, int index = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an image from a stream.
|
Creates an image from a stream.
|
||||||
|
|
||||||
@param stream
|
@param stream
|
||||||
Opened input stream from which to load the image. Currently,
|
Opened input stream from which to load the image. Currently,
|
||||||
the stream must support seeking.
|
the stream must support seeking.
|
||||||
@@ -292,11 +292,11 @@ public:
|
|||||||
@param index
|
@param index
|
||||||
See above.
|
See above.
|
||||||
*/
|
*/
|
||||||
wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1);
|
wxImage(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an image from a stream using MIME-types to specify the type.
|
Creates an image from a stream using MIME-types to specify the type.
|
||||||
|
|
||||||
@param stream
|
@param stream
|
||||||
Opened input stream from which to load the image. Currently,
|
Opened input stream from which to load the image. Currently,
|
||||||
the stream must support seeking.
|
the stream must support seeking.
|
||||||
@@ -306,7 +306,7 @@ public:
|
|||||||
See above.
|
See above.
|
||||||
*/
|
*/
|
||||||
wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1);
|
wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor.
|
Destructor.
|
||||||
@@ -344,7 +344,7 @@ public:
|
|||||||
@see Blur(), BlurHorizontal()
|
@see Blur(), BlurHorizontal()
|
||||||
*/
|
*/
|
||||||
wxImage BlurVertical(int blurRadius);
|
wxImage BlurVertical(int blurRadius);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if the current image handlers can read this file
|
Returns @true if the current image handlers can read this file
|
||||||
*/
|
*/
|
||||||
@@ -458,8 +458,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
static wxImageHandler* FindHandler(const wxString& name);
|
static wxImageHandler* FindHandler(const wxString& name);
|
||||||
static wxImageHandler* FindHandler(const wxString& extension,
|
static wxImageHandler* FindHandler(const wxString& extension,
|
||||||
long imageType);
|
wxBitmapType imageType);
|
||||||
static wxImageHandler* FindHandler(long imageType);
|
static wxImageHandler* FindHandler(wxBitmapType imageType);
|
||||||
static wxImageHandler* FindHandlerMime(const wxString& mimetype);
|
static wxImageHandler* FindHandlerMime(const wxString& mimetype);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
@@ -467,7 +467,7 @@ public:
|
|||||||
Return alpha value at given pixel location.
|
Return alpha value at given pixel location.
|
||||||
*/
|
*/
|
||||||
unsigned char GetAlpha(int x, int y) const;
|
unsigned char GetAlpha(int x, int y) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns pointer to the array storing the alpha values for this image. This
|
Returns pointer to the array storing the alpha values for this image. This
|
||||||
pointer is @NULL for the images without the alpha channel. If the image
|
pointer is @NULL for the images without the alpha channel. If the image
|
||||||
@@ -542,9 +542,9 @@ public:
|
|||||||
(exceptions are TIFF and ICO formats).
|
(exceptions are TIFF and ICO formats).
|
||||||
*/
|
*/
|
||||||
static int GetImageCount(const wxString& filename,
|
static int GetImageCount(const wxString& filename,
|
||||||
long type = wxBITMAP_TYPE_ANY);
|
wxBitmapType type = wxBITMAP_TYPE_ANY);
|
||||||
static int GetImageCount(wxInputStream& stream,
|
static int GetImageCount(wxInputStream& stream,
|
||||||
long type = wxBITMAP_TYPE_ANY);
|
wxBitmapType type = wxBITMAP_TYPE_ANY);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -585,12 +585,12 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Gets a user-defined option as an integer. The function is case-insensitive
|
Gets a user-defined option as an integer. The function is case-insensitive
|
||||||
to @e name. If the given option is not present, the function returns 0.
|
to @e name. If the given option is not present, the function returns 0.
|
||||||
Use HasOption() is 0 is a possibly valid value for the option.
|
Use HasOption() is 0 is a possibly valid value for the option.
|
||||||
Options for wxPNGHandler
|
Options for wxPNGHandler
|
||||||
@li wxIMAGE_OPTION_PNG_FORMAT: Format for saving a PNG file.
|
@li wxIMAGE_OPTION_PNG_FORMAT: Format for saving a PNG file.
|
||||||
@li wxIMAGE_OPTION_PNG_BITDEPTH: Bit depth for every channel (R/G/B/A).
|
@li wxIMAGE_OPTION_PNG_BITDEPTH: Bit depth for every channel (R/G/B/A).
|
||||||
|
|
||||||
Supported values for wxIMAGE_OPTION_PNG_FORMAT:
|
Supported values for wxIMAGE_OPTION_PNG_FORMAT:
|
||||||
@li wxPNG_TYPE_COLOUR: Stores RGB image.
|
@li wxPNG_TYPE_COLOUR: Stores RGB image.
|
||||||
@li wxPNG_TYPE_GREY: Stores grey image, converts from RGB.
|
@li wxPNG_TYPE_GREY: Stores grey image, converts from RGB.
|
||||||
@@ -751,11 +751,11 @@ public:
|
|||||||
@see SaveFile()
|
@see SaveFile()
|
||||||
*/
|
*/
|
||||||
bool LoadFile(const wxString& name,
|
bool LoadFile(const wxString& name,
|
||||||
long type = wxBITMAP_TYPE_ANY,
|
wxBitmapType type = wxBITMAP_TYPE_ANY,
|
||||||
int index = -1);
|
int index = -1);
|
||||||
bool LoadFile(const wxString& name, const wxString& mimetype,
|
bool LoadFile(const wxString& name, const wxString& mimetype,
|
||||||
int index = -1);
|
int index = -1);
|
||||||
bool LoadFile(wxInputStream& stream, long type,
|
bool LoadFile(wxInputStream& stream, wxBitmapType type,
|
||||||
int index = -1);
|
int index = -1);
|
||||||
bool LoadFile(wxInputStream& stream,
|
bool LoadFile(wxInputStream& stream,
|
||||||
const wxString& mimetype,
|
const wxString& mimetype,
|
||||||
@@ -922,8 +922,8 @@ public:
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
@param quality
|
@param quality
|
||||||
Determines what method to use for resampling the image.
|
Determines what method to use for resampling the image.
|
||||||
|
|
||||||
Can be one of the following:
|
Can be one of the following:
|
||||||
@li wxIMAGE_QUALITY_NORMAL: Uses the normal default scaling method of
|
@li wxIMAGE_QUALITY_NORMAL: Uses the normal default scaling method of
|
||||||
pixel replication
|
pixel replication
|
||||||
@@ -935,14 +935,14 @@ public:
|
|||||||
wxImage Scale(int width, int height,
|
wxImage Scale(int width, int height,
|
||||||
int quality = wxIMAGE_QUALITY_NORMAL) const;
|
int quality = wxIMAGE_QUALITY_NORMAL) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Assigns new data as alpha channel to the image.
|
Assigns new data as alpha channel to the image.
|
||||||
If @e static_data is false the data will be
|
If @e static_data is false the data will be
|
||||||
free()'d after use.
|
free()'d after use.
|
||||||
*/
|
*/
|
||||||
void SetAlpha(unsigned char* alpha = NULL,
|
void SetAlpha(unsigned char* alpha = NULL,
|
||||||
bool static_data = false);
|
bool static_data = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the alpha value for the given pixel. This function should only be
|
Sets the alpha value for the given pixel. This function should only be
|
||||||
called if the image has alpha channel data, use HasAlpha() to
|
called if the image has alpha channel data, use HasAlpha() to
|
||||||
|
@@ -68,7 +68,7 @@ wxIconBundle::wxIconBundle()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
wxIconBundle::wxIconBundle(const wxString& file, long type)
|
wxIconBundle::wxIconBundle(const wxString& file, wxBitmapType type)
|
||||||
: wxGDIObject()
|
: wxGDIObject()
|
||||||
{
|
{
|
||||||
AddIcon(file, type);
|
AddIcon(file, type);
|
||||||
@@ -101,7 +101,7 @@ void wxIconBundle::DeleteIcons()
|
|||||||
UnRef();
|
UnRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxIconBundle::AddIcon(const wxString& file, long type)
|
void wxIconBundle::AddIcon(const wxString& file, wxBitmapType type)
|
||||||
{
|
{
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
// Deal with standard icons
|
// Deal with standard icons
|
||||||
@@ -238,3 +238,4 @@ wxIcon wxIconBundle::GetIconByIndex(size_t n) const
|
|||||||
return M_ICONBUNDLEDATA->m_icons[n];
|
return M_ICONBUNDLEDATA->m_icons[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -140,7 +140,7 @@ wxImage::wxImage( int width, int height, unsigned char* data, unsigned char* alp
|
|||||||
Create( width, height, data, alpha, static_data );
|
Create( width, height, data, alpha, static_data );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxImage::wxImage( const wxString& name, long type, int index )
|
wxImage::wxImage( const wxString& name, wxBitmapType type, int index )
|
||||||
{
|
{
|
||||||
LoadFile( name, type, index );
|
LoadFile( name, type, index );
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ wxImage::wxImage( const wxString& name, const wxString& mimetype, int index )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
wxImage::wxImage( wxInputStream& stream, long type, int index )
|
wxImage::wxImage( wxInputStream& stream, wxBitmapType type, int index )
|
||||||
{
|
{
|
||||||
LoadFile( stream, type, index );
|
LoadFile( stream, type, index );
|
||||||
}
|
}
|
||||||
@@ -2014,7 +2014,7 @@ bool wxImage::HasOption(const wxString& name) const
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
|
bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
|
||||||
long WXUNUSED_UNLESS_STREAMS(type),
|
wxBitmapType WXUNUSED_UNLESS_STREAMS(type),
|
||||||
int WXUNUSED_UNLESS_STREAMS(index) )
|
int WXUNUSED_UNLESS_STREAMS(index) )
|
||||||
{
|
{
|
||||||
#if HAS_FILE_STREAMS
|
#if HAS_FILE_STREAMS
|
||||||
@@ -2058,24 +2058,23 @@ bool wxImage::LoadFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool wxImage::SaveFile( const wxString& filename ) const
|
bool wxImage::SaveFile( const wxString& filename ) const
|
||||||
{
|
{
|
||||||
wxString ext = filename.AfterLast('.').Lower();
|
wxString ext = filename.AfterLast('.').Lower();
|
||||||
|
|
||||||
wxImageHandler * pHandler = FindHandler(ext, -1);
|
wxImageHandler *handler = FindHandler(ext, wxBITMAP_TYPE_ANY);
|
||||||
if (pHandler)
|
if ( !handler)
|
||||||
{
|
{
|
||||||
return SaveFile(filename, pHandler->GetType());
|
wxLogError(_("Can't save image to file '%s': unknown extension."),
|
||||||
|
filename);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogError(_("Can't save image to file '%s': unknown extension."), filename.c_str());
|
return SaveFile(filename, handler->GetType());
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
|
bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
|
||||||
int WXUNUSED_UNLESS_STREAMS(type) ) const
|
wxBitmapType WXUNUSED_UNLESS_STREAMS(type) ) const
|
||||||
{
|
{
|
||||||
#if HAS_FILE_STREAMS
|
#if HAS_FILE_STREAMS
|
||||||
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
||||||
@@ -2125,7 +2124,7 @@ bool wxImage::CanRead( const wxString& WXUNUSED_UNLESS_STREAMS(name) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
int wxImage::GetImageCount( const wxString& WXUNUSED_UNLESS_STREAMS(name),
|
int wxImage::GetImageCount( const wxString& WXUNUSED_UNLESS_STREAMS(name),
|
||||||
long WXUNUSED_UNLESS_STREAMS(type) )
|
wxBitmapType WXUNUSED_UNLESS_STREAMS(type) )
|
||||||
{
|
{
|
||||||
#if HAS_FILE_STREAMS
|
#if HAS_FILE_STREAMS
|
||||||
wxImageFileInputStream stream(name);
|
wxImageFileInputStream stream(name);
|
||||||
@@ -2152,7 +2151,7 @@ bool wxImage::CanRead( wxInputStream &stream )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxImage::GetImageCount( wxInputStream &stream, long type )
|
int wxImage::GetImageCount( wxInputStream &stream, wxBitmapType type )
|
||||||
{
|
{
|
||||||
wxImageHandler *handler;
|
wxImageHandler *handler;
|
||||||
|
|
||||||
@@ -2197,7 +2196,7 @@ int wxImage::GetImageCount( wxInputStream &stream, long type )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxImage::LoadFile( wxInputStream& stream, long type, int index )
|
bool wxImage::LoadFile( wxInputStream& stream, wxBitmapType type, int index )
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
@@ -2225,23 +2224,22 @@ bool wxImage::LoadFile( wxInputStream& stream, long type, int index )
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//else: have specific type
|
||||||
|
|
||||||
handler = FindHandler(type);
|
handler = FindHandler(type);
|
||||||
|
if ( !handler )
|
||||||
if (handler == 0)
|
|
||||||
{
|
{
|
||||||
wxLogWarning( _("No image handler for type %ld defined."), type );
|
wxLogWarning( _("No image handler for type %ld defined."), type );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.IsSeekable() && !handler->CanRead(stream))
|
if ( stream.IsSeekable() && !handler->CanRead(stream) )
|
||||||
{
|
{
|
||||||
wxLogError(_("Image file is not of type %ld."), type);
|
wxLogError(_("Image file is not of type %ld."), type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return handler->LoadFile(this, stream, true/*verbose*/, index);
|
return handler->LoadFile(this, stream, true/*verbose*/, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int index )
|
bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int index )
|
||||||
@@ -2252,23 +2250,22 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int ind
|
|||||||
|
|
||||||
wxImageHandler *handler = FindHandlerMime(mimetype);
|
wxImageHandler *handler = FindHandlerMime(mimetype);
|
||||||
|
|
||||||
if (handler == 0)
|
if ( !handler )
|
||||||
{
|
{
|
||||||
wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() );
|
wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.IsSeekable() && !handler->CanRead(stream))
|
if ( stream.IsSeekable() && !handler->CanRead(stream) )
|
||||||
{
|
{
|
||||||
wxLogError(_("Image file is not of type %s."), mimetype);
|
wxLogError(_("Image file is not of type %s."), mimetype);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return handler->LoadFile( this, stream, true/*verbose*/, index );
|
return handler->LoadFile( this, stream, true/*verbose*/, index );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxImage::SaveFile( wxOutputStream& stream, int type ) const
|
bool wxImage::SaveFile( wxOutputStream& stream, wxBitmapType type ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
||||||
|
|
||||||
@@ -2276,7 +2273,6 @@ bool wxImage::SaveFile( wxOutputStream& stream, int type ) const
|
|||||||
if ( !handler )
|
if ( !handler )
|
||||||
{
|
{
|
||||||
wxLogWarning( _("No image handler for type %d defined."), type );
|
wxLogWarning( _("No image handler for type %d defined."), type );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2291,12 +2287,11 @@ bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) const
|
|||||||
if ( !handler )
|
if ( !handler )
|
||||||
{
|
{
|
||||||
wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() );
|
wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() );
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler->SaveFile( (wxImage*)this, stream );
|
return handler->SaveFile( (wxImage*)this, stream );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_STREAMS
|
#endif // wxUSE_STREAMS
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -2366,21 +2361,23 @@ wxImageHandler *wxImage::FindHandler( const wxString& name )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType )
|
wxImageHandler *wxImage::FindHandler( const wxString& extension, wxBitmapType bitmapType )
|
||||||
{
|
{
|
||||||
wxList::compatibility_iterator node = sm_handlers.GetFirst();
|
wxList::compatibility_iterator node = sm_handlers.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxImageHandler *handler = (wxImageHandler*)node->GetData();
|
wxImageHandler *handler = (wxImageHandler*)node->GetData();
|
||||||
if ( (handler->GetExtension().Cmp(extension) == 0) &&
|
if ( (handler->GetExtension().Cmp(extension) == 0) &&
|
||||||
(bitmapType == -1 || handler->GetType() == bitmapType) )
|
( (bitmapType == wxBITMAP_TYPE_ANY) || (handler->GetType() == bitmapType)) )
|
||||||
|
{
|
||||||
return handler;
|
return handler;
|
||||||
|
}
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxImageHandler *wxImage::FindHandler( long bitmapType )
|
wxImageHandler *wxImage::FindHandler(wxBitmapType bitmapType )
|
||||||
{
|
{
|
||||||
wxList::compatibility_iterator node = sm_handlers.GetFirst();
|
wxList::compatibility_iterator node = sm_handlers.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
|
Reference in New Issue
Block a user