-void wxCairoBrushData::CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2,
- const wxColour&c1, const wxColour&c2 )
+void wxCairoBrushData::AddGradientStops(const wxGraphicsGradientStops& stops)
+{
+ // loop over all the stops, they include the beginning and ending ones
+ const unsigned numStops = stops.GetCount();
+ for ( unsigned n = 0; n < numStops; n++ )
+ {
+ const wxGraphicsGradientStop stop = stops.Item(n);
+
+ const wxColour col = stop.GetColour();
+
+ cairo_pattern_add_color_stop_rgba
+ (
+ m_brushPattern,
+ stop.GetPosition(),
+ col.Red()/255.0,
+ col.Green()/255.0,
+ col.Blue()/255.0,
+ col.Alpha()/255.0
+ );
+ }
+
+ wxASSERT_MSG(cairo_pattern_status(m_brushPattern) == CAIRO_STATUS_SUCCESS,
+ wxT("Couldn't create cairo pattern"));
+}
+
+void
+wxCairoBrushData::CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
+ wxDouble x2, wxDouble y2,
+ const wxGraphicsGradientStops& stops)