15#include <wx/dcbuffer.h>
16#include <wx/graphics.h>
24 SetBackgroundStyle(wxBG_STYLE_PAINT);
29 Bind(wxEVT_PAINT, [
this](
auto&) {
OnPaint(); });
51 wxAutoBufferedPaintDC dc(
this);
52 std::unique_ptr<wxGraphicsContext> gc(wxGraphicsContext::Create(dc));
54 gc->SetInterpolationQuality(wxINTERPOLATION_BEST);
56 const wxSize
size = GetSize();
58 gc->SetBrush(wxBrush(GetBackgroundColour()));
59 gc->DrawRectangle(0, 0,
size.x,
size.y);
63 gc->SetBrush(wxBrush(wxColour(255, 255, 255, 255)));
64 gc->DrawEllipse(0, 0,
size.x,
size.y);
73 (
size.x - resultingImageSize.x) / 2,
74 (
size.y - resultingImageSize.y) / 2,
76 resultingImageSize.y);
78 auto path = gc->CreatePath();
80 path.MoveToPoint(0, 0);
81 path.AddLineToPoint(
size.x / 2, 0);
85 path.MoveToPoint(
size.x, 0);
86 path.AddLineToPoint(
size.x,
size.y / 2);
91 path.AddLineToPoint(
size.x / 2,
size.y);
95 path.MoveToPoint(0,
size.y);
96 path.AddLineToPoint(0,
size.y / 2);
UserImage(wxWindow *parent, const wxSize &size)
void SetBitmap(const wxBitmap &bitmap)