summaryrefslogtreecommitdiff
path: root/wx+/image_tools.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-02-10 16:47:23 -0500
committerB Stack <bgstack15@gmail.com>2019-02-10 16:47:23 -0500
commita48439992d4b1c896dd0beaff91d0a14361032b9 (patch)
tree475a67b0b138f2b1cd5f02eaab8e413f7eee62c6 /wx+/image_tools.h
parentMerge branch '10.8' into 'master' (diff)
downloadFreeFileSync-a48439992d4b1c896dd0beaff91d0a14361032b9.tar.gz
FreeFileSync-a48439992d4b1c896dd0beaff91d0a14361032b9.tar.bz2
FreeFileSync-a48439992d4b1c896dd0beaff91d0a14361032b9.zip
10.9
Diffstat (limited to 'wx+/image_tools.h')
-rw-r--r--[-rwxr-xr-x]wx+/image_tools.h13
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)
bgstack15