adobe / svg-native-viewer

SVG Native viewer is a library that parses and renders SVG Native documents
Apache License 2.0
155 stars 37 forks source link

Cairo's gradient transforms are inverted #157

Open moazin opened 3 years ago

moazin commented 3 years ago

A transform on the gradient gets inverted in the Cairo port.

Consider the following document:

<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="glyph99" viewBox="0 0 1000 1000">
  <defs>
    <linearGradient id="grad" gradientUnits="userSpaceOnUse" gradientTransform="translate(200 200)" x1="100" y1="100" x2="400" y2="400">
      <stop offset="0" stop-color="red" />
      <stop offset="1" stop-color="blue" />
    </linearGradient>
  </defs>
  <rect x="100" y="100" width="500" height="500" fill="url(#grad)"/>
</svg>

Have a look at the following renderings.

Librsvg image SNV (Cairo) image SNV (Skia) image