Is there a way to combine two closed paths in Cairo, so the group of paths is filled as a single solid shape, instead of two shapes sitting next to each other?
If I draw two paths next to each other, there is a faint blank line visible between the two shapes. For example, the below script draws a square and an adjacent half circle so they both share a line. There is a faint blank line visible between the two shapes. I want there to be no dividing line between the two shapes.
import math, cairo
def draw_path_1(ctx):
ctx.rectangle(40, 55, 30, 30)
ctx.fill()
def draw_path_2(ctx):
ctx.arc(70, 70, 30, -math.pi / 2, math.pi / 2)
ctx.fill()
with cairo.SVGSurface("two_path_shape.svg", 150, 150) as surface:
ctx = cairo.Context(surface)
draw_path_1(ctx)
draw_path_2(ctx)
I want some way of drawing the SVG without the faint line between the two shapes. I am not only looking for a solution specifically for this example of a square and a half circle, but some method of doing this for more complex paths.
I found that exporting the image as a png does remove this line, but that doesn't help me, as I want the final output as an SVG file.
surface.write_to_png("two_path_shape.png")