// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(__APPLE__)
- #pragma implementation
- #pragma interface
-#endif
-
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
Show_Ops,
Show_Regions,
Show_Circles,
- Show_Splines
+ Show_Splines,
+ Show_Gradient,
+ Show_Max
};
// ----------------------------------------------------------------------------
void DrawCircles(wxDC& dc);
void DrawSplines(wxDC& dc);
void DrawDefault(wxDC& dc);
+ void DrawGradients(wxDC& dc);
void DrawRegionsHelper(wxDC& dc, wxCoord x, bool firstTime);
File_ShowRegions,
File_ShowCircles,
File_ShowSplines,
- MenuShow_Last = File_ShowSplines,
+ File_ShowGradients,
+ MenuShow_Last = File_ShowGradients,
File_Clip,
// mark the origin
dc.DrawCircle(0, 0, 10);
-#if !wxMAC_USE_CORE_GRAPHICS
+#if !defined(wxMAC_USE_CORE_GRAPHICS) || !wxMAC_USE_CORE_GRAPHICS
// GetPixel and FloodFill not supported by Mac OS X CoreGraphics
// (FloodFill uses Blit from a non-wxMemoryDC)
//flood fill using brush, starting at 1,1 and replacing whatever colour we find there
#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 ")
case Show_Ops:
DrawWithLogicalOps(dc);
break;
+
+ case Show_Gradient:
+ DrawGradients(dc);
+ break;
+
+ default:
+ break;
}
}
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();