diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2019-02-13 21:05:15 +0000 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2019-02-13 21:05:15 +0000 |
commit | 2e618740c10a6dc7f5a8ee031a196b4ac95b1294 (patch) | |
tree | 475a67b0b138f2b1cd5f02eaab8e413f7eee62c6 /wx+/image_tools.h | |
parent | Merge branch '10.8' into 'master' (diff) | |
parent | 10.9 (diff) | |
download | FreeFileSync-10.9.tar.gz FreeFileSync-10.9.tar.bz2 FreeFileSync-10.9.zip |
Merge branch '10.9' into 'master'10.9
10.9
See merge request opensource-tracking/FreeFileSync!6
Diffstat (limited to 'wx+/image_tools.h')
-rw-r--r--[-rwxr-xr-x] | wx+/image_tools.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/wx+/image_tools.h b/wx+/image_tools.h index bef4cb67..e1a6953c 100755..100644 --- a/wx+/image_tools.h +++ b/wx+/image_tools.h @@ -52,6 +52,8 @@ void convertToVanillaImage(wxImage& img); //add alpha channel if missing + remov //wxColor hsvColor(double h, double s, double v); //h within [0, 360), s, v within [0, 1] +wxImage shrinkImage(const wxImage& img, int requestedSize); + inline wxImage getTransparentPixel() @@ -179,6 +181,17 @@ bool isEqual(const wxBitmap& lhs, const wxBitmap& rhs) return true; } + +inline +wxImage shrinkImage(const wxImage& img, int requestedSize) +{ + const int maxExtent = std::max(img.GetWidth(), img.GetHeight()); + assert(requestedSize <= maxExtent); + return img.Scale(img.GetWidth () * requestedSize / maxExtent, + img.GetHeight() * requestedSize / maxExtent, wxIMAGE_QUALITY_BILINEAR); //looks sharper than wxIMAGE_QUALITY_HIGH! +} + + /* inline wxColor gradient(const wxColor& from, const wxColor& to, double fraction) |