Update for bitmap, image on scaling, transparancy,

wxCHECKs and no more dependance of wxBitmap on wxImage
  in its API


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-12-06 17:33:01 +00:00
parent c19a8a9a71
commit 4bc67cc550
28 changed files with 1254 additions and 1055 deletions

View File

@@ -19,7 +19,6 @@
#include "wx/object.h"
#include "wx/string.h"
#include "wx/palette.h"
#include "wx/image.h"
//-----------------------------------------------------------------------------
// classes
@@ -28,6 +27,18 @@
class wxMask;
class wxBitmap;
//-----------------------------------------------------------------------------
// also implemented here from wxImage
//-----------------------------------------------------------------------------
/*
class wxImage : wxGDIObject
{
wxImage( const wxBitmap &bitmap );
wxBitmap ConvertToBitmap() const;
}
*/
//-----------------------------------------------------------------------------
// wxMask
//-----------------------------------------------------------------------------
@@ -61,7 +72,6 @@ public:
wxBitmap();
wxBitmap( int width, int height, int depth = -1 );
wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const wxImage &image );
wxBitmap( const char **bits );
wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp );
@@ -73,14 +83,9 @@ public:
bool operator != ( const wxBitmap& bmp );
bool Ok() const;
wxImage ConvertToImage() const;
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
void SetHeight( int height );
void SetWidth( int width );
void SetDepth( int depth );
wxMask *GetMask() const;
void SetMask( wxMask *mask );
@@ -94,6 +99,11 @@ public:
// implementation
void SetHeight( int height );
void SetWidth( int width );
void SetDepth( int depth );
void SetPixmap( GdkPixmap *pixmap );
GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const;

View File

