summaryrefslogtreecommitdiff
path: root/wx+/image_tools.cpp
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-05-19 09:24:58 -0400
committerB. Stack <bgstack15@gmail.com>2023-05-19 09:24:58 -0400
commit90bc692185a27f18acb6b029dfaf038e555ef8ff (patch)
treefdb56193bab28d36a4c6723bf847f3aa2ce36a9b /wx+/image_tools.cpp
parentadd upstream 12.2 (diff)
downloadFreeFileSync-90bc692185a27f18acb6b029dfaf038e555ef8ff.tar.gz
FreeFileSync-90bc692185a27f18acb6b029dfaf038e555ef8ff.tar.bz2
FreeFileSync-90bc692185a27f18acb6b029dfaf038e555ef8ff.zip
add upstream 12.312.3
Diffstat (limited to 'wx+/image_tools.cpp')
-rw-r--r--wx+/image_tools.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/wx+/image_tools.cpp b/wx+/image_tools.cpp
index 72c7dc74..04f7f7ff 100644
--- a/wx+/image_tools.cpp
+++ b/wx+/image_tools.cpp
@@ -397,7 +397,7 @@ void zen::convertToVanillaImage(wxImage& img)
const unsigned char* rgb = img.GetData();
const int pixelCount = width * height;
- for (int i = 0; i < pixelCount; ++ i)
+ for (int i = 0; i < pixelCount; ++i)
{
const unsigned char r = *rgb++;
const unsigned char g = *rgb++;
@@ -415,3 +415,46 @@ void zen::convertToVanillaImage(wxImage& img)
assert(!img.HasMask());
}
}
+
+wxImage zen::rectangleImage(wxSize size, const wxColor& col)
+{
+ assert(col.IsSolid());
+ wxImage img(size);
+
+ unsigned char* rgb = img.GetData();
+ const int pixelCount = size.GetWidth() * size.GetHeight();
+ for (int i = 0; i < pixelCount; ++i)
+ {
+ *rgb++ = col.GetRed();
+ *rgb++ = col.GetGreen();
+ *rgb++ = col.GetBlue();
+ }
+ convertToVanillaImage(img);
+ return img;
+}
+
+
+wxImage zen::rectangleImage(wxSize size, const wxColor& innerCol, const wxColor& borderCol, int borderWidth)
+{
+ assert(innerCol.IsSolid() && borderCol.IsSolid());
+ wxImage img = rectangleImage(size, borderCol);
+
+ const int heightInner = size.GetHeight() - 2 * borderWidth;
+ const int widthInner = size.GetWidth () - 2 * borderWidth;
+
+ if (widthInner > 0 && heightInner > 0 && innerCol != borderCol)
+ //copyImageLayover(rectangleImage({widthInner, heightInner}, innerCol), img, {borderWidth, borderWidth}); => inline:
+ for (int y = 0; y < heightInner; ++y)
+ {
+ unsigned char* rgb = img.GetData () + 3 * (borderWidth + (borderWidth + y) * size.GetWidth());
+
+ for (int x = 0; x < widthInner; ++x)
+ {
+ *rgb++ = innerCol.GetRed();
+ *rgb++ = innerCol.GetGreen();
+ *rgb++ = innerCol.GetBlue();
+ }
+ }
+
+ return img;
+}
bgstack15