reorganized wxBitmap/wxBitmapHandler classes to use wxBitmapType instead of "long" where possible; made them const-correct; introduce wxBITMAP_SCREEN_DEPTH instead of -1 for clearness (specially in the docs); remove wxBitmapHandler empty stubs and rename wxBitmapHandlerBase as wxBitmapHandler

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-03-25 20:31:48 +00:00
parent 0685aa9eb6
commit e86f2cc84a
22 changed files with 184 additions and 236 deletions

View File

@@ -40,6 +40,8 @@ DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT)
// wxMask represents the transparent area of the bitmap
// ----------------------------------------------------------------------------
// TODO: all implementation of wxMask, except the generic one,
// do not derive from wxMaskBase,,, they should
class WXDLLEXPORT wxMaskBase : public wxObject
{
public:
@@ -78,8 +80,13 @@ protected:
#define wxUSE_BITMAP_BASE 0
#endif
// Only used by some ports
// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes
// a more readable way to tell
#define wxBITMAP_SCREEN_DEPTH (-1)
// All ports except wxMSW,wxOS2,wxPalmOS use wxBitmapHandler and wxBitmapBase as base class
// for wxBitmapHandler; wxMSW,wxOS2,wxPalmOS use wxGDIImageHandler as base class
// since it allows some code reuse there.
#if wxUSE_BITMAP_BASE
// ----------------------------------------------------------------------------
@@ -87,18 +94,29 @@ protected:
// different formats
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapHandlerBase : public wxObject
class WXDLLEXPORT wxBitmapHandler : public wxObject
{
public:
wxBitmapHandlerBase() { m_type = wxBITMAP_TYPE_INVALID; }
virtual ~wxBitmapHandlerBase() { }
wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; }
virtual ~wxBitmapHandler() { }
virtual bool Create(wxBitmap *bitmap, const void* data, long flags,
int width, int height, int depth = 1);
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL);
// NOTE: the following functions should be pure virtuals, but they aren't
// because otherwise almost all ports would have to implement
// them as "return false"...
virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data),
wxBitmapType WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(depth) = 1)
{ return false; }
virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
wxBitmapType WXUNUSED(type), int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{ return false; }
virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = NULL) const
{ return false; }
void SetName(const wxString& name) { m_name = name; }
void SetExtension(const wxString& ext) { m_extension = ext; }
@@ -112,9 +130,14 @@ private:
wxString m_extension;
wxBitmapType m_type;
DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase)
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
// ----------------------------------------------------------------------------
// wxBitmap: class which represents platform-dependent bitmap (unlike wxImage)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapBase : public wxGDIObject
{
public:
@@ -122,17 +145,18 @@ public:
Derived class must implement these:
wxBitmap();
wxBitmap(int width, int height, int depth = -1);
wxBitmap(const wxBitmap& bmp);
wxBitmap(const char bits[], int width, int height, int depth = 1);
wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
wxBitmap(const char* const* bits);
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
wxBitmap(const wxImage& image, int depth = -1);
bool Create(int width, int height, int depth = -1);
wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH);
static void InitStandardHandlers();
*/
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0;
virtual int GetDepth() const = 0;
@@ -173,8 +197,8 @@ public:
// Format handling
static inline wxList& GetHandlers() { return sm_handlers; }
static void AddHandler(wxBitmapHandlerBase *handler);
static void InsertHandler(wxBitmapHandlerBase *handler);
static void AddHandler(wxBitmapHandler *handler);
static void InsertHandler(wxBitmapHandler *handler);
static bool RemoveHandler(const wxString& name);
static wxBitmapHandler *FindHandler(const wxString& name);
static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType);

View File

