Skip to content
Browse files

We need to set the start and stop colors on the gradients. That's what

causes it to fill the areas before the start and after the end of the gradient.
  • Loading branch information...
RobinD42 committed Jul 31, 2019
1 parent de49597 commit 43370db47f5adc9ca076a46d798b6bf7bf4a1cc4
Showing with 8 additions and 13 deletions.
  1. +8 −13 wx/svg/
@@ -64,17 +64,8 @@ def RenderToGC(self, ctx, scale=None, size=None, translate=(0.0, 0.0)):
subpath = self._makeSubPath(ctx, svg_path)

# Draw the combined set of paths.
# If the fill is a radial gradient then first draw the fill with the
# outer color, to ensure that the total area of the shape is filled.
# NOTE: if there are transparencies infolved here then this solution
# is probably wrong.
if shape.fill.type == SVG_PAINT_RADIAL_GRADIENT:
color = wx.Colour(*self._getGradientColors(shape.fill.gradient)[-1])
ctx.FillPath(path, rule)

# Now fill and stroke the shape with the given pen and brush
# Draw the combined set of paths, using the given pen and brush to
# fill and stroke the shape.
ctx.DrawPath(path, rule)
@@ -99,8 +90,12 @@ def _makeSubPath(self, ctx, svg_path):

def _makeGradientStops(self, gradient, prnt=False):
gcstops = wx.GraphicsGradientStops()
for stop in gradient.stops:
stops = [stop for stop in gradient.stops]
first = stops[0]
last = stops[-1]
gcstops = wx.GraphicsGradientStops(wx.Colour(*first.color_rgba),
for stop in stops:
if prnt:
print('stop: ', stop.offset, stop.color_rgba)
color = wx.Colour(*stop.color_rgba)

0 comments on commit 43370db

Please sign in to comment.
You can’t perform that action at this time.