diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2019-12-30 10:35:19 +0000 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2019-12-30 10:35:19 +0000 |
commit | f790cdc5775bb1234a9c2666218456d80825966e (patch) | |
tree | cf344e045d5ebdffe0afc35f2de68b8908857808 /wx+/image_tools.h | |
parent | Merge branch '10.18' into 'master' (diff) | |
parent | add upstream 10.19 (diff) | |
download | FreeFileSync-f790cdc5775bb1234a9c2666218456d80825966e.tar.gz FreeFileSync-f790cdc5775bb1234a9c2666218456d80825966e.tar.bz2 FreeFileSync-f790cdc5775bb1234a9c2666218456d80825966e.zip |
Merge branch '10.19' into 'master'10.19
add upstream 10.19
See merge request opensource-tracking/FreeFileSync!16
Diffstat (limited to 'wx+/image_tools.h')
-rw-r--r-- | wx+/image_tools.h | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/wx+/image_tools.h b/wx+/image_tools.h index d72597ef..e2d42fb0 100644 --- a/wx+/image_tools.h +++ b/wx+/image_tools.h @@ -18,25 +18,25 @@ namespace zen { enum class ImageStackLayout { - HORIZONTAL, - VERTICAL + horizontal, + vertical }; enum class ImageStackAlignment //one-dimensional unlike wxAlignment { - CENTER, - LEFT, - RIGHT, - TOP = LEFT, - BOTTOM = RIGHT, + center, + left, + right, + top = left, + bottom = right, }; wxImage stackImages(const wxImage& img1, const wxImage& img2, ImageStackLayout dir, ImageStackAlignment align, int gap = 0); -wxImage createImageFromText(const wxString& text, const wxFont& font, const wxColor& col, ImageStackAlignment textAlign = ImageStackAlignment::LEFT); //CENTER/LEFT/RIGHT +wxImage createImageFromText(const wxString& text, const wxFont& font, const wxColor& col, ImageStackAlignment textAlign = ImageStackAlignment::left); //center/left/right wxImage layOver(const wxImage& back, const wxImage& front, int alignment = wxALIGN_CENTER); -wxImage greyScale(const wxImage& img); //greyscale + brightness adaption +wxImage greyScale(const wxImage& img); //greyscale + brightness adaption wxBitmap greyScale(const wxBitmap& bmp); // //void moveImage(wxImage& img, int right, int up); @@ -44,8 +44,6 @@ void adjustBrightness(wxImage& img, int targetLevel); double getAvgBrightness(const wxImage& img); //in [0, 255] void brighten(wxImage& img, int level); //level: delta per channel in points -bool isEqual(const wxBitmap& lhs, const wxBitmap& rhs); //pixel-wise equality (respecting alpha channel) - void convertToVanillaImage(wxImage& img); //add alpha channel if missing + remove mask if existing //wxColor gradient(const wxColor& from, const wxColor& to, double fraction); //maps fraction within [0, 1] to an intermediate color @@ -153,36 +151,6 @@ void adjustBrightness(wxImage& img, int targetLevel) inline -bool isEqual(const wxBitmap& lhs, const wxBitmap& rhs) -{ - if (lhs.IsOk() != rhs.IsOk()) - return false; - if (!lhs.IsOk()) - return true; - - if (lhs.GetSize() != rhs.GetSize()) - return false; - - wxImage imLhs = lhs.ConvertToImage(); - wxImage imRhs = rhs.ConvertToImage(); - - if (imLhs.HasAlpha() != imRhs.HasAlpha()) - return false; - - const int pixelCount = lhs.GetWidth() * lhs.GetHeight(); - - if (!std::equal(imLhs.GetData(), imLhs.GetData() + pixelCount * 3, imRhs.GetData())) - return false; - - if (imLhs.HasAlpha()) - if (!std::equal(imLhs.GetAlpha(), imLhs.GetAlpha() + pixelCount, imRhs.GetAlpha())) - return false; - - return true; -} - - -inline wxImage shrinkImage(const wxImage& img, int requestedSize) { const int maxExtent = std::max(img.GetWidth(), img.GetHeight()); |