srwiley / rasterx

Rasterx is an SVG 2.0 path compliant rasterizer that can use either scany, the golang vector or a derivative of the freetype anti-aliaser.
BSD 3-Clause "New" or "Revised" License
133 stars 11 forks source link

How do you use AddArc given the context from SVG2.0 data? #15

Open steampoweredtaco opened 2 years ago

steampoweredtaco commented 2 years ago

First, thanks for the library. This might be considered related to #13 Given documentation or a test as an example for AddArc may clarify both issues.

I am trying to figure out how to use AddArc given an SVG 2.0 instruction. https://github.com/srwiley/rasterx/blob/85cb7272f5e99816a35e2c3fff0c4ab1b16e867c/shapes.go#L99 Let's assume I have M 0 0 a4.9916 4.9916 0 0 1 -0.59375 0.1875 notice this is the relative version which I think simply means that the last two values must be adjusted by the current point and in this case it is 0, 0.

I have summarized so far that the Points is basically all the parameters of a, no issue there. What I can't figure out is what is cx, cy, px, py parameters?

I can't seem to get the correct arc. Is cx,cy current point that would make since, is that correct?

It is the px, py I don't really have any idea at all what it could be or how to derive it from the information I have.

Given this is a relative instruction would I need to update points based on the current location or is that somehow related to the c or p parameters?

Thanks for your time!