EtheaDev / SVGIconImageList

Three engines to render SVG (Delphi Image32, Skia4Delphi, Direct2D wrapper) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...)
Apache License 2.0
321 stars 93 forks source link

Incorrect painting of elliptic arcs #134

Closed pyscripter closed 3 years ago

pyscripter commented 3 years ago

Try this one:

<svg width="320" height="320" xmlns="http://www.w3.org/2000/svg">
  <path d="M 10 315
           L 110 215
           A 30 50 0 0 1 162.55 162.45
           L 172.55 152.45
           L 315 10" stroke="black" fill="green" stroke-width="2" fill-opacity="0.5"/>    
</svg>

Solution

In TSVGPathEllipticArc.AddToPath

Change step 4 to:

  //
  // Step 4 : Compute the angleStart (angle1) and the angleExtent (dangle)
  //
  ux := (x1 - CX1) {/ LRX};
  uy := (y1 - CY1) {/ LRY};
  vx := (-x1 - CX1) {/ LRX};
  vy := (-y1 - CY1) {/ LRY};
carloBarazzetta commented 3 years ago

Ok, pushed.