[cairo] Shouldn't Cairo use/offer degrees rather than radians?

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Wed Jun 28 07:03:10 UTC 2017


On Wed, 28 Jun 2017 07:05:13 +0200, David Kastrup wrote:

> The inability to reliably draw a half circle that seamlessly connects
> with another half circle under any rasterization seems more important
> in my book.

I don’t understand the problem. I just tried the following quick
program:

    import sys
    import os
    import qahirah as qah
    from qahirah import \
        CAIRO, \
        Colour, \
        Vector

    fig_dimensions = Vector(100, 100)
    dpi = 720
    pix = qah.ImageSurface.create \
      (
        format = CAIRO.FORMAT_RGB24,
        dimensions = round(fig_dimensions * dpi / qah.base_dpi)
      )
    ctx = \
        (qah.Context.create(pix)
            .scale(dpi / qah.base_dpi)
            .set_source_colour(Colour.grey(1))
            .set_operator(CAIRO.OPERATOR_SOURCE)
            .paint()
            .set_source_colour(Colour.grey(0))
            .set_line_width(4)
            .set_operator(CAIRO.OPERATOR_OVER)
        )
    (ctx
        .arc(centre = (25, 25), radius = 20, angle1 = -180 * qah.deg, angle2 = 0, negative = False)
        .stroke()
        .arc(centre = (25, 25), radius = 20, angle1 = 0, angle2 = 180 * qah.deg, negative = False)
        .stroke()
    )
    (ctx
        .move_to((75, 25))
        .line_to((75, 50))
        .stroke()
        .move_to((75, 50))
        .line_to((75, 75))
        .stroke()
    )

    pix \
        .flush() \
        .write_to_png("%s.png" % os.path.basename(sys.argv[0]))

The output PNG file I got is enclosed. Can you see any seams in the
rasterization? Because I can’t.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: connect_segments.png
Type: image/png
Size: 23006 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20170628/2e73273b/attachment-0001.png>


More information about the cairo mailing list