When using adg_path_chamfer or adg_path_fillet after an adg_path_close the resulting shape is not closed. These are valid operations that use the primitive before close-path as first operand and the first primitive of the current segment as second operand.
Actually they resolve to a line-to or arc-to with the starting coordinates of the segment as destination.
The chamfer problem can be fixed as a close-path is basically a line-to primitive joint to the start of the segment.
For fillets, and more generally for anything that does not involve lines, the problem is much harder to resolve. Supposing the two operands are arcs and I must join them with another arc (that is, what fillets are used for), how can the segment cycle if the close-path is a line-to primitive?
A first naive approach would be to keep the current implementation and add a close-path (it will start and end at the same coordinates).
The path often is not closed, also in plain cairo. A typical example is the following code:
local math = require 'math' local lgi = require 'lgi' local cairo = lgi.cairo local surface = cairo.ImageSurface.create('ARGB32', 800, 800) local cr = cairo.Context.create(surface) cr:arc(400, 400, 150, 0, math.rad(360)) cr.line_width = 80; cr.line_cap = 'SQUARE' cr:stroke() surface:write_to_png('test.png')
This results in an image that has a clear discontinuity in (550, 400). Worse, exporting in SVG gives 4 unjoint Bézier curves.