@@ -59,13 +59,13 @@ class wxDC: public wxObject
public:
wxDC(void);
~wxDC(void);
wxDC();
~wxDC();
void BeginDrawing(void) {};
void EndDrawing(void) {};
virtual void BeginDrawing() {}
virtual void EndDrawing() {}
virtual bool Ok(void) const;
virtual bool Ok() const;
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0;
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
@@ -186,30 +186,30 @@ public:
virtual long GetCharWidth(void) = 0;
virtual long GetCharHeight(void) = 0;
virtual void Clear(void) = 0;
virtual void Clear() = 0;
virtual void SetFont( const wxFont &font ) = 0;
virtual wxFont *GetFont(void) { return &m_font; };
virtual wxFont *GetFont() { return &m_font; };
virtual void SetPen( const wxPen &pen ) = 0;
virtual wxPen *GetPen(void) { return &m_pen; };
virtual wxPen *GetPen() { return &m_pen; };
virtual void SetBrush( const wxBrush &brush ) = 0;
virtual wxBrush *GetBrush(void) { return &m_brush; };
virtual wxBrush *GetBrush() { return &m_brush; };
virtual void SetBackground( const wxBrush &brush ) = 0;
virtual wxBrush *GetBackground(void) { return &m_backgroundBrush; };
virtual wxBrush *GetBackground() { return &m_backgroundBrush; };
virtual void SetLogicalFunction( int function ) = 0;
virtual int GetLogicalFunction(void) { return m_logicalFunction; };
virtual int GetLogicalFunction() { return m_logicalFunction; };
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
virtual wxColour& GetTextBackground(void) const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground(void) const { return (wxColour&)m_textForegroundColour; };
virtual wxColour& GetTextBackground() const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground() const { return (wxColour&)m_textForegroundColour; };
virtual void SetBackgroundMode( int mode ) = 0;
virtual int GetBackgroundMode(void) { return m_backgroundMode; };
virtual int GetBackgroundMode() { return m_backgroundMode; };
virtual void SetPalette( const wxPalette& palette ) = 0;
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
@@ -220,19 +220,19 @@ public:
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
virtual void SetClippingRegion( const wxRegion &region ) = 0;
virtual inline long MinX(void) const { return m_minX; }
virtual inline long MaxX(void) const { return m_maxX; }
virtual inline long MinY(void) const { return m_minY; }
virtual inline long MaxY(void) const { return m_maxY; }
virtual long MinX() const { return m_minX; }
virtual long MaxX() const { return m_maxX; }
virtual long MinY() const { return m_minY; }
virtual long MaxY() const { return m_maxY; }
virtual void GetSize( int* width, int* height ) const;
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
virtual void GetSizeMM( long* width, long* height ) const;
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; };
virtual void EndDoc(void) {};
virtual void StartPage(void) {};
virtual void EndPage(void) {};
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
virtual void EndDoc() {}
virtual void StartPage() {}
virtual void EndPage() {}
virtual void SetMapMode( int mode );
virtual int GetMapMode(void) const { return m_mappingMode; };
@@ -249,8 +249,8 @@ public:
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
virtual void SetOptimization( bool WXUNUSED(optimize) ) {};
virtual bool GetOptimization(void) { return m_optimize; };
virtual void SetOptimization( bool WXUNUSED(optimize) ) {}
virtual bool GetOptimization() { return m_optimize; }
virtual long DeviceToLogicalX(long x) const;
virtual long DeviceToLogicalY(long y) const;
@@ -264,7 +264,7 @@ public:
// implementation
void CalcBoundingBox( long x, long y );
void ComputeScaleAndOrigin(void);
void ComputeScaleAndOrigin();
long XDEV2LOG(long x) const
{

View File

@@ -35,10 +35,10 @@ class wxWindowDC: public wxDC
DECLARE_DYNAMIC_CLASS(wxWindowDC)
public:
wxWindowDC(void);
wxWindowDC();
wxWindowDC( wxWindow *win );
~wxWindowDC(void);
~wxWindowDC();
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
@@ -60,21 +60,21 @@ public:
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
virtual void DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap(void) const;
virtual bool CanDrawBitmap() const;
virtual void DrawIcon( const wxIcon &icon, long x, long y );
virtual void DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask=FALSE );
virtual bool Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
virtual bool CanGetTextExtent(void) const;
virtual bool CanGetTextExtent() const;
virtual void GetTextExtent( const wxString &string, long *width, long *height,
long *descent = (long *) NULL, long *externalLeading = (long *) NULL,
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE );
virtual long GetCharWidth(void);
virtual long GetCharHeight(void);
virtual long GetCharWidth();
virtual long GetCharHeight();
virtual void Clear(void);
virtual void Clear();
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
@@ -87,7 +87,7 @@ public:
virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DestroyClippingRegion();
virtual void SetClippingRegion( const wxRegion &region );
virtual void DrawSpline( wxList *points );
@@ -102,9 +102,9 @@ public:
GdkColormap *m_cmap;
bool m_isMemDC;
void SetUpDC(void);
void Destroy(void);
GdkWindow *GetWindow(void);
void SetUpDC();
void Destroy();
GdkWindow *GetWindow();
};
//-----------------------------------------------------------------------------
@@ -116,7 +116,7 @@ class wxPaintDC : public wxWindowDC
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
wxPaintDC(void);
wxPaintDC();
wxPaintDC( wxWindow *win );
};
@@ -129,7 +129,7 @@ class wxClientDC : public wxWindowDC
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
wxClientDC(void);
wxClientDC();
wxClientDC( wxWindow *win );
};

View File

@@ -33,9 +33,9 @@ class wxMemoryDC: public wxWindowDC
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
public:
wxMemoryDC(void);
wxMemoryDC();
wxMemoryDC( wxDC *dc ); // Create compatible DC
~wxMemoryDC(void);
~wxMemoryDC();
virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const;

View File

@@ -45,10 +45,12 @@ public:
bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
virtual bool Ok() const;
virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL);
inline virtual void BeginDrawing(void) {} ;
inline virtual void EndDrawing(void) {} ;
virtual void BeginDrawing() {}
virtual void EndDrawing() {}
void FloodFill(long x1, long y1, const wxColour &col, int style=wxFLOOD_SURFACE) ;
bool GetPixel(long x1, long y1, wxColour *col) const;
@@ -81,7 +83,6 @@ public:
void DrawIcon( const wxIcon& icon, long x, long y );
void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE );
void DrawText(const wxString& text, long x, long y, bool use16 = FALSE);
void Clear();
@@ -114,7 +115,7 @@ public:
void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
void SetDeviceOrigin( long x, long y );
inline void SetBackgroundMode(int WXUNUSED(mode)) {};
inline void SetBackgroundMode(int WXUNUSED(mode)) {}
inline void SetPalette(const wxPalette& WXUNUSED(palette)) {}
inline ofstream *GetStream(void) const { return m_pstream; }

View File

