hpi-swa-teaching / SVGMorph

(SWT22-04)
MIT License
5 stars 2 forks source link

Bezier: Gradients are not positioned correctly #67

Open Nils1729 opened 2 years ago

Nils1729 commented 2 years ago

Since bezier-based rendering goes without using canvas transformations, gradients are also not transformed. image

<svg xmlns="http://www.w3.org/2000/svg" viewBox="-60 -60 120 120">
<defs>
      <linearGradient id="Gradient1">
        <stop stop-color="red" offset="0%"/>
        <stop stop-color="blue" offset="50%"/>
        <stop stop-color="green" offset="100%"/>
      </linearGradient></defs>
<ellipse fill="url(#Gradient1)" rx="50" ry="50" />
</svg>

This could be fixed either by reintroducing transformations and extracting scale as to not sacrifice too much precision or by implementing linear transforms on gradients or fill styles in general.