svg-native-viewer icon indicating copy to clipboard operation
svg-native-viewer copied to clipboard

Cairo's gradient transforms are inverted

Open moazin opened this issue 3 years ago • 0 comments

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

moazin avatar May 25 '21 12:05 moazin