@@ -135,7 +135,7 @@ public:
wxMask *GetMask() const;
void SetMask(wxMask *mask) ;
int GetBitmapType() const;
wxBitmapType GetBitmapType() const;
// wxCocoa
WX_NSBitmapImageRep GetNSBitmapImageRep();
@@ -152,9 +152,5 @@ protected:
DECLARE_DYNAMIC_CLASS(wxBitmap)
};
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
{
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
#endif // __WX_COCOA_BITMAP_H__

View File

@@ -21,11 +21,6 @@ wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
// wxBitmap
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapHandler : public wxBitmapHandlerBase
{
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase
{
public:
@@ -55,7 +50,8 @@ public:
virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const;
virtual bool SaveFile(const wxString &name, wxBitmapType type,
const wxPalette *palette = (wxPalette *) NULL) const;
virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
#if wxUSE_PALETTE

View File

@@ -51,23 +51,22 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{
public:
wxBitmap() { }
wxBitmap( int width, int height, int depth = -1 );
wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH );
wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const char* const* bits );
#ifdef wxNEEDS_CHARPP
// needed for old GCC
wxBitmap(char** data)
{
*this = wxBitmap(wx_const_cast(const char* const*, data));
}
{ *this = wxBitmap(wx_const_cast(const char* const*, data)); }
#endif
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
#if wxUSE_IMAGE
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
wxBitmap( const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH )
{ (void)CreateFromImage(image, depth); }
#endif // wxUSE_IMAGE
virtual ~wxBitmap();
bool Create(int width, int height, int depth = -1);
bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
virtual int GetHeight() const;
virtual int GetWidth() const;
@@ -112,7 +111,8 @@ public:
GdkPixbuf *GetPixbuf() const;
// Basically, this corresponds to Win32 StretchBlt()
wxBitmap Rescale(int clipx, int clipy, int clipwidth, int clipheight, int width, int height) const;
wxBitmap Rescale(int clipx, int clipy, int clipwidth, int clipheight,
int width, int height) const;
// raw bitmap access support functions
void *GetRawData(wxPixelDataBase& data, int bpp);
@@ -150,13 +150,4 @@ private:
DECLARE_DYNAMIC_CLASS(wxBitmap)
};
//-----------------------------------------------------------------------------
// wxBitmapHandler
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
{
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
#endif // _WX_GTK_BITMAP_H_

View File

@@ -146,13 +146,5 @@ private:
DECLARE_DYNAMIC_CLASS(wxBitmap)
};
//-----------------------------------------------------------------------------
// wxBitmapHandler
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
{
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
#endif // __GTKBITMAPH__

View File

@@ -80,11 +80,6 @@ private:
};
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
{
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
class WXDLLEXPORT wxBitmap: public wxBitmapBase
{
DECLARE_DYNAMIC_CLASS(wxBitmap)

View File

@@ -23,11 +23,6 @@ struct bitmap_t;
// wxBitmap
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
{
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
class WXDLLEXPORT wxBitmap: public wxBitmapBase
{
public:

View File

@@ -41,6 +41,7 @@ enum wxBitmapTransparency
// ----------------------------------------------------------------------------
// wxBitmap: a mono or colour bitmap
// NOTE: for wxMSW we don't use the wxBitmapBase base class declared in bitmap.h!
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmap : public wxGDIImage
@@ -65,7 +66,7 @@ public:
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE);
// New constructor for generalised creation from data
wxBitmap(const void* data, long type, int width, int height, int depth = 1);
wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1);
// Create a new, uninitialized bitmap of the given size and depth (if it
// is omitted, will create a bitmap compatible with the display)
@@ -135,11 +136,11 @@ public:
bool CopyFromDIB(const wxDIB& dib);
#endif
virtual bool Create(int width, int height, int depth = -1);
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
virtual bool Create(int width, int height, const wxDC& dc);
virtual bool Create(const void* data, long type, int width, int height, int depth = 1);
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE);
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1);
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE);
virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const;
wxBitmapRefData *GetBitmapData() const
{ return (wxBitmapRefData *)m_refData; }
@@ -244,45 +245,49 @@ protected:
DECLARE_DYNAMIC_CLASS(wxMask)
};
// ----------------------------------------------------------------------------
// wxBitmapHandler is a class which knows how to load/save bitmaps to/from file
// NOTE: for wxMSW we don't use the wxBitmapHandler class declared in bitmap.h!
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapHandler : public wxGDIImageHandler
{
public:
wxBitmapHandler() { }
wxBitmapHandler(const wxString& name, const wxString& ext, long type)
: wxGDIImageHandler(name, ext, type)
{
}
wxBitmapHandler(const wxString& name, const wxString& ext, wxBitmapType type)
: wxGDIImageHandler(name, ext, type) { }
// keep wxBitmapHandler derived from wxGDIImageHandler compatible with the
// old class which worked only with bitmaps
virtual bool Create(wxBitmap *bitmap,
const void* data,
long flags,
int width, int height, int depth = 1);
virtual bool LoadFile(wxBitmap *bitmap,
const wxString& name,
long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap,
const wxString& name,
int type,
const wxPalette *palette = NULL);
// implement wxGDIImageHandler's pure virtuals:
virtual bool Create(wxGDIImage *image,
const void* data,
long flags,
wxBitmapType type,
int width, int height, int depth = 1);
virtual bool Load(wxGDIImage *image,
const wxString& name,
long flags,
wxBitmapType type,
int desiredWidth, int desiredHeight);
virtual bool Save(wxGDIImage *image,
virtual bool Save(const wxGDIImage *image,
const wxString& name,
int type);
wxBitmapType type) const;
// make wxBitmapHandler compatible with the wxBitmapHandler interface
// declared in bitmap.h, even if it's derived from wxGDIImageHandler:
virtual bool Create(wxBitmap *bitmap,
const void* data,
wxBitmapType type,
int width, int height, int depth = 1);
virtual bool LoadFile(wxBitmap *bitmap,
const wxString& name,
wxBitmapType type,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(const wxBitmap *bitmap,
const wxString& name,
wxBitmapType type,
const wxPalette *palette = NULL) const;
private:
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)

View File

@@ -76,51 +76,6 @@ public:
};
};
// ----------------------------------------------------------------------------
// wxGDIImageHandler: a class which knows how to load/save wxGDIImages.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxGDIImageHandler : public wxObject
{
public:
// ctor
wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; }
wxGDIImageHandler(const wxString& name,
const wxString& ext,
long type)
: m_name(name), m_extension(ext)
{
m_type = type;
}
// accessors
void SetName(const wxString& name) { m_name = name; }
void SetExtension(const wxString& ext) { m_extension = ext; }
void SetType(long type) { m_type = type; }
const wxString& GetName() const { return m_name; }
const wxString& GetExtension() const { return m_extension; }
long GetType() const { return m_type; }
// real handler operations: to implement in derived classes
virtual bool Create(wxGDIImage *image,
const void* data,
long flags,
int width, int height, int depth = 1) = 0;
virtual bool Load(wxGDIImage *image,
const wxString& name,
long flags,
int desiredWidth, int desiredHeight) = 0;
virtual bool Save(wxGDIImage *image,
const wxString& name,
int type) = 0;
protected:
wxString m_name;
wxString m_extension;
long m_type;
};
// ----------------------------------------------------------------------------
// wxGDIImage: this class supports GDI image handlers which may be registered
// dynamically and will be used for loading/saving the images in the specified
@@ -192,4 +147,46 @@ protected:
static wxGDIImageHandlerList ms_handlers;
};
// ----------------------------------------------------------------------------
// wxGDIImageHandler: a class which knows how to load/save wxGDIImages.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxGDIImageHandler : public wxObject
{
public:
// ctor
wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; }
wxGDIImageHandler(const wxString& name,
const wxString& ext,
wxBitmapType type)
: m_name(name), m_extension(ext), m_type(type) { }
// accessors
void SetName(const wxString& name) { m_name = name; }
void SetExtension(const wxString& ext) { m_extension = ext; }
void SetType(wxBitmapType type) { m_type = type; }
const wxString& GetName() const { return m_name; }
const wxString& GetExtension() const { return m_extension; }
wxBitmapType GetType() const { return m_type; }
// real handler operations: to implement in derived classes
virtual bool Create(wxGDIImage *image,
const void* data,
wxBitmapType flags,
int width, int height, int depth = 1) = 0;
virtual bool Load(wxGDIImage *image,
const wxString& name,
wxBitmapType flags,
int desiredWidth, int desiredHeight) = 0;
virtual bool Save(const wxGDIImage *image,
const wxString& name,
wxBitmapType type) const = 0;
protected:
wxString m_name;
wxString m_extension;
wxBitmapType m_type;
};
#endif // _WX_MSW_GDIIMAGE_H_

