[cairo] Cairo and ISO C++
spitzak at gmail.com
Wed Jan 15 11:40:44 PST 2014
Yes it does sound like the "crisp edges" specified there, however they
are describing an excessively complex and non-working solution.
All I want is for strokes that have an odd width to be offset by .5, .5,
the purpose being to be able to reuse the path for both a fill and
stroke and get a sharp edge. I used the zero linewidth because every
other graphics library I have ever seen used zero for this, and because
most uses would like the same line no matter what the CTM is (it is
often used to draw guidelines), and because I did not want to add
another call to the Cairo API.
You cannot adjust all the strokes to the nearest pixel because this will
either cause identical objects to vary in size, or identical gaps
between objects to vary in size. Both look much uglier than
antialiasing. Fixing this would require advanced AI that replicates the
human visual system to detect what adjustments are acceptable. And you
never want to "turn off antialiasing" and I think it would be nice if
Cairo removed this ability, as amateur programmers seem to think it is
the solution to everything.
The alternative is to provide an api that communicates accurate metrics
of the actual area the rendered path took, similar to how font metrics
are done. I don't think cairo wants to go there.
Emmanuel PACAUD wrote:
> The mode you describes is pretty much shape-rendering="crispEdges" in
> the SVG world.
> While it would be nice to have something like that in cairo, I don't
> think the special zero linewidth approach is interresting, as crisp
> edges is not limited to only one pixel strokes. And I would not have
> this mode by default.
> It would be better implemented as a mode set by a call to a
> cairo_set_rendering_mode function, which would match the SVG model (I'm
> not sure, but probably the PDF model too).
More information about the cairo