added linear and concentric gradient fill functions (modified/fixed patch from Ryan Norton)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -60,7 +60,9 @@ enum ScreenToShow
|
||||
Show_Ops,
|
||||
Show_Regions,
|
||||
Show_Circles,
|
||||
Show_Splines
|
||||
Show_Splines,
|
||||
Show_Gradient,
|
||||
Show_Max
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -164,6 +166,7 @@ protected:
|
||||
void DrawCircles(wxDC& dc);
|
||||
void DrawSplines(wxDC& dc);
|
||||
void DrawDefault(wxDC& dc);
|
||||
void DrawGradients(wxDC& dc);
|
||||
|
||||
void DrawRegionsHelper(wxDC& dc, wxCoord x, bool firstTime);
|
||||
|
||||
@@ -200,7 +203,8 @@ enum
|
||||
File_ShowRegions,
|
||||
File_ShowCircles,
|
||||
File_ShowSplines,
|
||||
MenuShow_Last = File_ShowSplines,
|
||||
File_ShowGradients,
|
||||
MenuShow_Last = File_ShowGradients,
|
||||
|
||||
File_Clip,
|
||||
|
||||
@@ -971,6 +975,36 @@ void MyCanvas::DrawSplines(wxDC& dc)
|
||||
#endif
|
||||
}
|
||||
|
||||
void MyCanvas::DrawGradients(wxDC& dc)
|
||||
{
|
||||
// LHS: linear
|
||||
wxRect r(10, 10, 100, 100);
|
||||
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxRIGHT);
|
||||
|
||||
r.Offset(0, 110);
|
||||
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxLEFT);
|
||||
|
||||
r.Offset(0, 110);
|
||||
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxDOWN);
|
||||
|
||||
r.Offset(0, 110);
|
||||
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxUP);
|
||||
|
||||
|
||||
// RHS: concentric
|
||||
r = wxRect(200, 10, 100, 100);
|
||||
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE);
|
||||
|
||||
r.Offset(0, 110);
|
||||
dc.GradientFillConcentric(r, *wxWHITE, *wxBLUE);
|
||||
|
||||
r.Offset(0, 110);
|
||||
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(0, 0));
|
||||
|
||||
r.Offset(0, 110);
|
||||
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(100, 100));
|
||||
}
|
||||
|
||||
void MyCanvas::DrawRegions(wxDC& dc)
|
||||
{
|
||||
dc.DrawText(_T("You should see a red rect partly covered by a cyan one ")
|
||||
@@ -1105,6 +1139,10 @@ void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event))
|
||||
case Show_Ops:
|
||||
DrawWithLogicalOps(dc);
|
||||
break;
|
||||
|
||||
case Show_Gradient:
|
||||
DrawGradients(dc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1161,7 +1199,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
menuFile->Append(File_ShowOps, _T("&ROP screen\tF7"));
|
||||
menuFile->Append(File_ShowRegions, _T("Re&gions screen\tF8"));
|
||||
menuFile->Append(File_ShowCircles, _T("&Circles screen\tF9"));
|
||||
menuFile->Append(File_ShowSplines, _T("&Splines screen"));
|
||||
menuFile->Append(File_ShowSplines, _T("&Splines screen\tF11"));
|
||||
menuFile->Append(File_ShowGradients, _T("&Gradients screen\tF12"));
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->AppendCheckItem(File_Clip, _T("&Clip\tCtrl-C"), _T("Clip/unclip drawing"));
|
||||
menuFile->AppendSeparator();
|
||||
|
Reference in New Issue
Block a user