X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7323ff1aee02cc8c8979b6b25f84049ab0c081ae..a70ab3b804b6c363f8bcbed0b4fce94b7fb03612:/interface/wx/image.h diff --git a/interface/wx/image.h b/interface/wx/image.h index f78827b117..89a1713893 100644 --- a/interface/wx/image.h +++ b/interface/wx/image.h @@ -109,8 +109,8 @@ public: @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. @@ -119,12 +119,16 @@ public: 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. @@ -497,7 +501,7 @@ public: @return @false if FindFirstUnusedColour returns @false, @true otherwise. */ - bool ConvertAlphaToMask(unsigned char threshold = 128); + bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); /** @deprecated @@ -514,8 +518,7 @@ public: 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. @@ -638,7 +641,7 @@ public: 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. @@ -777,8 +780,8 @@ public: 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. @@ -818,7 +821,7 @@ public: /** 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. @@ -882,7 +885,8 @@ public: 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. @@ -928,7 +932,9 @@ public: @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. @@ -956,8 +962,8 @@ public: @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); /** @@ -988,7 +994,7 @@ public: /** 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. @@ -1019,7 +1025,7 @@ public: @see Scale() */ - wxImage Rescale(int width, int height, + wxImage& Rescale(int width, int height, int quality = wxIMAGE_QUALITY_NORMAL); /** @@ -1037,9 +1043,8 @@ public: @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. @@ -1091,8 +1096,8 @@ public: @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. @@ -1124,8 +1129,7 @@ public: @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. @@ -1219,6 +1223,7 @@ public: */ void SetAlpha(int x, int y, unsigned char alpha); + //@{ /** Sets the image data without performing checks. @@ -1233,7 +1238,10 @@ public: 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. @@ -1301,7 +1309,8 @@ public: 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); @@ -1350,7 +1359,7 @@ public: @return Returns 'this' object. */ - wxImage operator =(const wxImage& image); + wxImage& operator=(const wxImage& image); }; // ============================================================================