@@ -19,7 +19,6 @@
#include "wx/object.h"
#include "wx/string.h"
#include "wx/palette.h"
#include "wx/image.h"
//-----------------------------------------------------------------------------
// classes
@@ -28,6 +27,18 @@
class wxMask;
class wxBitmap;
//-----------------------------------------------------------------------------
// also implemented here from wxImage
//-----------------------------------------------------------------------------
/*
class wxImage : wxGDIObject
{
wxImage( const wxBitmap &bitmap );
wxBitmap ConvertToBitmap() const;
}
*/
//-----------------------------------------------------------------------------
// wxMask
//-----------------------------------------------------------------------------
@@ -61,7 +72,6 @@ public:
wxBitmap();
wxBitmap( int width, int height, int depth = -1 );
wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const wxImage &image );
wxBitmap( const char **bits );
wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp );
@@ -73,14 +83,9 @@ public:
bool operator != ( const wxBitmap& bmp );
bool Ok() const;
wxImage ConvertToImage() const;
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
void SetHeight( int height );
void SetWidth( int width );
void SetDepth( int depth );
wxMask *GetMask() const;
void SetMask( wxMask *mask );
@@ -94,6 +99,11 @@ public:
// implementation
void SetHeight( int height );
void SetWidth( int width );
void SetDepth( int depth );
void SetPixmap( GdkPixmap *pixmap );
GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const;

View File

@@ -59,13 +59,13 @@ class wxDC: public wxObject
public:
wxDC(void);
~wxDC(void);
wxDC();
~wxDC();
void BeginDrawing(void) {};
void EndDrawing(void) {};
virtual void BeginDrawing() {}
virtual void EndDrawing() {}
virtual bool Ok(void) const;
virtual bool Ok() const;
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0;
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
@@ -186,30 +186,30 @@ public:
virtual long GetCharWidth(void) = 0;
virtual long GetCharHeight(void) = 0;
virtual void Clear(void) = 0;
virtual void Clear() = 0;
virtual void SetFont( const wxFont &font ) = 0;
virtual wxFont *GetFont(void) { return &m_font; };
virtual wxFont *GetFont() { return &m_font; };
virtual void SetPen( const wxPen &pen ) = 0;
virtual wxPen *GetPen(void) { return &m_pen; };
virtual wxPen *GetPen() { return &m_pen; };
virtual void SetBrush( const wxBrush &brush ) = 0;
virtual wxBrush *GetBrush(void) { return &m_brush; };
virtual wxBrush *GetBrush() { return &m_brush; };
virtual void SetBackground( const wxBrush &brush ) = 0;
virtual wxBrush *GetBackground(void) { return &m_backgroundBrush; };
virtual wxBrush *GetBackground() { return &m_backgroundBrush; };
virtual void SetLogicalFunction( int function ) = 0;
virtual int GetLogicalFunction(void) { return m_logicalFunction; };
virtual int GetLogicalFunction() { return m_logicalFunction; };
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
virtual wxColour& GetTextBackground(void) const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground(void) const { return (wxColour&)m_textForegroundColour; };
virtual wxColour& GetTextBackground() const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground() const { return (wxColour&)m_textForegroundColour; };
virtual void SetBackgroundMode( int mode ) = 0;
virtual int GetBackgroundMode(void) { return m_backgroundMode; };
virtual int GetBackgroundMode() { return m_backgroundMode; };
virtual void SetPalette( const wxPalette& palette ) = 0;
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
@@ -220,19 +220,19 @@ public:
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
virtual void SetClippingRegion( const wxRegion &region ) = 0;
virtual inline long MinX(void) const { return m_minX; }
virtual inline long MaxX(void) const { return m_maxX; }
virtual inline long MinY(void) const { return m_minY; }
virtual inline long MaxY(void) const { return m_maxY; }
virtual long MinX() const { return m_minX; }
virtual long MaxX() const { return m_maxX; }
virtual long MinY() const { return m_minY; }
virtual long MaxY() const { return m_maxY; }
virtual void GetSize( int* width, int* height ) const;
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
virtual void GetSizeMM( long* width, long* height ) const;
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; };
virtual void EndDoc(void) {};
virtual void StartPage(void) {};
virtual void EndPage(void) {};
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
virtual void EndDoc() {}
virtual void StartPage() {}
virtual void EndPage() {}
virtual void SetMapMode( int mode );
virtual int GetMapMode(void) const { return m_mappingMode; };
@@ -249,8 +249,8 @@ public:
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
virtual void SetOptimization( bool WXUNUSED(optimize) ) {};
virtual bool GetOptimization(void) { return m_optimize; };
virtual void SetOptimization( bool WXUNUSED(optimize) ) {}
virtual bool GetOptimization() { return m_optimize; }
virtual long DeviceToLogicalX(long x) const;
virtual long DeviceToLogicalY(long y) const;
@@ -264,7 +264,7 @@ public:
// implementation
void CalcBoundingBox( long x, long y );
void ComputeScaleAndOrigin(void);
void ComputeScaleAndOrigin();
long XDEV2LOG(long x) const
{

View File

@@ -35,10 +35,10 @@ class wxWindowDC: public wxDC
DECLARE_DYNAMIC_CLASS(wxWindowDC)
public:
wxWindowDC(void);
wxWindowDC();
wxWindowDC( wxWindow *win );
~wxWindowDC(void);
~wxWindowDC();
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
@@ -60,21 +60,21 @@ public:
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
virtual void DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap(void) const;
virtual bool CanDrawBitmap() const;
virtual void DrawIcon( const wxIcon &icon, long x, long y );
virtual void DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask=FALSE );
virtual bool Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
virtual bool CanGetTextExtent(void) const;
virtual bool CanGetTextExtent() const;
virtual void GetTextExtent( const wxString &string, long *width, long *height,
long *descent = (long *) NULL, long *externalLeading = (long *) NULL,
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE );
virtual long GetCharWidth(void);
virtual long GetCharHeight(void);
virtual long GetCharWidth();
virtual long GetCharHeight();
virtual void Clear(void);
virtual void Clear();
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
@@ -87,7 +87,7 @@ public:
virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DestroyClippingRegion();
virtual void SetClippingRegion( const wxRegion &region );
virtual void DrawSpline( wxList *points );
@@ -102,9 +102,9 @@ public:
GdkColormap *m_cmap;
bool m_isMemDC;
void SetUpDC(void);
void Destroy(void);
GdkWindow *GetWindow(void);
void SetUpDC();
void Destroy();
GdkWindow *GetWindow();
};
//-----------------------------------------------------------------------------
@@ -116,7 +116,7 @@ class wxPaintDC : public wxWindowDC
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
wxPaintDC(void);
wxPaintDC();
wxPaintDC( wxWindow *win );
};
@@ -129,7 +129,7 @@ class wxClientDC : public wxWindowDC
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
wxClientDC(void);
wxClientDC();
wxClientDC( wxWindow *win );
};

