FINE I'll do it myself

This commit is contained in:
GenevensiS
2026-05-11 13:11:37 +02:00
parent 72830ec218
commit 2135a14b17
3 changed files with 53 additions and 8 deletions
+29 -1
View File
@@ -9,7 +9,8 @@
#include <util/prec.hpp>
#include <util/rotation.hpp>
#include <gfx/gfx.hpp>
#include <data/font.hpp>
#include <data/font.hpp>
#include <wx/rawbmp.h>
// ----------------------------------------------------------------------------- : Rotation
@@ -276,6 +277,33 @@ void RotatedDC::DrawRoundedRectangle(const RealRect& r, double radius) {
}
}
void RotatedDC::DrawInvertRectangle(const RealRect& r) {
wxRect r_ext = trRectToBB(r);
wxBitmap bmp(r_ext.width, r_ext.height, 24);
wxMemoryDC memDC(bmp);
memDC.Blit(0, 0, r_ext.width, r_ext.height, &dc, r_ext.x, r_ext.y);
memDC.SelectObject(wxNullBitmap);
wxNativePixelData data(bmp);
if (!data) return; // Raw access not available on this platform/bitmap
wxNativePixelData::Iterator p(data);
for (int j = 0; j < r_ext.height; ++j) {
wxNativePixelData::Iterator rowStart = p;
for (int i = 0; i < r_ext.width; ++i) {
// Invert each channel
p.Red() = 255 - p.Red();
p.Green() = 255 - p.Green();
p.Blue() = 255 - p.Blue();
++p; // Move to next pixel in the row
}
p = rowStart;
p.OffsetY(data, 1); // Move to the next row
}
dc.DrawBitmap(bmp, RealPoint(r_ext.x, r_ext.y));
}
void RotatedDC::DrawCircle(const RealPoint& center, double radius) {
wxPoint p = tr(center);
dc.DrawCircle(p.x + 1, p.y + 1, int(trS(radius)));