From a48439992d4b1c896dd0beaff91d0a14361032b9 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 10 Feb 2019 16:47:23 -0500 Subject: 10.9 --- wx+/image_tools.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) mode change 100755 => 100644 wx+/image_tools.h (limited to 'wx+/image_tools.h') diff --git a/wx+/image_tools.h b/wx+/image_tools.h old mode 100755 new mode 100644 index bef4cb67..e1a6953c --- 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) -- cgit