View File

@@ -54,7 +54,7 @@ public:
#endif
// from resource/file
wxIcon(const wxString& name,
long type = wxBITMAP_TYPE_ICO_RESOURCE,
wxBitmapType type = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
wxIcon(const wxIconLocation& loc);
@@ -62,7 +62,7 @@ public:
virtual ~wxIcon();
virtual bool LoadFile(const wxString& name,
long type = wxBITMAP_TYPE_ICO_RESOURCE,
wxBitmapType type = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
// implementation only from now on

View File

@@ -287,7 +287,7 @@ public:
inline wxBitmapHandler( const wxString& rName
,const wxString& rExt
,long lType
,wxBitmapType lType
)
: wxGDIImageHandler( rName
,rExt
@@ -299,28 +299,28 @@ public:
// old class which worked only with bitmaps
virtual bool Create( wxBitmap* pBitmap
,const void* pData
,long lFlags
,wxBitmapType lType
,int nWidth
,int nHeight
,int nDepth = 1
);
virtual bool LoadFile( wxBitmap* pBitmap
,int nId
,long lFlags
,wxBitmapType lType
,int nDesiredWidth
,int nDesiredHeight
);
virtual bool LoadFile( wxBitmap* pBitmap
,const wxString& rName
,long lFlags
,wxBitmapType lType
,int nDesiredWidth
,int nDesiredHeight
);
virtual bool SaveFile( wxBitmap* pBitmap
,const wxString& rName
,int lType
,wxBitmapType lType
,const wxPalette* pPalette = NULL
);
) const;
virtual bool Create( wxGDIImage* pImage
,const void* pData
@@ -338,7 +338,7 @@ public:
virtual bool Save( wxGDIImage* pImage
,const wxString& rName
,int lType
);
) const;
private:
inline virtual bool Load( wxGDIImage* WXUNUSED(pImage)
,const wxString& WXUNUSED(rName)

View File

@@ -62,11 +62,6 @@ private:
// wxBitmap
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
{
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{
public:

View File

@@ -47,7 +47,7 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxIcon,WXDLLEXPORT)
IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase, wxGDIObject)
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase,wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxObject)
wxList wxBitmapBase::sm_handlers;
@@ -126,21 +126,6 @@ void wxBitmapBase::CleanUpHandlers()
}
}
bool wxBitmapHandlerBase::Create(wxBitmap*, const void*, long, int, int, int)
{
return false;
}
bool wxBitmapHandlerBase::LoadFile(wxBitmap*, const wxString&, long, int, int)
{
return false;
}
bool wxBitmapHandlerBase::SaveFile(const wxBitmap*, const wxString&, int, const wxPalette*)
{
return false;
}
class wxBitmapBaseModule: public wxModule
{
DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule)

