Add wxBitmap::SetScaleFactor()
We need to be able to change the scale factor of the bitmaps returned by wxBitmapBundle::GetBitmap(), so add a function allowing to do this. Also add wxHAS_BITMAP_SCALE_FACTOR allowing to check whether this function actually does something non-trivial and explain in the docs that GetScaleFactor() always returns 1 on the platforms where this symbol is not defined.
This commit is contained in:
@@ -188,6 +188,7 @@ public:
|
||||
{ return wxSize(GetWidth(), GetHeight()); }
|
||||
|
||||
// support for scaled bitmaps
|
||||
virtual void SetScaleFactor(double WXUNUSED(scale)) { }
|
||||
virtual double GetScaleFactor() const { return 1.0; }
|
||||
virtual double GetScaledWidth() const { return GetWidth() / GetScaleFactor(); }
|
||||
virtual double GetScaledHeight() const { return GetHeight() / GetScaleFactor(); }
|
||||
|
@@ -17,6 +17,10 @@ typedef struct _GdkPixbuf GdkPixbuf;
|
||||
class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
|
||||
class WXDLLIMPEXP_FWD_CORE wxCursor;
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
#define wxHAS_BITMAP_SCALE_FACTOR
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMask
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -85,8 +89,9 @@ public:
|
||||
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
|
||||
bool Create(int width, int height, const wxDC& WXUNUSED(dc))
|
||||
{ return Create(width,height); }
|
||||
#ifdef __WXGTK3__
|
||||
#ifdef wxHAS_BITMAP_SCALE_FACTOR
|
||||
virtual bool CreateScaled(int w, int h, int depth, double scale) wxOVERRIDE;
|
||||
virtual void SetScaleFactor(double scale) wxOVERRIDE;
|
||||
virtual double GetScaleFactor() const wxOVERRIDE;
|
||||
#endif
|
||||
|
||||
|
@@ -186,6 +186,7 @@ public:
|
||||
void ResetAlpha() { UseAlpha(false); }
|
||||
|
||||
// support for scaled bitmaps
|
||||
virtual void SetScaleFactor(double WXUNUSED(scale)) { }
|
||||
virtual double GetScaleFactor() const { return 1.0; }
|
||||
virtual double GetScaledWidth() const { return GetWidth(); }
|
||||
virtual double GetScaledHeight() const { return GetHeight(); }
|
||||
|
@@ -13,6 +13,8 @@
|
||||
|
||||
#include "wx/palette.h"
|
||||
|
||||
#define wxHAS_BITMAP_SCALE_FACTOR
|
||||
|
||||
// Bitmap
|
||||
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
||||
class wxBitmapRefData ;
|
||||
@@ -239,6 +241,7 @@ public:
|
||||
void EndRawAccess();
|
||||
#endif
|
||||
|
||||
void SetScaleFactor(double scale) wxOVERRIDE;
|
||||
double GetScaleFactor() const wxOVERRIDE;
|
||||
|
||||
void SetSelectedInto(wxDC *dc);
|
||||
|
Reference in New Issue
Block a user