View File

@@ -33,9 +33,9 @@ class wxMemoryDC: public wxWindowDC
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
public:
wxMemoryDC(void);
wxMemoryDC();
wxMemoryDC( wxDC *dc ); // Create compatible DC
~wxMemoryDC(void);
~wxMemoryDC();
virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const;

View File

@@ -45,10 +45,12 @@ public:
bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
virtual bool Ok() const;
virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL);
inline virtual void BeginDrawing(void) {} ;
inline virtual void EndDrawing(void) {} ;
virtual void BeginDrawing() {}
virtual void EndDrawing() {}
void FloodFill(long x1, long y1, const wxColour &col, int style=wxFLOOD_SURFACE) ;
bool GetPixel(long x1, long y1, wxColour *col) const;
@@ -81,7 +83,6 @@ public:
void DrawIcon( const wxIcon& icon, long x, long y );
void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE );
void DrawText(const wxString& text, long x, long y, bool use16 = FALSE);
void Clear();
@@ -114,7 +115,7 @@ public:
void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
void SetDeviceOrigin( long x, long y );
inline void SetBackgroundMode(int WXUNUSED(mode)) {};
inline void SetBackgroundMode(int WXUNUSED(mode)) {}
inline void SetPalette(const wxPalette& WXUNUSED(palette)) {}
inline ofstream *GetStream(void) const { return m_pstream; }

View File

@@ -28,6 +28,8 @@ class WXDLLEXPORT wxPNGHandler;
class WXDLLEXPORT wxBMPHandler;
class WXDLLEXPORT wxImage;
class WXDLLEXPORT wxBitmap;
//-----------------------------------------------------------------------------
// wxImageHandler
//-----------------------------------------------------------------------------
@@ -115,10 +117,16 @@ public:
wxImage( const wxImage& image );
wxImage( const wxImage* image );
// these functions get implemented in /src/(platform)/bitmap.cpp
wxImage( const wxBitmap &bitmap );
wxBitmap ConvertToBitmap() const;
void Create( int width, int height );
void Destroy();
wxImage Scale( int width, int height );
virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_PNG );
virtual bool SaveFile( const wxString& name, int type );