@see wxImage::LoadFile, wxImage::SaveFile, SaveFile()
*/
- bool LoadFile(wxImage* image, wxInputStream& stream,
- bool verbose = true, int index = 0);
+ virtual bool LoadFile(wxImage* image, wxInputStream& stream,
+ bool verbose = true, int index = -1);
/**
Saves a image in the output stream.
The image object which is to be affected by this operation.
@param stream
Opened output stream for writing the data.
+ @param verbose
+ If set to @true, errors reported by the image handler will produce
+ wxLogMessages.
@return @true if the operation succeeded, @false otherwise.
@see wxImage::LoadFile, wxImage::SaveFile, LoadFile()
*/
- bool SaveFile(wxImage* image, wxOutputStream& stream);
+ virtual bool SaveFile(wxImage* image, wxOutputStream& stream,
+ bool verbose = true);
/**
Sets the handler extension.
@return @false if FindFirstUnusedColour returns @false, @true otherwise.
*/
- bool ConvertAlphaToMask(unsigned char threshold = 128);
+ bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
/**
@deprecated
when converting to YUV, where every pixel equals
(R * @a lr) + (G * @a lg) + (B * @a lb).
*/
- wxImage ConvertToGreyscale(double lr = 0.299, double lg = 0.587,
- double lb = 0.114) const;
+ wxImage ConvertToGreyscale(double lr = 0.299, double lg = 0.587, double lb = 1.114) const;
/**
Returns monochromatic version of the image.
does have it, this pointer may be used to directly manipulate the alpha values
which are stored as the RGB ones.
*/
- const unsigned char * GetAlpha() const;
+ unsigned char* GetAlpha() const;
/**
Returns the blue intensity at the given coordinate.
Get the current mask colour or find a suitable unused colour that could be
used as a mask colour. Returns @true if the image currently has a mask.
*/
- bool GetOrFindMaskColour(unsigned char r, unsigned char g,
- unsigned char b) const;
+ bool GetOrFindMaskColour(unsigned char* r, unsigned char* g,
+ unsigned char* b) const;
/**
Returns the palette associated with the image.
/**
Converts a color in HSV color space to RGB color space.
*/
- wxImage::RGBValue HSVtoRGB(const wxImage::HSVValue & hsv);
+ static wxImage::RGBValue HSVtoRGB(const wxImage::HSVValue& hsv);
/**
Returns @true if this image has alpha channel, @false otherwise.
colour if this image has a mask or if this image has alpha channel and alpha
value of this pixel is strictly less than @a threshold.
*/
- bool IsTransparent(int x, int y, unsigned char threshold = 128) const;
+ bool IsTransparent(int x, int y,
+ unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const;
/**
Loads an image from an input stream.
@see SaveFile()
*/
- bool LoadFile(wxInputStream& stream, wxBitmapType type, int index = -1);
+ virtual bool LoadFile(wxInputStream& stream,
+ wxBitmapType type = wxBITMAP_TYPE_ANY,
+ int index = -1);
/**
Loads an image from a file.
@param index
See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload.
*/
- bool LoadFile(const wxString& name, const wxString& mimetype,
- int index = -1);
+ virtual bool LoadFile(const wxString& name, const wxString& mimetype,
+ int index = -1);
/**
/**
Converts a color in RGB color space to HSV color space.
*/
- wxImage::HSVValue RGBtoHSV(const wxImage::RGBValue& rgb);
+ static wxImage::HSVValue RGBtoHSV(const wxImage::RGBValue& rgb);
/**
Finds the handler with the given name, and removes it.
@see Scale()
*/
- wxImage Rescale(int width, int height,
+ wxImage& Rescale(int width, int height,
int quality = wxIMAGE_QUALITY_NORMAL);
/**
@see Size()
*/
- wxImage Resize(const wxSize& size, const wxPoint& pos,
- int red = -1, int green = -1,
- int blue = -1);
+ wxImage& Resize(const wxSize& size, const wxPoint& pos, int red = -1,
+ int green = -1, int blue = -1);
/**
Rotates the image about the given point, by @a angle radians.
@see LoadFile()
*/
- bool SaveFile(wxOutputStream& stream,
- const wxString& mimetype) const;
+ virtual bool SaveFile(wxOutputStream& stream,
+ const wxString& mimetype) const;
/**
Saves an image in the named file.
@param mimetype
MIME type.
*/
- bool SaveFile(const wxString& name,
- const wxString& mimetype) const;
+ virtual bool SaveFile(const wxString& name, const wxString& mimetype) const;
/**
Saves an image in the named file.
*/
void SetAlpha(int x, int y, unsigned char alpha);
+ //@{
/**
Sets the image data without performing checks.
that will be responsible for deleting it.
Do not pass to this function a pointer obtained through GetData().
*/
- void SetData(unsigned char* data);
+ void SetData(unsigned char* data, bool static_data = false);
+ void SetData(unsigned char* data, int new_width, int new_height,
+ bool static_data = false);
+ //@}
/**
Specifies whether there is a mask or not.
This routine performs bounds-checks for the coordinate so it can be considered
a safe way to manipulate the data.
*/
- void SetRGB(wxRect& rect, unsigned char red,
+ void SetRGB(const wxRect& rect,
+ unsigned char red,
unsigned char green,
unsigned char blue);
@return Returns 'this' object.
*/
- wxImage operator =(const wxImage& image);
+ wxImage& operator=(const wxImage& image);
};
// ============================================================================