View File

@@ -968,12 +968,6 @@ wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const
return newRef;
}
//-----------------------------------------------------------------------------
// wxBitmapHandler
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
/* static */ void wxBitmap::InitStandardHandlers()
{
// TODO: Insert handler based on GdkPixbufs handler later

View File

@@ -1373,12 +1373,6 @@ bool wxBitmap::HasAlpha() const
return false;
}
//-----------------------------------------------------------------------------
// wxBitmapHandler
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
/* static */ void wxBitmap::InitStandardHandlers()
{
// TODO: Insert handler based on GdkPixbufs handler later

View File

@@ -1615,12 +1615,6 @@ WXHBITMAP wxMask::GetHBITMAP() const
return m_maskBitmap ;
}
// ----------------------------------------------------------------------------
// wxBitmapHandler
// ----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
// ----------------------------------------------------------------------------
// Standard Handlers
// ----------------------------------------------------------------------------

View File

@@ -92,8 +92,6 @@ wxBitmapRefData::~wxBitmapRefData()
#define M_BMPDATA ((wxBitmapRefData *)m_refData)
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase)
wxBitmap::wxBitmap(int width, int height, int depth)

View File

@@ -520,14 +520,14 @@ wxBitmap::wxBitmap(int w, int h, const wxDC& dc)
(void)Create(w, h, dc);
}
wxBitmap::wxBitmap(const void* data, long type, int width, int height, int depth)
wxBitmap::wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth)
{
(void)Create(data, type, width, height, depth);
}
wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type)
{
LoadFile(filename, (int)type);
LoadFile(filename, type);
}
bool wxBitmap::Create(int width, int height, int depth)
@@ -1027,7 +1027,7 @@ wxImage wxBitmap::ConvertToImage() const
// loading and saving bitmaps
// ----------------------------------------------------------------------------
bool wxBitmap::LoadFile(const wxString& filename, long type)
bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
{
UnRef();
@@ -1055,7 +1055,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
return false;
}
bool wxBitmap::Create(const void* data, long type, int width, int height, int depth)
bool wxBitmap::Create(const void* data, wxBitmapType type, int width, int height, int depth)
{
UnRef();
@@ -1074,8 +1074,8 @@ bool wxBitmap::Create(const void* data, long type, int width, int height, int de
}
bool wxBitmap::SaveFile(const wxString& filename,
int type,
const wxPalette *palette)
wxBitmapType type,
const wxPalette *palette) const
{
wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler);
@@ -1563,27 +1563,27 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
bool wxBitmapHandler::Create(wxGDIImage *image,
const void* data,
long flags,
wxBitmapType type,
int width, int height, int depth)
{
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
return bitmap && Create(bitmap, data, flags, width, height, depth);
return bitmap && Create(bitmap, data, type, width, height, depth);
}
bool wxBitmapHandler::Load(wxGDIImage *image,
const wxString& name,
long flags,
wxBitmapType type,
int width, int height)
{
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
return bitmap && LoadFile(bitmap, name, flags, width, height);
return bitmap && LoadFile(bitmap, name, type, width, height);
}
bool wxBitmapHandler::Save(wxGDIImage *image,
bool wxBitmapHandler::Save(const wxGDIImage *image,
const wxString& name,
int type)
wxBitmapType type) const
{
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
@@ -1592,7 +1592,7 @@ bool wxBitmapHandler::Save(wxGDIImage *image,
bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap),
const void* WXUNUSED(data),
long WXUNUSED(type),
wxBitmapType WXUNUSED(type),
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(depth))
@@ -1602,17 +1602,17 @@ bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap),
bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
long WXUNUSED(type),
wxBitmapType WXUNUSED(type),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
return false;
}
bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap),
bool wxBitmapHandler::SaveFile(const wxBitmap *WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
int WXUNUSED(type),
const wxPalette *WXUNUSED(palette))
wxBitmapType WXUNUSED(type),
const wxPalette *WXUNUSED(palette)) const
{
return false;
}

