mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
LibGfx: Approximate elliptical arcs with cubic beziers
Unlike all other primitives elliptical arcs are non-trivial to manipulate, it's tricky to correctly apply a Gfx::AffineTransform to them. Prior to this change, Path::copy_transformed() was still incorrectly applying transforms such as flips and skews to arcs. This patch very closely approximates arcs with cubic beziers (I can not visually spot any differences), which can then be easily and correctly transformed in all cases. Most of the maths here was taken from: https://mortoray.com/rendering-an-svg-elliptical-arc-as-bezier-curves/ (which came from https://www.joecridge.me/content/pdf/bezier-arcs.pdf, now a dead link).
This commit is contained in:
parent
2a1bf63f9e
commit
1bc7b0320e
4 changed files with 54 additions and 101 deletions
|
@ -23,12 +23,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (50,150) content-size 0x0 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (45.693222,199.830932) content-size 118.782173x47.453796 children: not-inline
|
||||
SVGGeometryBox <path> at (45.690780,199.828884) content-size 118.784614x47.455844 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (50,150) content-size 0x0 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (84.5,159.504878) content-size 81x80.995117 children: not-inline
|
||||
SVGGeometryBox <path> at (84.5,159.499996) content-size 81x81 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue