Add wxGraphicsContext overloads taking wx{Rect,Point}2DDouble
Unix builds / Ubuntu 24.04 wxGTK with ASAN (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 compatible 3.0 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK UTF-8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxQt (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxX11 (push) Has been cancelled
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Has been cancelled
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK with UBSAN (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxDFB (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 static with gcc 4.8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 2 (push) Has been cancelled
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Has been cancelled
CMake builds / Windows MSVC (push) Has been cancelled
CMake builds / macOS latest wxOSX Ninja (push) Has been cancelled
CMake builds / macOS 14 wxOSX Xcode (push) Has been cancelled
CMake builds / macOS 14 wxIOS (push) Has been cancelled
CMake builds / Windows wxQt 6.8 (push) Has been cancelled
Mac builds / wxMac Universal C++14 (push) Has been cancelled
Mac builds / wxMac ARM with ASAN (push) Has been cancelled
Mac builds / wxiOS (push) Has been cancelled
Mac builds / wxMac Intel C++17 (push) Has been cancelled
Mac Xcode builds / iOS Simulator static (push) Has been cancelled
Mac Xcode builds / macOS dynamic Release (push) Has been cancelled
Mac Xcode builds / iOS static Debug (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Has been cancelled
MSW builds / wxMSW vs2019 DLL Release x64 (push) Has been cancelled
MSW builds / wxMSW vs2019 Debug Win32 (push) Has been cancelled
MSW builds / wxMSW vs2022 Release arm64 (push) Has been cancelled
MSW builds / msw-msys2-clang (push) Has been cancelled
MSW cross-builds / wxMSW 64 bits (push) Has been cancelled
MSW cross-builds / wxMSW/Univ (push) Has been cancelled
MSW cross-builds / wxMSW 32 bits (push) Has been cancelled
Code Checks / Check Spelling (push) Has been cancelled
Code Checks / Check Whitespace (push) Has been cancelled
Code Checks / Check Mixed EOL (push) Has been cancelled
Code Checks / Check C++ Style (push) Has been cancelled
Code Checks / Check All Headers In allheaders.h (push) Has been cancelled
Update Documentation / Update Online Documentation (push) Has been cancelled
No Response / no-response (push) Has been cancelled

Also, add missing documentation for ClearRectangle().

Closes #25444.
This commit is contained in:
Blake-Madden
2025-05-24 18:47:45 +02:00
committed by Vadim Zeitlin
parent 436c16135e
commit d137d1e1e0
2 changed files with 181 additions and 2 deletions
+71 -2
View File
@@ -516,21 +516,37 @@ public:
// adds a quadratic Bezier curve from the current point, using a control point and an end point
virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y );
void AddQuadCurveToPoint(const wxPoint2DDouble& cp, const wxPoint2DDouble& e)
{
AddQuadCurveToPoint(cp.m_x, cp.m_y, e.m_x, e.m_y);
}
// appends a rectangle as a new closed subpath
virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h );
virtual void AddRectangle(const wxRect2DDouble& rect)
{
AddRectangle(rect.m_x, rect.m_y, rect.m_width, rect.m_height);
}
// appends an ellipsis as a new closed subpath fitting the passed rectangle
virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r );
// appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
// appends an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r );
// appends an ellipse
virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
void AddEllipse(const wxRect2DDouble& rect)
{
AddEllipse(rect.m_x, rect.m_y, rect.m_width, rect.m_height);
}
// appends a rounded rectangle
virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius);
void AddRoundedRectangle(const wxRect2DDouble& rect, wxDouble radius)
{
AddRoundedRectangle(rect.m_x, rect.m_y, rect.m_width, rect.m_height, radius);
}
// returns the native path
virtual void * GetNativePath() const;
@@ -699,12 +715,24 @@ public:
// clips drawings to the rect intersected with the current clipping region
virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
void Clip(const wxRect2DDouble& rect)
{
Clip(rect.m_x, rect.m_y, rect.m_width, rect.m_height);
}
// resets the clipping to original extent
virtual void ResetClip() = 0;
// returns bounding box of the clipping region
virtual void GetClipBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble* h) = 0;
wxNODISCARD wxRect2DDouble GetClipBox()
{
wxDouble x, y, w, h;
GetClipBox(&x, &y, &w, &h);
return wxRect2DDouble{ x, y, w, h };
}
// returns the native context
virtual void * GetNativeContext() = 0;
@@ -782,6 +810,11 @@ public:
// translate
virtual void Translate( wxDouble dx , wxDouble dy ) = 0;
void Translate(const wxPoint2DDouble& pt)
{
Translate(pt.m_x, pt.m_y);
}
// scale
virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0;
@@ -828,6 +861,11 @@ public:
// paints a transparent rectangle (only useful for bitmaps or windows)
virtual void ClearRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
void ClearRectangle(const wxRect2DDouble& rect)
{
ClearRectangle(rect.m_x, rect.m_y, rect.m_width, rect.m_height);
}
//
// text
//
@@ -835,6 +873,9 @@ public:
void DrawText( const wxString &str, wxDouble x, wxDouble y )
{ DoDrawText(str, x, y); }
void DrawText( const wxString &str, const wxPoint2DDouble& pt)
{ DoDrawText(str, pt.m_x, pt.m_y); }
void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
{ DoDrawRotatedText(str, x, y, angle); }
@@ -858,10 +899,20 @@ public:
virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
void DrawBitmap(const wxGraphicsBitmap& bmp, const wxRect2DDouble& rect)
{
DrawBitmap(bmp, rect.m_x, rect.m_y, rect.m_width, rect.m_height);
}
virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
void DrawIcon(const wxIcon& icon, const wxRect2DDouble& rect)
{
DrawIcon(icon, rect.m_x, rect.m_y, rect.m_width, rect.m_height);
}
//
// convenience methods
//
@@ -869,6 +920,11 @@ public:
// strokes a single line
virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2);
void StrokeLine(const wxPoint2DDouble& pt1, const wxPoint2DDouble& pt2)
{
StrokeLine(pt1.m_x, pt1.m_y, pt2.m_x, pt2.m_y);
}
// stroke lines connecting each of the points
virtual void StrokeLines( size_t n, const wxPoint2DDouble *points);
@@ -881,13 +937,26 @@ public:
// draws a rectangle
virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
void DrawRectangle(const wxRect2DDouble& rect)
{
DrawRectangle(rect.m_x, rect.m_y, rect.m_width, rect.m_height);
}
// draws an ellipse
virtual void DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
void DrawEllipse(const wxRect2DDouble& rect)
{
DrawEllipse(rect.m_x, rect.m_y, rect.m_width, rect.m_height);
}
// draws a rounded rectangle
virtual void DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius);
// wrappers using wxPoint2DDouble TODO
void DrawRoundedRectangle(const wxRect2DDouble& rect, wxDouble radius)
{
DrawRoundedRectangle(rect.m_x, rect.m_y, rect.m_width, rect.m_height, radius);
}
// helper to determine if a 0.5 offset should be applied for the drawing operation
virtual bool ShouldOffset() const { return false; }
+110
View File
@@ -126,6 +126,13 @@ public:
*/
virtual void AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
/**
@overload
@since 3.3.0
*/
void AddEllipse(const wxRect2DDouble& rect);
/**
Adds a straight line from the current point to (@a x,@a y).
If current point is not yet set before the call to AddLineToPoint(),
@@ -170,12 +177,26 @@ public:
virtual void AddQuadCurveToPoint(wxDouble cx, wxDouble cy,
wxDouble x, wxDouble y);
/**
@overload
@since 3.3.0
*/
void AddQuadCurveToPoint(const wxPoint2DDouble& cp, const wxPoint2DDouble& e);
/**
Appends a rectangle as a new closed subpath. After this call
the current point will be at (@a x, @a y).
*/
virtual void AddRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
/**
@overload
@since 3.3.0
*/
void AddRectangle(const wxRect2DDouble& rect);
/**
Appends a rounded rectangle as a new closed subpath.
If @a radius equals 0, then this function will behave as AddRectangle();
@@ -185,6 +206,13 @@ public:
virtual void AddRoundedRectangle(wxDouble x, wxDouble y, wxDouble w,
wxDouble h, wxDouble radius);
/**
@overload
@since 3.3.0
*/
void AddRoundedRectangle(const wxRect2DDouble& rect, wxDouble radius);
/**
Closes the current sub-path. After this call, the current point will be
at the joined end point of the sub-path.
@@ -623,6 +651,13 @@ public:
*/
virtual void Clip(wxDouble x, wxDouble y, wxDouble w, wxDouble h) = 0;
/**
@overload
@since 3.3.0
*/
void Clip(const wxRect2DDouble& rect);
/**
Returns a bounding box of the current clipping region.
@@ -646,6 +681,13 @@ public:
*/
virtual void GetClipBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble* h) = 0;
/**
@overload
@since 3.3.0
*/
wxRect2DDouble GetClipBox();
/** @}
*/
@@ -842,17 +884,38 @@ public:
wxDouble x, wxDouble y,
wxDouble w, wxDouble h) = 0;
/**
@overload
@since 3.3.0
*/
void DrawBitmap(const wxGraphicsBitmap& bmp, const wxRect2DDouble& rect);
/**
Draws an ellipse.
*/
virtual void DrawEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
/**
@overload
@since 3.3.0
*/
void DrawEllipse(const wxRect2DDouble& rect);
/**
Draws the icon.
*/
virtual void DrawIcon(const wxIcon& icon, wxDouble x, wxDouble y,
wxDouble w, wxDouble h) = 0;
/**
@overload
@since 3.3.0
*/
void DrawIcon(const wxIcon& icon, const wxRect2DDouble& rect);
/**
Draws a polygon.
*/
@@ -870,17 +933,38 @@ public:
*/
virtual void DrawRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
/**
@overload
@since 3.3.0
*/
void DrawRectangle(const wxRect2DDouble& rect);
/**
Draws a rounded rectangle.
*/
virtual void DrawRoundedRectangle(wxDouble x, wxDouble y, wxDouble w,
wxDouble h, wxDouble radius);
/**
@overload
@since 3.3.0
*/
void DrawRoundedRectangle(const wxRect2DDouble& rect, wxDouble radius);
/**
Draws text at the defined position.
*/
void DrawText(const wxString& str, wxDouble x, wxDouble y);
/**
@overload
@since 3.3.0
*/
void DrawText(const wxString& str, const wxPoint2DDouble& pt);
/**
Draws text at the defined position.
@@ -928,6 +1012,18 @@ public:
void DrawText(const wxString& str, wxDouble x, wxDouble y,
wxDouble angle, const wxGraphicsBrush& backgroundBrush);
/**
Paints a transparent rectangle (only useful for bitmaps or windows).
*/
virtual void ClearRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
/**
@overload
@since 3.3.0
*/
void ClearRectangle(const wxRect2DDouble& rect);
/**
Creates a native graphics path which is initially empty.
*/
@@ -944,6 +1040,13 @@ public:
*/
virtual void StrokeLine(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2);
/**
@overload
@since 3.3.0
*/
void StrokeLine(const wxPoint2DDouble& pt1, const wxPoint2DDouble& pt2);
/**
Stroke disconnected lines from begin to end points, using the
fastest method available.
@@ -2161,6 +2264,13 @@ public:
Translates this matrix.
*/
virtual void Translate(wxDouble dx, wxDouble dy);
/**
@overload
@since 3.3.0
*/
void Translate(const wxPoint2DDouble& pt);
};
/// An empty wxGraphicsPen object.