View File

@@ -67,11 +67,11 @@ public:
}
virtual bool LoadFile(wxBitmap *bitmap,
const wxString& name, long flags,
const wxString& name, wxBitmapType flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap,
const wxString& name, int type,
const wxPalette *palette = NULL);
virtual bool SaveFile(const wxBitmap *bitmap,
const wxString& name, wxBitmapType type,
const wxPalette *palette = NULL) const;
private:
DECLARE_DYNAMIC_CLASS(wxBMPFileHandler)
@@ -87,7 +87,7 @@ public:
}
virtual bool LoadFile(wxBitmap *bitmap,
const wxString& name, long flags,
const wxString& name, wxBitmapType flags,
int desiredWidth, int desiredHeight);
private:
@@ -97,7 +97,7 @@ private:
class WXDLLEXPORT wxIconHandler : public wxGDIImageHandler
{
public:
wxIconHandler(const wxString& name, const wxString& ext, long type)
wxIconHandler(const wxString& name, const wxString& ext, wxBitmapType type)
: wxGDIImageHandler(name, ext, type)
{
}
@@ -105,7 +105,7 @@ public:
// creating and saving icons is not supported
virtual bool Create(wxGDIImage *WXUNUSED(image),
const void* WXUNUSED(data),
long WXUNUSED(flags),
wxBitmapType WXUNUSED(flags),
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(depth) = 1)
@@ -113,16 +113,16 @@ public:
return false;
}
virtual bool Save(wxGDIImage *WXUNUSED(image),
virtual bool Save(const wxGDIImage *WXUNUSED(image),
const wxString& WXUNUSED(name),
int WXUNUSED(type))
wxBitmapType WXUNUSED(type)) const
{
return false;
}
virtual bool Load(wxGDIImage *image,
const wxString& name,
long flags,
wxBitmapType flags,
int desiredWidth, int desiredHeight)
{
wxIcon *icon = wxDynamicCast(image, wxIcon);
@@ -133,7 +133,7 @@ public:
protected:
virtual bool LoadIcon(wxIcon *icon,
const wxString& name, long flags,
const wxString& name, wxBitmapType flags,
int desiredWidth = -1, int desiredHeight = -1) = 0;
};
@@ -148,7 +148,7 @@ public:
protected:
virtual bool LoadIcon(wxIcon *icon,
const wxString& name, long flags,
const wxString& name, wxBitmapType flags,
int desiredWidth = -1, int desiredHeight = -1);
private:
@@ -166,7 +166,7 @@ public:
protected:
virtual bool LoadIcon(wxIcon *icon,
const wxString& name, long flags,
const wxString& name, wxBitmapType flags,
int desiredWidth = -1, int desiredHeight = -1);
private:
@@ -318,7 +318,7 @@ void wxGDIImage::InitStandardHandlers()
// ----------------------------------------------------------------------------
bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap,
const wxString& name, long WXUNUSED(flags),
const wxString& name, wxBitmapType WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
@@ -351,7 +351,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap,
}
bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap,
const wxString& name, long WXUNUSED(flags),
const wxString& name, wxBitmapType WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
@@ -366,10 +366,10 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap,
#endif
}
bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap,
bool wxBMPFileHandler::SaveFile(const wxBitmap *bitmap,
const wxString& name,
int WXUNUSED(type),
const wxPalette * WXUNUSED(pal))
wxBitmapType WXUNUSED(type),
const wxPalette * WXUNUSED(pal)) const
{
#if wxUSE_WXDIB
wxCHECK_MSG( bitmap, false, _T("NULL bitmap in SaveFile") );
@@ -388,7 +388,7 @@ bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap,
bool wxICOFileHandler::LoadIcon(wxIcon *icon,
const wxString& name,
long WXUNUSED(flags),
wxBitmapType WXUNUSED(flags),
int desiredWidth, int desiredHeight)
{
icon->UnRef();
@@ -499,7 +499,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
bool wxICOResourceHandler::LoadIcon(wxIcon *icon,
const wxString& name,
long WXUNUSED(flags),
wxBitmapType WXUNUSED(flags),
int desiredWidth, int desiredHeight)
{
HICON hicon;

View File

@@ -72,12 +72,12 @@ wxIcon::wxIcon(const char bits[], int width, int height)
}
wxIcon::wxIcon(const wxString& iconfile,
long flags,
wxBitmapType type,
int desiredWidth,
int desiredHeight)
{
LoadFile(iconfile, flags, desiredWidth, desiredHeight);
LoadFile(iconfile, type, desiredWidth, desiredHeight);
}
wxIcon::wxIcon(const wxIconLocation& loc)
@@ -135,7 +135,7 @@ void wxIcon::CreateIconFromXpm(const char* const* data)
}
bool wxIcon::LoadFile(const wxString& filename,
long type,
wxBitmapType type,
int desiredWidth, int desiredHeight)
{
UnRef();

View File

@@ -39,7 +39,6 @@
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
// ============================================================================
// implementation
@@ -1457,7 +1456,7 @@ bool wxMask::Create(
bool wxBitmapHandler::Create( wxGDIImage* pImage,
const void* pData,
long WXUNUSED(lFlags),
wxBitmapType WXUNUSED(lFlags),
int nWidth,
int nHeight,
int nDepth)
@@ -1477,7 +1476,7 @@ bool wxBitmapHandler::Create( wxGDIImage* pImage,
bool wxBitmapHandler::Load(
wxGDIImage* pImage
, int nId
, long lFlags
, wxBitmapType lFlags
, int nWidth
, int nHeight
)
@@ -1498,7 +1497,7 @@ bool wxBitmapHandler::Save(
wxGDIImage* pImage
, const wxString& rName
, int lType
)
) const
{
wxBitmap* pBitmap = wxDynamicCast( pImage
,wxBitmap
@@ -1513,7 +1512,7 @@ bool wxBitmapHandler::Save(
bool wxBitmapHandler::Create(
wxBitmap* WXUNUSED(pBitmap)
, const void* WXUNUSED(pData)
, long WXUNUSED(lType)
, wxBitmapType WXUNUSED(lType)
, int WXUNUSED(nWidth)
, int WXUNUSED(nHeight)
, int WXUNUSED(nDepth)
@@ -1525,7 +1524,7 @@ bool wxBitmapHandler::Create(
bool wxBitmapHandler::LoadFile(
wxBitmap* WXUNUSED(pBitmap)
, int WXUNUSED(nId)
, long WXUNUSED(lType)
, wxBitmapType WXUNUSED(lType)
, int WXUNUSED(nDesiredWidth)
, int WXUNUSED(nDesiredHeight)
)
@@ -1536,7 +1535,7 @@ bool wxBitmapHandler::LoadFile(
bool wxBitmapHandler::LoadFile(
wxBitmap* WXUNUSED(pBitmap)
, const wxString& WXUNUSED(rName)
, long WXUNUSED(lType)
, wxBitmapType WXUNUSED(lType)
, int WXUNUSED(nDesiredWidth)
, int WXUNUSED(nDesiredHeight)
)
@@ -1547,9 +1546,9 @@ bool wxBitmapHandler::LoadFile(
bool wxBitmapHandler::SaveFile(
wxBitmap* WXUNUSED(pBitmap)
, const wxString& WXUNUSED(rName)
, int WXUNUSED(nType)
, wxBitmapType WXUNUSED(nType)
, const wxPalette* WXUNUSED(pPalette)
)
) const
{
return false;
}

View File

@@ -1296,8 +1296,6 @@ int GrGetPixelColor(GR_SCREEN_INFO* sinfo, GR_PALETTE* palette, GR_PIXELVAL pixe
// Bitmap handlers
// ============================================================================
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
#define M_BMPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData())
#if wxUSE_XPM