Move some things to wxBitmapBase to avoid much duplication.
Use proper const for XPM data, and const void* for arbitary bitmap data. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9ce05df4bc
commit
452418c4b0
@ -48,7 +48,7 @@ use:
|
||||
wxRect(0, 0, oldBitmap.GetWidth(), oldBitmap.GetHeight()));
|
||||
\end{verbatim}
|
||||
|
||||
\func{}{wxBitmap}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
|
||||
\func{}{wxBitmap}{\param{const void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
|
||||
|
||||
Creates a bitmap from the given data which is interpreted in platform-dependent
|
||||
manner.
|
||||
@ -75,7 +75,7 @@ or visual. Some platforms only support 1 for monochrome and -1 for the current
|
||||
colour setting. Beginning with version 2.5.4 of wxWidgets a depth of 32 including
|
||||
an alpha channel is supported under MSW, Mac and GTK+.
|
||||
|
||||
\func{}{wxBitmap}{\param{const char**}{ bits}}
|
||||
\func{}{wxBitmap}{\param{const char* const*}{ bits}}
|
||||
|
||||
Creates a bitmap from XPM data.
|
||||
|
||||
@ -260,7 +260,7 @@ Creates the bitmap from an icon.
|
||||
Creates a fresh bitmap. If the final argument is omitted, the display depth of
|
||||
the screen is used.
|
||||
|
||||
\func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
|
||||
\func{virtual bool}{Create}{\param{const void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
|
||||
|
||||
Creates a bitmap from the given data, which can be of arbitrary type.
|
||||
|
||||
|
@ -38,7 +38,7 @@ Destroys the wxBitmapHandler object.
|
||||
|
||||
\membersection{wxBitmapHandler::Create}\label{wxbitmaphandlercreate}
|
||||
|
||||
\func{virtual bool}{Create}{\param{wxBitmap* }{bitmap}, \param{void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
|
||||
\func{virtual bool}{Create}{\param{wxBitmap* }{bitmap}, \param{const void*}{ data}, \param{int}{ type}, \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
|
||||
|
||||
Creates a bitmap from the given data, which can be of arbitrary type. The wxBitmap object {\it bitmap} is
|
||||
manipulated by this function.
|
||||
@ -64,13 +64,13 @@ true if the call succeeded, false otherwise (the default).
|
||||
|
||||
\membersection{wxBitmapHandler::GetName}\label{wxbitmaphandlergetname}
|
||||
|
||||
\constfunc{wxString}{GetName}{\void}
|
||||
\constfunc{const wxString\&}{ GetName}{\void}
|
||||
|
||||
Gets the name of this handler.
|
||||
|
||||
\membersection{wxBitmapHandler::GetExtension}\label{wxbitmaphandlergetextension}
|
||||
|
||||
\constfunc{wxString}{GetExtension}{\void}
|
||||
\constfunc{const wxString\&}{ GetExtension}{\void}
|
||||
|
||||
Gets the file extension associated with this handler.
|
||||
|
||||
|
@ -128,7 +128,7 @@ Loads an image from a file.
|
||||
|
||||
Loads an image from an input stream.
|
||||
|
||||
\func{}{wxImage}{\param{const char** }{xpmData}}
|
||||
\func{}{wxImage}{\param{const char* const* }{xpmData}}
|
||||
|
||||
Creates an image from XPM data.
|
||||
|
||||
@ -1383,14 +1383,14 @@ Destroys the wxImageHandler object.
|
||||
|
||||
\membersection{wxImageHandler::GetName}\label{wximagehandlergetname}
|
||||
|
||||
\constfunc{wxString}{GetName}{\void}
|
||||
\constfunc{const wxString\&}{GetName}{\void}
|
||||
|
||||
Gets the name of this handler.
|
||||
|
||||
|
||||
\membersection{wxImageHandler::GetExtension}\label{wximagehandlergetextension}
|
||||
|
||||
\constfunc{wxString}{GetExtension}{\void}
|
||||
\constfunc{const wxString\&}{GetExtension}{\void}
|
||||
|
||||
Gets the file extension associated with this handler.
|
||||
|
||||
@ -1420,7 +1420,7 @@ Gets the image type associated with this handler.
|
||||
|
||||
\membersection{wxImageHandler::GetMimeType}\label{wximagehandlergetmimetype}
|
||||
|
||||
\constfunc{wxString}{GetMimeType}{\void}
|
||||
\constfunc{const wxString\&}{GetMimeType}{\void}
|
||||
|
||||
Gets the MIME type associated with this handler.
|
||||
|
||||
|
@ -16,10 +16,7 @@
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/gdicmn.h" // for wxBitmapType
|
||||
#include "wx/colour.h"
|
||||
|
||||
@ -93,26 +90,21 @@ protected:
|
||||
class WXDLLEXPORT wxBitmapHandlerBase : public wxObject
|
||||
{
|
||||
public:
|
||||
wxBitmapHandlerBase()
|
||||
: m_name()
|
||||
, m_extension()
|
||||
, m_type(wxBITMAP_TYPE_INVALID)
|
||||
{ }
|
||||
|
||||
wxBitmapHandlerBase() { m_type = wxBITMAP_TYPE_INVALID; }
|
||||
virtual ~wxBitmapHandlerBase() { }
|
||||
|
||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
|
||||
int width, int height, int depth = 1) = 0;
|
||||
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) = 0;
|
||||
int desiredWidth, int desiredHeight);
|
||||
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
|
||||
int type, const wxPalette *palette = NULL) = 0;
|
||||
int type, const wxPalette *palette = NULL);
|
||||
|
||||
void SetName(const wxString& name) { m_name = name; }
|
||||
void SetExtension(const wxString& ext) { m_extension = ext; }
|
||||
void SetType(wxBitmapType type) { m_type = type; }
|
||||
wxString GetName() const { return m_name; }
|
||||
wxString GetExtension() const { return m_extension; }
|
||||
const wxString& GetName() const { return m_name; }
|
||||
const wxString& GetExtension() const { return m_extension; }
|
||||
wxBitmapType GetType() const { return m_type; }
|
||||
|
||||
private:
|
||||
@ -120,7 +112,6 @@ private:
|
||||
wxString m_extension;
|
||||
wxBitmapType m_type;
|
||||
|
||||
private:
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase)
|
||||
};
|
||||
|
||||
@ -133,8 +124,7 @@ public:
|
||||
wxBitmap();
|
||||
wxBitmap(int width, int height, int depth = -1);
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
wxBitmap(const char **bits);
|
||||
wxBitmap(char **bits);
|
||||
wxBitmap(const char* const* bits);
|
||||
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
|
||||
wxBitmap(const wxImage& image, int depth = -1);
|
||||
bool operator == (const wxBitmap& bmp) const;
|
||||
|
@ -71,12 +71,11 @@ public:
|
||||
// Initialize with raw data.
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
// Initialize with XPM data
|
||||
wxBitmap(const char **bits) { CreateFromXpm(bits); }
|
||||
wxBitmap(char **bits) { CreateFromXpm((const char**)bits); }
|
||||
wxBitmap(const char* const* bits);
|
||||
// Load a file or resource
|
||||
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE);
|
||||
// Constructor for generalised creation from data
|
||||
wxBitmap(void *data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
// If depth is omitted, will create a bitmap compatible with the display
|
||||
wxBitmap(int width, int height, int depth = -1);
|
||||
// Convert from wxImage:
|
||||
@ -92,13 +91,11 @@ public:
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Initialize with XPM data
|
||||
bool CreateFromXpm(const char **bits);
|
||||
// Initialize from wxImage
|
||||
bool CreateFromImage(const wxImage& image, int depth=-1);
|
||||
|
||||
virtual bool Create(int width, int height, int depth = -1);
|
||||
virtual bool Create(void *data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
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;
|
||||
|
||||
@ -152,4 +149,9 @@ public:
|
||||
static void CleanUpHandlers() { }
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_BITMAP_H__
|
||||
|
@ -19,12 +19,9 @@ wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
|
||||
// wxBitmap
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler : public wxBitmapHandlerBase
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
|
||||
{
|
||||
public:
|
||||
wxBitmapHandler() : wxBitmapHandlerBase() {}
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
|
||||
@ -35,8 +32,7 @@ public:
|
||||
wxBitmap(int width, int height, int depth = -1);
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
|
||||
wxBitmap(const char **bits) { CreateFromXpm(bits); }
|
||||
wxBitmap(char **bits) { CreateFromXpm((const char **)bits); }
|
||||
wxBitmap(const char* const* bits);
|
||||
#if wxUSE_IMAGE
|
||||
wxBitmap(const wxImage& image, int depth = -1);
|
||||
#endif
|
||||
@ -83,8 +79,6 @@ public:
|
||||
wxIDirectFBSurfacePtr GetDirectFBSurface() const;
|
||||
|
||||
protected:
|
||||
bool CreateFromXpm(const char **bits);
|
||||
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
wxBitmap() { }
|
||||
wxBitmap( int width, int height, int depth = -1 );
|
||||
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
||||
wxBitmap( const char* const* bits ) { CreateFromXpm(bits); }
|
||||
wxBitmap( const char* const* bits );
|
||||
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
|
||||
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
|
||||
virtual ~wxBitmap();
|
||||
@ -114,7 +114,6 @@ public:
|
||||
void UseAlpha();
|
||||
|
||||
protected:
|
||||
bool CreateFromXpm(const char* const* bits);
|
||||
bool CreateFromImage(const wxImage& image, int depth);
|
||||
|
||||
private:
|
||||
@ -144,17 +143,7 @@ private:
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
|
||||
{
|
||||
public:
|
||||
wxBitmapHandler() { }
|
||||
virtual ~wxBitmapHandler();
|
||||
|
||||
virtual bool Create(wxBitmap *bitmap, 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);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_BITMAP_H_
|
||||
|
@ -67,8 +67,7 @@ public:
|
||||
wxBitmap();
|
||||
wxBitmap( int width, int height, int depth = -1 );
|
||||
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
||||
wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
|
||||
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
||||
wxBitmap( const char* const* bits );
|
||||
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
|
||||
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
|
||||
virtual ~wxBitmap();
|
||||
@ -128,7 +127,6 @@ public:
|
||||
void UseAlpha();
|
||||
|
||||
protected:
|
||||
bool CreateFromXpm(const char **bits);
|
||||
bool CreateFromImage(const wxImage& image, int depth);
|
||||
|
||||
private:
|
||||
@ -148,18 +146,7 @@ private:
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
|
||||
{
|
||||
public:
|
||||
wxBitmapHandler() { }
|
||||
virtual ~wxBitmapHandler();
|
||||
|
||||
virtual bool Create(wxBitmap *bitmap, 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);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
|
||||
};
|
||||
|
||||
|
||||
#endif // __GTKBITMAPH__
|
||||
|
@ -99,10 +99,10 @@ public:
|
||||
void SetExtension(const wxString& ext) { m_extension = ext; }
|
||||
void SetType(long type) { m_type = type; }
|
||||
void SetMimeType(const wxString& type) { m_mime = type; }
|
||||
wxString GetName() const { return m_name; }
|
||||
wxString GetExtension() const { return m_extension; }
|
||||
const wxString& GetName() const { return m_name; }
|
||||
const wxString& GetExtension() const { return m_extension; }
|
||||
long GetType() const { return m_type; }
|
||||
wxString GetMimeType() const { return m_mime; }
|
||||
const wxString& GetMimeType() const { return m_mime; }
|
||||
|
||||
protected:
|
||||
#if wxUSE_STREAMS
|
||||
@ -199,8 +199,7 @@ public:
|
||||
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, const wxString& mimetype, int index = -1 );
|
||||
wxImage( const char** xpmData );
|
||||
wxImage( char** xpmData );
|
||||
wxImage( const char* const* xpmData );
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
||||
@ -210,7 +209,7 @@ public:
|
||||
bool Create( int width, int height, bool clear = true );
|
||||
bool Create( int width, int height, unsigned char* data, bool static_data = false );
|
||||
bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
|
||||
bool Create( const char** xpmData );
|
||||
bool Create( const char* const* xpmData );
|
||||
void Destroy();
|
||||
|
||||
// creates an identical copy of the image (the = operator
|
||||
|
@ -78,23 +78,11 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBitmapHandler: public wxBitmapHandlerBase
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
|
||||
{
|
||||
public:
|
||||
wxBitmapHandler() { }
|
||||
virtual ~wxBitmapHandler();
|
||||
|
||||
virtual bool Create(wxBitmap *bitmap, 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);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
|
||||
};
|
||||
|
||||
#define M_BITMAPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData())
|
||||
|
||||
class WXDLLEXPORT wxBitmap: public wxBitmapBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||
@ -108,15 +96,13 @@ public:
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
|
||||
// Initialize with XPM data
|
||||
bool CreateFromXpm(const char **bits);
|
||||
wxBitmap(const char **bits);
|
||||
wxBitmap(char **bits);
|
||||
wxBitmap(const char* const* bits);
|
||||
|
||||
// Load a file or resource
|
||||
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_PICT_RESOURCE);
|
||||
|
||||
// Constructor for generalised creation from data
|
||||
wxBitmap(void *data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
|
||||
// If depth is omitted, will create a bitmap compatible with the display
|
||||
wxBitmap(int width, int height, int depth = -1);
|
||||
@ -135,7 +121,7 @@ public:
|
||||
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
||||
|
||||
virtual bool Create(int width, int height, int depth = -1);
|
||||
virtual bool Create(void *data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
// virtual bool Create( WXHICON icon) ;
|
||||
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;
|
||||
|
@ -23,12 +23,9 @@ struct bitmap_t;
|
||||
// wxBitmap
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxBitmapHandler : public wxBitmapHandlerBase
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
|
||||
{
|
||||
public:
|
||||
wxBitmapHandler() : wxBitmapHandlerBase() {}
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBitmap: public wxBitmapBase
|
||||
@ -37,8 +34,7 @@ public:
|
||||
wxBitmap() {}
|
||||
wxBitmap(int width, int height, int depth = -1);
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
wxBitmap(const char **bits) { CreateFromXpm(bits); }
|
||||
wxBitmap(char **bits) { CreateFromXpm((const char **)bits); }
|
||||
wxBitmap(const char* const* bits);
|
||||
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
|
||||
wxBitmap(const wxImage& image, int depth = -1);
|
||||
virtual ~wxBitmap() {}
|
||||
@ -81,8 +77,6 @@ public:
|
||||
bitmap_t *GetMGLbitmap_t() const;
|
||||
|
||||
protected:
|
||||
bool CreateFromXpm(const char **bits);
|
||||
|
||||
// creates temporary DC for access to bitmap's data:
|
||||
MGLDevCtx *CreateTmpDC() const;
|
||||
// sets fg & bg colours for 1bit bitmaps:
|
||||
|
@ -45,14 +45,13 @@ public:
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
|
||||
// Initialize with XPM data
|
||||
wxBitmap(const char **data) { CreateFromXpm(data); }
|
||||
wxBitmap(char **data) { CreateFromXpm((const char **)data); }
|
||||
wxBitmap(const char* const* data);
|
||||
|
||||
// Load a file or resource
|
||||
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE);
|
||||
|
||||
// New constructor for generalised creation from data
|
||||
wxBitmap(void *data, long type, int width, int height, int depth = 1);
|
||||
wxBitmap(const void* data, long 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)
|
||||
@ -114,7 +113,7 @@ public:
|
||||
|
||||
virtual bool Create(int width, int height, int depth = -1);
|
||||
virtual bool Create(int width, int height, const wxDC& dc);
|
||||
virtual bool Create(void *data, long type, int width, int height, int depth = 1);
|
||||
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);
|
||||
|
||||
@ -165,9 +164,6 @@ protected:
|
||||
virtual wxGDIImageRefData *CreateData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
// creates the bitmap from XPM data, supposed to be called from ctor
|
||||
bool CreateFromXpm(const char **bits);
|
||||
|
||||
// creates an uninitialized bitmap, called from Create()s above
|
||||
bool DoCreate(int w, int h, int depth, WXHDC hdc);
|
||||
|
||||
@ -245,7 +241,7 @@ public:
|
||||
// keep wxBitmapHandler derived from wxGDIImageHandler compatible with the
|
||||
// old class which worked only with bitmaps
|
||||
virtual bool Create(wxBitmap *bitmap,
|
||||
void *data,
|
||||
const void* data,
|
||||
long flags,
|
||||
int width, int height, int depth = 1);
|
||||
virtual bool LoadFile(wxBitmap *bitmap,
|
||||
@ -258,7 +254,7 @@ public:
|
||||
const wxPalette *palette = NULL);
|
||||
|
||||
virtual bool Create(wxGDIImage *image,
|
||||
void *data,
|
||||
const void* data,
|
||||
long flags,
|
||||
int width, int height, int depth = 1);
|
||||
virtual bool Load(wxGDIImage *image,
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
|
||||
// real handler operations: to implement in derived classes
|
||||
virtual bool Create(wxGDIImage *image,
|
||||
void *data,
|
||||
const void* data,
|
||||
long flags,
|
||||
int width, int height, int depth = 1) = 0;
|
||||
virtual bool Load(wxGDIImage *image,
|
||||
|
@ -84,8 +84,7 @@ public:
|
||||
);
|
||||
|
||||
// Initialize with XPM data
|
||||
wxBitmap(const char** ppData) { CreateFromXpm(ppData); }
|
||||
wxBitmap(char** ppData) { CreateFromXpm((const char**)ppData); }
|
||||
wxBitmap(const char* const* bits);
|
||||
|
||||
// Load a resource
|
||||
wxBitmap( int nId
|
||||
@ -98,7 +97,7 @@ public:
|
||||
)
|
||||
{ Init(); }
|
||||
// New constructor for generalised creation from data
|
||||
wxBitmap( void* pData
|
||||
wxBitmap( const void* pData
|
||||
,long lType
|
||||
,int nWidth
|
||||
,int nHeight
|
||||
@ -146,7 +145,7 @@ public:
|
||||
,int nHeight
|
||||
,int nDepth = -1
|
||||
);
|
||||
virtual bool Create( void* pData
|
||||
virtual bool Create( const void* pData
|
||||
,long lType
|
||||
,int nWidth
|
||||
,int nHeight
|
||||
@ -213,8 +212,6 @@ protected:
|
||||
inline virtual wxGDIImageRefData* CreateData() const
|
||||
{ return new wxBitmapRefData; }
|
||||
|
||||
// creates the bitmap from XPM data, supposed to be called from ctor
|
||||
bool CreateFromXpm(const char** ppData);
|
||||
bool CreateFromImage(const wxImage& image, int depth);
|
||||
|
||||
private:
|
||||
@ -296,7 +293,7 @@ public:
|
||||
// keep wxBitmapHandler derived from wxGDIImageHandler compatible with the
|
||||
// old class which worked only with bitmaps
|
||||
virtual bool Create( wxBitmap* pBitmap
|
||||
,void* pData
|
||||
,const void* pData
|
||||
,long lFlags
|
||||
,int nWidth
|
||||
,int nHeight
|
||||
@ -321,7 +318,7 @@ public:
|
||||
);
|
||||
|
||||
virtual bool Create( wxGDIImage* pImage
|
||||
,void* pData
|
||||
,const void* pData
|
||||
,long lFlags
|
||||
,int nWidth
|
||||
,int nHeight
|
||||
|
@ -45,14 +45,13 @@ public:
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
|
||||
// Initialize with XPM data
|
||||
wxBitmap(const char **data) { CreateFromXpm(data); }
|
||||
wxBitmap(char **data) { CreateFromXpm((const char **)data); }
|
||||
wxBitmap(const char* const* data);
|
||||
|
||||
// Load a file or resource
|
||||
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE);
|
||||
|
||||
// New constructor for generalised creation from data
|
||||
wxBitmap(void *data, long type, int width, int height, int depth = 1);
|
||||
wxBitmap(const void* data, long 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)
|
||||
@ -114,7 +113,7 @@ public:
|
||||
|
||||
virtual bool Create(int width, int height, int depth = -1);
|
||||
virtual bool Create(int width, int height, const wxDC& dc);
|
||||
virtual bool Create(void *data, long type, int width, int height, int depth = 1);
|
||||
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);
|
||||
|
||||
@ -159,9 +158,6 @@ protected:
|
||||
|
||||
virtual wxGDIImageRefData *CreateData() const;
|
||||
|
||||
// creates the bitmap from XPM data, supposed to be called from ctor
|
||||
bool CreateFromXpm(const char **bits);
|
||||
|
||||
// creates an uninitialized bitmap, called from Create()s above
|
||||
bool DoCreate(int w, int h, int depth, WXHDC hdc);
|
||||
|
||||
@ -235,7 +231,7 @@ public:
|
||||
// keep wxBitmapHandler derived from wxGDIImageHandler compatible with the
|
||||
// old class which worked only with bitmaps
|
||||
virtual bool Create(wxBitmap *bitmap,
|
||||
void *data,
|
||||
const void* data,
|
||||
long flags,
|
||||
int width, int height, int depth = 1);
|
||||
virtual bool LoadFile(wxBitmap *bitmap,
|
||||
@ -248,7 +244,7 @@ public:
|
||||
const wxPalette *palette = NULL);
|
||||
|
||||
virtual bool Create(wxGDIImage *image,
|
||||
void *data,
|
||||
const void* data,
|
||||
long flags,
|
||||
int width, int height, int depth = 1);
|
||||
virtual bool Load(wxGDIImage *image,
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
|
||||
// real handler operations: to implement in derived classes
|
||||
virtual bool Create(wxGDIImage *image,
|
||||
void *data,
|
||||
const void* data,
|
||||
long flags,
|
||||
int width, int height, int depth = 1) = 0;
|
||||
virtual bool Load(wxGDIImage *image,
|
||||
|
@ -62,12 +62,9 @@ private:
|
||||
// wxBitmap
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxBitmapHandler : public wxBitmapHandlerBase
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
|
||||
{
|
||||
public:
|
||||
wxBitmapHandler() : wxBitmapHandlerBase() {}
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
|
||||
@ -76,8 +73,7 @@ public:
|
||||
wxBitmap();
|
||||
wxBitmap( int width, int height, int depth = -1 );
|
||||
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
||||
wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
|
||||
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
||||
wxBitmap( const char* const* bits );
|
||||
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
|
||||
virtual ~wxBitmap();
|
||||
|
||||
@ -88,7 +84,7 @@ public:
|
||||
static void InitStandardHandlers();
|
||||
|
||||
bool Create(int width, int height, int depth = -1);
|
||||
bool Create(void* data, wxBitmapType type,
|
||||
bool Create(const void* data, wxBitmapType type,
|
||||
int width, int height, int depth = -1);
|
||||
// create the wxBitmap using a _copy_ of the pixmap
|
||||
bool Create(WXPixmap pixmap);
|
||||
@ -135,9 +131,6 @@ public:
|
||||
|
||||
WXDisplay *GetDisplay() const;
|
||||
|
||||
protected:
|
||||
bool CreateFromXpm(const char **bits);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||
};
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
wxImage ReadFile(wxInputStream& stream);
|
||||
#endif
|
||||
// Read directly from XPM data (as passed to wxBitmap ctor):
|
||||
wxImage ReadData(const char **xpm_data);
|
||||
wxImage ReadData(const char* const* xpm_data);
|
||||
};
|
||||
|
||||
#endif // wxUSE_IMAGE && wxUSE_XPM
|
||||
|
@ -33,6 +33,8 @@
|
||||
#import <AppKit/NSImage.h>
|
||||
#import <AppKit/NSColor.h>
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
|
||||
|
||||
// ========================================================================
|
||||
// wxBitmapRefData
|
||||
// ========================================================================
|
||||
@ -123,7 +125,7 @@ wxBitmap::wxBitmap(int w, int h, int d)
|
||||
(void)Create(w, h, d);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(void *data, wxBitmapType 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);
|
||||
}
|
||||
@ -346,7 +348,7 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int depth)
|
||||
bool wxBitmap::Create(const void* data, wxBitmapType type, int width, int height, int depth)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
@ -413,24 +415,6 @@ wxImage wxBitmap::ConvertToImage() const
|
||||
return newImage;
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateFromXpm(const char **xpm)
|
||||
{
|
||||
#if wxUSE_IMAGE && wxUSE_XPM
|
||||
UnRef();
|
||||
|
||||
wxCHECK_MSG( xpm, false, wxT("invalid XPM data") );
|
||||
|
||||
wxXPMDecoder decoder;
|
||||
wxImage img = decoder.ReadData(xpm);
|
||||
wxCHECK_MSG( img.Ok(), false, wxT("invalid XPM data") );
|
||||
|
||||
*this = wxBitmap(img);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateFromImage(const wxImage& image, int depth)
|
||||
{
|
||||
UnRef();
|
||||
|
@ -126,6 +126,21 @@ 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)
|
||||
@ -139,6 +154,27 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule)
|
||||
|
||||
#endif // wxUSE_BITMAP_BASE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmap common
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if !(defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__))
|
||||
|
||||
wxBitmap::wxBitmap(const char* const* bits)
|
||||
{
|
||||
wxCHECK2_MSG(bits != NULL, return, wxT("invalid bitmap data"));
|
||||
|
||||
#if wxUSE_IMAGE && wxUSE_XPM
|
||||
wxImage image(bits);
|
||||
wxCHECK2_MSG(image.Ok(), return, wxT("invalid bitmap data"));
|
||||
|
||||
*this = wxBitmap(image);
|
||||
#else
|
||||
wxFAIL_MSG(_T("creating bitmaps from XPMs not supported"));
|
||||
#endif // wxUSE_IMAGE && wxUSE_XPM
|
||||
}
|
||||
#endif // !(defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__))
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMaskBase
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -30,10 +30,7 @@
|
||||
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
#if wxUSE_XPM
|
||||
#include "wx/xpmdecod.h"
|
||||
#endif
|
||||
#include "wx/xpmdecod.h"
|
||||
|
||||
// For memcpy
|
||||
#include <string.h>
|
||||
@ -165,17 +162,12 @@ wxImage::wxImage( wxInputStream& stream, const wxString& mimetype, int index )
|
||||
}
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
wxImage::wxImage( const char** xpmData )
|
||||
wxImage::wxImage(const char* const* xpmData)
|
||||
{
|
||||
Create(xpmData);
|
||||
}
|
||||
|
||||
wxImage::wxImage( char** xpmData )
|
||||
{
|
||||
Create((const char**) xpmData);
|
||||
}
|
||||
|
||||
bool wxImage::Create( const char** xpmData )
|
||||
bool wxImage::Create(const char* const* xpmData)
|
||||
{
|
||||
#if wxUSE_XPM
|
||||
UnRef();
|
||||
|
@ -99,23 +99,20 @@ license is as follows:
|
||||
|
||||
#if wxUSE_IMAGE && wxUSE_XPM
|
||||
|
||||
#include "wx/xpmdecod.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/hashmap.h"
|
||||
#if wxUSE_STREAMS
|
||||
#include "wx/stream.h"
|
||||
#endif
|
||||
#include "wx/stream.h"
|
||||
#include "wx/image.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "wx/xpmdecod.h"
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
bool wxXPMDecoder::CanRead(wxInputStream& stream)
|
||||
{
|
||||
@ -659,7 +656,7 @@ struct wxXPMColourMapData
|
||||
};
|
||||
WX_DECLARE_STRING_HASH_MAP(wxXPMColourMapData, wxXPMColourMap);
|
||||
|
||||
wxImage wxXPMDecoder::ReadData(const char **xpm_data)
|
||||
wxImage wxXPMDecoder::ReadData(const char* const* xpm_data)
|
||||
{
|
||||
wxCHECK_MSG(xpm_data, wxNullImage, wxT("NULL XPM data") );
|
||||
|
||||
|
@ -24,9 +24,6 @@
|
||||
#include "wx/colour.h"
|
||||
#include "wx/image.h"
|
||||
|
||||
#warning "move this to common"
|
||||
#include "wx/xpmdecod.h"
|
||||
|
||||
#include "wx/dfb/private.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -102,7 +99,7 @@ public:
|
||||
// wxBitmap
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxBitmapBase)
|
||||
|
||||
wxBitmap::wxBitmap(int width, int height, int depth)
|
||||
@ -138,25 +135,6 @@ bool wxBitmap::Create(int width, int height, int depth)
|
||||
return Create(wxIDirectFB::Get()->CreateSurface(&desc));
|
||||
}
|
||||
|
||||
#warning "FIXME: move this to common code"
|
||||
bool wxBitmap::CreateFromXpm(const char **bits)
|
||||
{
|
||||
wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
|
||||
|
||||
#if wxUSE_IMAGE && wxUSE_XPM
|
||||
wxXPMDecoder decoder;
|
||||
wxImage img = decoder.ReadData(bits);
|
||||
wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") );
|
||||
|
||||
*this = wxBitmap(img);
|
||||
|
||||
return true;
|
||||
#else
|
||||
wxFAIL_MSG( _T("creating bitmaps from XPMs not supported") );
|
||||
return false;
|
||||
#endif // wxUSE_IMAGE && wxUSE_XPM
|
||||
}
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
wxBitmap::wxBitmap(const wxImage& image, int depth)
|
||||
{
|
||||
|
@ -250,6 +250,20 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const char* const* bits)
|
||||
{
|
||||
wxCHECK2_MSG(bits != NULL, return, wxT("invalid bitmap data"));
|
||||
|
||||
GdkBitmap* mask = NULL;
|
||||
SetPixmap(gdk_pixmap_create_from_xpm_d(wxGetRootWindow()->window, &mask, NULL, wx_const_cast(char**, bits)));
|
||||
|
||||
if (M_BMPDATA->m_pixmap != NULL && mask != NULL)
|
||||
{
|
||||
M_BMPDATA->m_mask = new wxMask;
|
||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap::~wxBitmap()
|
||||
{
|
||||
}
|
||||
@ -284,26 +298,6 @@ bool wxBitmap::Create( int width, int height, int depth )
|
||||
return Ok();
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateFromXpm(const char* const* bits)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
|
||||
|
||||
GdkBitmap *mask = (GdkBitmap*) NULL;
|
||||
SetPixmap(gdk_pixmap_create_from_xpm_d(wxGetRootWindow()->window, &mask, NULL, wx_const_cast(char**, bits)));
|
||||
|
||||
wxCHECK_MSG( M_BMPDATA->m_pixmap, false, wxT("couldn't create pixmap") );
|
||||
|
||||
if (mask)
|
||||
{
|
||||
M_BMPDATA->m_mask = new wxMask;
|
||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxBitmap wxBitmap::Rescale(int clipx, int clipy, int clipwidth, int clipheight, int newx, int newy) const
|
||||
{
|
||||
wxBitmap bmp;
|
||||
@ -1060,44 +1054,7 @@ void wxBitmap::UseAlpha()
|
||||
// wxBitmapHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler,wxBitmapHandlerBase)
|
||||
|
||||
wxBitmapHandler::~wxBitmapHandler()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::Create(wxBitmap * WXUNUSED(bitmap),
|
||||
void * WXUNUSED(data),
|
||||
long WXUNUSED(type),
|
||||
int WXUNUSED(width),
|
||||
int WXUNUSED(height),
|
||||
int WXUNUSED(depth))
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
|
||||
const wxString& WXUNUSED(name),
|
||||
long WXUNUSED(flags),
|
||||
int WXUNUSED(desiredWidth),
|
||||
int WXUNUSED(desiredHeight))
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::SaveFile(const wxBitmap * WXUNUSED(bitmap),
|
||||
const wxString& WXUNUSED(name),
|
||||
int WXUNUSED(type),
|
||||
const wxPalette * WXUNUSED(palette))
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
return false;
|
||||
}
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
|
||||
|
||||
/* static */ void wxBitmap::InitStandardHandlers()
|
||||
{
|
||||
|
@ -312,11 +312,9 @@ bool wxBitmap::Create( int width, int height, int depth )
|
||||
return Ok();
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateFromXpm( const char **bits )
|
||||
wxBitmap::wxBitmap(const char* const* bits)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
|
||||
wxCHECK2_MSG(bits != NULL, return, wxT("invalid bitmap data"));
|
||||
|
||||
GdkVisual *visual = wxTheApp->GetGdkVisual();
|
||||
|
||||
@ -326,7 +324,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
|
||||
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( wxGetRootWindow()->window, &mask, NULL, (gchar **) bits );
|
||||
|
||||
wxCHECK_MSG( M_BMPDATA->m_pixmap, false, wxT("couldn't create pixmap") );
|
||||
wxCHECK2_MSG(M_BMPDATA->m_pixmap, return, wxT("couldn't create pixmap"));
|
||||
|
||||
if (mask)
|
||||
{
|
||||
@ -337,8 +335,6 @@ bool wxBitmap::CreateFromXpm( const char **bits )
|
||||
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
||||
|
||||
M_BMPDATA->m_bpp = visual->depth; // Can we get a different depth from create_from_xpm_d() ?
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, int newx, int newy )
|
||||
@ -1320,7 +1316,6 @@ void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool wxBitmap::HasAlpha() const
|
||||
{
|
||||
return false;
|
||||
@ -1334,44 +1329,7 @@ void wxBitmap::UseAlpha()
|
||||
// wxBitmapHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler,wxBitmapHandlerBase)
|
||||
|
||||
wxBitmapHandler::~wxBitmapHandler()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::Create(wxBitmap * WXUNUSED(bitmap),
|
||||
void * WXUNUSED(data),
|
||||
long WXUNUSED(type),
|
||||
int WXUNUSED(width),
|
||||
int WXUNUSED(height),
|
||||
int WXUNUSED(depth))
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
|
||||
const wxString& WXUNUSED(name),
|
||||
long WXUNUSED(flags),
|
||||
int WXUNUSED(desiredWidth),
|
||||
int WXUNUSED(desiredHeight))
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::SaveFile(const wxBitmap * WXUNUSED(bitmap),
|
||||
const wxString& WXUNUSED(name),
|
||||
int WXUNUSED(type),
|
||||
const wxPalette * WXUNUSED(palette))
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
return false;
|
||||
}
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
|
||||
|
||||
/* static */ void wxBitmap::InitStandardHandlers()
|
||||
{
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
|
||||
|
||||
#ifdef __DARWIN__
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
@ -842,7 +841,7 @@ wxBitmap::wxBitmap(int w, int h, int d)
|
||||
(void)Create(w, h, d);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(void *data, wxBitmapType 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);
|
||||
}
|
||||
@ -852,16 +851,6 @@ wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type)
|
||||
LoadFile(filename, type);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const char **bits)
|
||||
{
|
||||
(void) CreateFromXpm(bits);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(char **bits)
|
||||
{
|
||||
(void) CreateFromXpm((const char **)bits);
|
||||
}
|
||||
|
||||
void * wxBitmap::GetRawAccess() const
|
||||
{
|
||||
wxCHECK_MSG( Ok() , NULL , wxT("invalid bitmap") ) ;
|
||||
@ -883,24 +872,6 @@ void wxBitmap::EndRawAccess()
|
||||
M_BITMAPDATA->EndRawAccess() ;
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateFromXpm(const char **bits)
|
||||
{
|
||||
#if wxUSE_IMAGE
|
||||
wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
|
||||
|
||||
wxXPMDecoder decoder;
|
||||
wxImage img = decoder.ReadData(bits);
|
||||
wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") );
|
||||
|
||||
*this = wxBitmap(img);
|
||||
|
||||
return true;
|
||||
#else
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __WXMAC_OSX__
|
||||
WXCGIMAGEREF wxBitmap::CGImageCreate() const
|
||||
{
|
||||
@ -1015,7 +986,7 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int depth)
|
||||
bool wxBitmap::Create(const void* data, wxBitmapType type, int width, int height, int depth)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
@ -1536,25 +1507,7 @@ WXHBITMAP wxMask::GetHBITMAP() const
|
||||
// wxBitmapHandler
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBitmapHandler::~wxBitmapHandler()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||
int desiredWidth, int desiredHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Standard Handlers
|
||||
|
@ -91,7 +91,7 @@ wxBitmapRefData::~wxBitmapRefData()
|
||||
#define M_BMPDATA ((wxBitmapRefData *)m_refData)
|
||||
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler,wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase)
|
||||
|
||||
wxBitmap::wxBitmap(int width, int height, int depth)
|
||||
@ -171,19 +171,6 @@ bool wxBitmap::Create(int width, int height, int depth)
|
||||
return Ok();
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateFromXpm(const char **bits)
|
||||
{
|
||||
wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
|
||||
|
||||
wxXPMDecoder decoder;
|
||||
wxImage img = decoder.ReadData(bits);
|
||||
wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") );
|
||||
|
||||
*this = wxBitmap(img);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const wxImage& image, int depth)
|
||||
{
|
||||
long width, height;
|
||||
@ -559,7 +546,7 @@ public:
|
||||
const wxString& extension, const wxString& name);
|
||||
|
||||
virtual bool Create(wxBitmap *WXUNUSED(bitmap),
|
||||
void *WXUNUSED(data),
|
||||
const void* WXUNUSED(data),
|
||||
long WXUNUSED(flags),
|
||||
int WXUNUSED(width),
|
||||
int WXUNUSED(height),
|
||||
@ -777,7 +764,7 @@ class wxICOBitmapHandler: public wxBitmapHandler
|
||||
const wxString& extension, const wxString& name);
|
||||
|
||||
virtual bool Create(wxBitmap *WXUNUSED(bitmap),
|
||||
void *WXUNUSED(data),
|
||||
const void* WXUNUSED(data),
|
||||
long WXUNUSED(flags),
|
||||
int WXUNUSED(width),
|
||||
int WXUNUSED(height),
|
||||
|
@ -473,24 +473,6 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Create from XPM data
|
||||
bool wxBitmap::CreateFromXpm(const char **data)
|
||||
{
|
||||
#if wxUSE_IMAGE && wxUSE_XPM && wxUSE_WXDIB
|
||||
wxCHECK_MSG( data != NULL, false, wxT("invalid bitmap data") );
|
||||
|
||||
wxXPMDecoder decoder;
|
||||
wxImage img = decoder.ReadData(data);
|
||||
wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") );
|
||||
|
||||
*this = wxBitmap(img);
|
||||
return true;
|
||||
#else
|
||||
wxUnusedVar(data);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(int w, int h, int d)
|
||||
{
|
||||
(void)Create(w, h, d);
|
||||
@ -501,7 +483,7 @@ wxBitmap::wxBitmap(int w, int h, const wxDC& dc)
|
||||
(void)Create(w, h, dc);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth)
|
||||
wxBitmap::wxBitmap(const void* data, long type, int width, int height, int depth)
|
||||
{
|
||||
(void)Create(data, type, width, height, depth);
|
||||
}
|
||||
@ -1026,7 +1008,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
|
||||
bool wxBitmap::Create(const void* data, long type, int width, int height, int depth)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
@ -1512,13 +1494,13 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxBitmapHandler::Create(wxGDIImage *image,
|
||||
void *data,
|
||||
const void* data,
|
||||
long flags,
|
||||
int width, int height, int depth)
|
||||
{
|
||||
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
|
||||
|
||||
return bitmap ? Create(bitmap, data, flags, width, height, depth) : false;
|
||||
return bitmap && Create(bitmap, data, flags, width, height, depth);
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::Load(wxGDIImage *image,
|
||||
@ -1528,7 +1510,7 @@ bool wxBitmapHandler::Load(wxGDIImage *image,
|
||||
{
|
||||
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
|
||||
|
||||
return bitmap ? LoadFile(bitmap, name, flags, width, height) : false;
|
||||
return bitmap && LoadFile(bitmap, name, flags, width, height);
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::Save(wxGDIImage *image,
|
||||
@ -1537,34 +1519,7 @@ bool wxBitmapHandler::Save(wxGDIImage *image,
|
||||
{
|
||||
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
|
||||
|
||||
return bitmap ? SaveFile(bitmap, name, type) : false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap),
|
||||
void *WXUNUSED(data),
|
||||
long WXUNUSED(type),
|
||||
int WXUNUSED(width),
|
||||
int WXUNUSED(height),
|
||||
int WXUNUSED(depth))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap),
|
||||
const wxString& WXUNUSED(name),
|
||||
long WXUNUSED(type),
|
||||
int WXUNUSED(desiredWidth),
|
||||
int WXUNUSED(desiredHeight))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap),
|
||||
const wxString& WXUNUSED(name),
|
||||
int WXUNUSED(type),
|
||||
const wxPalette *WXUNUSED(palette))
|
||||
{
|
||||
return false;
|
||||
return bitmap && SaveFile(bitmap, name, type);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
|
||||
// creating and saving icons is not supported
|
||||
virtual bool Create(wxGDIImage *WXUNUSED(image),
|
||||
void *WXUNUSED(data),
|
||||
const void* WXUNUSED(data),
|
||||
long WXUNUSED(flags),
|
||||
int WXUNUSED(width),
|
||||
int WXUNUSED(height),
|
||||
|
@ -271,7 +271,7 @@ wxBitmap::wxBitmap(
|
||||
} // end of wxBitmap::wxBitmap
|
||||
|
||||
wxBitmap::wxBitmap(
|
||||
void* pData
|
||||
const void* pData
|
||||
, long lType
|
||||
, int nWidth
|
||||
, int nHeight
|
||||
@ -380,27 +380,6 @@ bool wxBitmap::Create(
|
||||
return Ok();
|
||||
} // end of wxBitmap::Create
|
||||
|
||||
bool wxBitmap::CreateFromXpm(
|
||||
const char** ppData
|
||||
)
|
||||
{
|
||||
#if wxUSE_IMAGE && wxUSE_XPM
|
||||
Init();
|
||||
|
||||
wxCHECK_MSG(ppData != NULL, false, wxT("invalid bitmap data"));
|
||||
|
||||
wxXPMDecoder vDecoder;
|
||||
wxImage vImg = vDecoder.ReadData(ppData);
|
||||
|
||||
wxCHECK_MSG(vImg.Ok(), false, wxT("invalid bitmap data"));
|
||||
|
||||
*this = wxBitmap(vImg);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
} // end of wxBitmap::CreateFromXpm
|
||||
|
||||
bool wxBitmap::LoadFile(const wxString& filename, long type)
|
||||
{
|
||||
UnRef();
|
||||
@ -458,7 +437,7 @@ bool wxBitmap::LoadFile(
|
||||
} // end of wxBitmap::LoadFile
|
||||
|
||||
bool wxBitmap::Create(
|
||||
void* pData
|
||||
const void* pData
|
||||
, long lType
|
||||
, int nWidth
|
||||
, int nHeight
|
||||
@ -1450,7 +1429,7 @@ bool wxMask::Create(
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxBitmapHandler::Create( wxGDIImage* pImage,
|
||||
void* pData,
|
||||
const void* pData,
|
||||
long WXUNUSED(lFlags),
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
@ -1506,7 +1485,7 @@ bool wxBitmapHandler::Save(
|
||||
|
||||
bool wxBitmapHandler::Create(
|
||||
wxBitmap* WXUNUSED(pBitmap)
|
||||
, void* WXUNUSED(pData)
|
||||
, const void* WXUNUSED(pData)
|
||||
, long WXUNUSED(lType)
|
||||
, int WXUNUSED(nWidth)
|
||||
, int WXUNUSED(nHeight)
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
|
||||
// creating and saving icons is not supported
|
||||
virtual bool Create( wxGDIImage* WXUNUSED(pImage)
|
||||
,void* WXUNUSED(pData)
|
||||
,const void* WXUNUSED(pData)
|
||||
,long WXUNUSED(lFlags)
|
||||
,int WXUNUSED(nWidth)
|
||||
,int WXUNUSED(nHeight)
|
||||
|
@ -211,16 +211,6 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
|
||||
Init();
|
||||
}
|
||||
|
||||
// Create from XPM data
|
||||
#if wxUSE_IMAGE && wxUSE_XPM
|
||||
bool wxBitmap::CreateFromXpm(const char **data)
|
||||
#else
|
||||
bool wxBitmap::CreateFromXpm(const char **WXUNUSED(data))
|
||||
#endif
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(int w, int h, int d)
|
||||
{
|
||||
}
|
||||
@ -229,7 +219,7 @@ wxBitmap::wxBitmap(int w, int h, const wxDC& dc)
|
||||
{
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth)
|
||||
wxBitmap::wxBitmap(const void* data, long type, int width, int height, int depth)
|
||||
{
|
||||
}
|
||||
|
||||
@ -294,7 +284,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
|
||||
bool wxBitmap::Create(const void* data, long type, int width, int height, int depth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -445,7 +435,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxBitmapHandler::Create(wxGDIImage *image,
|
||||
void *data,
|
||||
const void* data,
|
||||
long flags,
|
||||
int width, int height, int depth)
|
||||
{
|
||||
@ -468,7 +458,7 @@ bool wxBitmapHandler::Save(wxGDIImage *image,
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap),
|
||||
void *WXUNUSED(data),
|
||||
const void* WXUNUSED(data),
|
||||
long WXUNUSED(type),
|
||||
int WXUNUSED(width),
|
||||
int WXUNUSED(height),
|
||||
|
@ -360,7 +360,7 @@ bool wxBitmap::Create( int width, int height, int depth )
|
||||
return Ok();
|
||||
}
|
||||
|
||||
bool wxBitmap::Create(void *data, wxBitmapType type,
|
||||
bool wxBitmap::Create(const void* data, wxBitmapType type,
|
||||
int width, int height, int depth)
|
||||
{
|
||||
UnRef();
|
||||
@ -417,11 +417,9 @@ bool wxBitmap::Create(WXPixmap pixmap)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateFromXpm( const char **bits )
|
||||
wxBitmap::wxBitmap(const char* const* bits)
|
||||
{
|
||||
wxCHECK_MSG( bits, false, wxT("NULL pointer in wxBitmap::CreateFromXpm") );
|
||||
|
||||
return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
|
||||
Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
|
||||
}
|
||||
|
||||
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
|
||||
@ -912,7 +910,7 @@ wxBitmap::wxBitmap( const char bits[], int width, int height, int depth )
|
||||
{
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
(void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, depth);
|
||||
(void) Create(bits, wxBITMAP_TYPE_XBM_DATA, width, height, depth);
|
||||
}
|
||||
|
||||
wxBitmap::~wxBitmap()
|
||||
@ -1320,7 +1318,7 @@ public:
|
||||
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
|
||||
int type, const wxPalette *palette = NULL);
|
||||
|
||||
virtual bool Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(flags),
|
||||
virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data), long WXUNUSED(flags),
|
||||
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth) = 1)
|
||||
{ return false; }
|
||||
};
|
||||
@ -1435,13 +1433,13 @@ public:
|
||||
const wxPalette *WXUNUSED(palette) = NULL)
|
||||
{ return false; }
|
||||
|
||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
|
||||
virtual bool Create(wxBitmap *bitmap, const void* data, long flags,
|
||||
int width, int height, int depth = 1);
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
|
||||
|
||||
bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *bits,
|
||||
bool wxXPMDataHandler::Create(wxBitmap *bitmap, const void* bits,
|
||||
long WXUNUSED(flags),
|
||||
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth))
|
||||
{
|
||||
@ -1541,13 +1539,13 @@ public:
|
||||
const wxPalette *WXUNUSED(palette) = NULL)
|
||||
{ return false; }
|
||||
|
||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
|
||||
virtual bool Create(wxBitmap *bitmap, const void* data, long flags,
|
||||
int width, int height, int depth = 1);
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxXBMDataHandler, wxBitmapHandler)
|
||||
|
||||
bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *bits,
|
||||
bool wxXBMDataHandler::Create( wxBitmap *bitmap, const void* bits,
|
||||
long WXUNUSED(flags),
|
||||
int width, int height, int WXUNUSED(depth))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user