summaryrefslogtreecommitdiff
path: root/wx+/image_tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'wx+/image_tools.h')
-rw-r--r--wx+/image_tools.h50
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());
bgstack15