Skip to content
Permalink
Browse files

Use a list for renderers without gradient transform support (so far)

  • Loading branch information...
RobinD42 committed Aug 2, 2019
1 parent 57b0ff0 commit 65f5485f16b4ce1b5629bb78489e16df4cd86463
Showing with 5 additions and 4 deletions.
  1. +5 −4 wx/svg/__init__.py
@@ -17,6 +17,7 @@
from ._version import __version__
from ._nanosvg import *

_RenderersWithoutGradientTransforms = ['wxGDIPlusRenderer', 'wxD2DRenderer']

class SVGimage(SVGimageBase):
"""
@@ -134,7 +135,7 @@ def _makeBrush(self, ctx, shape):
# ourselves. This is only an approximation of the desired outcome
# however, as things like scale and shear in the transform will not
# be applied to the rest of the fill.
if ctx.Renderer.Type == 'wxGDIPlusRenderer':
if ctx.Renderer.Type in _RenderersWithoutGradientTransforms:
matrix.Invert()
x1, y1 = matrix.TransformPoint(x1, y1)
x2, y2 = matrix.TransformPoint(x2, y2)
@@ -155,7 +156,7 @@ def _makeBrush(self, ctx, shape):
matrix = ctx.CreateMatrix(*gradient.xform)

# Except for GDI+... See note above
if ctx.Renderer.Type == 'wxGDIPlusRenderer':
if ctx.Renderer.Type in _RenderersWithoutGradientTransforms:
matrix.Invert()
cx, cy = matrix.TransformPoint(cx, cy)
r1, r2 = matrix.TransformPoint(0, 1)
@@ -198,7 +199,7 @@ def _makePen(self, ctx, shape):
matrix = ctx.CreateMatrix(*gradient.xform)

# Except for GDI+... See note above
if ctx.Renderer.Type == 'wxGDIPlusRenderer':
if ctx.Renderer.Type in _RenderersWithoutGradientTransforms:
matrix.Invert()
x1, y1 = matrix.TransformPoint(x1, y1)
x2, y2 = matrix.TransformPoint(x2, y2)
@@ -216,7 +217,7 @@ def _makePen(self, ctx, shape):
matrix = ctx.CreateMatrix(*gradient.xform)

# Except for GDI+... See note above
if ctx.Renderer.Type == 'wxGDIPlusRenderer':
if ctx.Renderer.Type in _RenderersWithoutGradientTransforms:
matrix.Invert()
cx, cy = matrix.TransformPoint(cx, cy)
r1, r2 = matrix.TransformPoint(0, 1)

0 comments on commit 65f5485

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