From 018183a4d89f695f57df697b32d25dc438f3ee6a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Aug 2014 15:32:01 +0000 Subject: [PATCH] Add tests of gradients with stops to the drawing sample. This shows inconsistency in handling of radial gradients with and without stops in current wxMSW GDI+-based wxGraphicsContext implementation. See #16443. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/drawing/drawing.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index b37d04f8c2..e4f8bebf32 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -1351,8 +1351,31 @@ void MyCanvas::DrawGradients(wxDC& dc) pth.CloseSubpath(); gc->FillPath(pth); + wxGraphicsGradientStops simpleStops(*wxRED, *wxBLUE); + gfr.Offset(0, gfr.height + 10); - dc.DrawText(wxT("Radial Gradient with Stops"), gfr.x, gfr.y); + dc.DrawText(wxT("Radial Gradient from Red to Blue without intermediary Stops"), + gfr.x, gfr.y); + gfr.Offset(0, TEXT_HEIGHT); + + gc->SetBrush(gc->CreateRadialGradientBrush(gfr.x + gfr.width / 2, + gfr.y + gfr.height / 2, + gfr.x + gfr.width / 2, + gfr.y + gfr.height / 2, + gfr.width / 2, + simpleStops)); + + pth = gc->CreatePath(); + pth.MoveToPoint(gfr.x,gfr.y); + pth.AddLineToPoint(gfr.x + gfr.width,gfr.y); + pth.AddLineToPoint(gfr.x + gfr.width,gfr.y+gfr.height); + pth.AddLineToPoint(gfr.x,gfr.y+gfr.height); + pth.CloseSubpath(); + gc->FillPath(pth); + + gfr.Offset(0, gfr.height + 10); + dc.DrawText(wxT("Radial Gradient from Red to Blue with Yellow and Green Stops"), + gfr.x, gfr.y); gfr.Offset(0, TEXT_HEIGHT); gc->SetBrush(gc->CreateRadialGradientBrush(gfr.x + gfr.width / 2,