//---------------------------------------------------------------------------
-class wxImageHandler {
+class wxImageHandler : public wxObject {
public:
// wxImageHandler(); Abstract Base Class
wxString GetName();
//---------------------------------------------------------------------------
-class wxImage {
+class wxImage : public wxObject {
public:
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY );
~wxImage();
wxBitmap ConvertToBitmap();
+#ifdef __WXGTK__
+ wxBitmap ConvertToMonoBitmap( unsigned char red, unsigned char green, unsigned char blue ) const;
+#endif
void Create( int width, int height );
void Destroy();
+
wxImage Scale( int width, int height );
wxImage& Rescale(int width, int height);
unsigned char GetGreen( int x, int y );
unsigned char GetBlue( int x, int y );
- bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_PNG );
+ static bool CanRead( const wxString& name );
+ bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY );
%name(LoadMimeFile)bool LoadFile( const wxString& name, const wxString& mimetype );
bool SaveFile( const wxString& name, int type );
void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
unsigned char r2, unsigned char g2, unsigned char b2 );
+ // convert to monochrome image (<r,g,b> will be replaced by white, everything else by black)
+ wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const;
+
+ void SetOption(const wxString& name, const wxString& value);
+ %name(SetOptionInt)void SetOption(const wxString& name, int value);
+ wxString GetOption(const wxString& name) const;
+ int GetOptionInt(const wxString& name) const;
+ bool HasOption(const wxString& name) const;
+
unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 );
// TODO: unsigned long ComputeHistogram( wxHashTable &h );
+ static void AddHandler( wxImageHandler *handler );
+ static void InsertHandler( wxImageHandler *handler );
+ static bool RemoveHandler( const wxString& name );
};
+
// Alternate constructors
-%new wxImage* wxNullImage();
-%new wxImage* wxEmptyImage(int width, int height);
+%new wxImage* wxEmptyImage(int width=0, int height=0);
%new wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype);
%new wxImage* wxImageFromBitmap(const wxBitmap &bitmap);
%{
- wxImage* wxNullImage() {
- return new wxImage;
- }
-
- wxImage* wxEmptyImage(int width, int height) {
- return new wxImage(width, height);
+ wxImage* wxEmptyImage(int width=0, int height=0) {
+ if (width == 0 && height == 0)
+ return new wxImage;
+ else
+ return new wxImage(width, height);
}
wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype) {
}
%}
-// Static Methods
-void wxImage_AddHandler(wxImageHandler *handler);
+void wxInitAllImageHandlers();
+
+
+%readonly
%{
- void wxImage_AddHandler(wxImageHandler *handler) {
- wxImage::AddHandler(handler);
- }
+#if 0
+%}
+
+extern wxImage wxNullImage;
+
+%readwrite
+%{
+#endif
%}
-void wxInitAllImageHandlers();
+
//---------------------------------------------------------------------------
+// This one is here to avoid circular imports
+
+%new wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1);
+
+%{
+ wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1) {
+ return new wxBitmap(img, depth);
+ }
+
+%}
+
+
//---------------------------------------------------------------------------