diff options
Diffstat (limited to 'wx+/dc.h')
-rw-r--r-- | wx+/dc.h | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -12,6 +12,7 @@ #include <zen/basic_math.h> #include <wx/dcbuffer.h> //for macro: wxALWAYS_NATIVE_DOUBLE_BUFFER #include <wx/dcscreen.h> +#include <wx/bmpbndl.h> #include <gtk/gtk.h> @@ -91,8 +92,8 @@ constexpr int defaultDpi = 96; inline int getDPI() { -#ifndef wxHAVE_DPI_INDEPENDENT_PIXELS -#error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined? +#ifndef wxHAS_DPI_INDEPENDENT_PIXELS +#error why is wxHAS_DPI_INDEPENDENT_PIXELS not defined? #endif //GTK2 doesn't properly support high DPI: https://freefilesync.org/forum/viewtopic.php?t=6114 //=> requires general fix at wxWidgets-level @@ -117,6 +118,16 @@ int getDpiScalePercent() } +inline +wxBitmapBundle toBitmapBundle(const wxImage& img /*expected to be DPI-scaled!*/) +{ + //return wxBitmap(img, -1 /*depth*/, static_cast<double>(getDPI()) / defaultDpi); not (yet) implemented + wxBitmap bmpScaled(img); + bmpScaled.SetScaleFactor(static_cast<double>(getDPI()) / defaultDpi); + return bmpScaled; +} + + //---------------------- implementation ------------------------ class RecursiveDcClipper { |