[cairo] The line still blurry after I follow "Frequently Asked Questions" guide

Carl Worth cworth at cworth.org
Mon May 4 19:51:01 UTC 2020


On Sun, May 03 2020, mustodo wrote:
> So, how should I do to draw a sharp with single-pixel-wide line like
> code editor?

Here's my best advice:

1. Get (or make) a piece of graph paper, (paper with printed vertical
   and horizontal lines to form a grid of uniform squares.

2. Label the line of the graph paper with integers.

3. Plot the points of the path that you are constructing in cairo.

Note: If you are filling the path, skip step 4.

4. If you are going to stroke the path, plot new points that are
   separated orthogonally from the line segments of step (3) at a
   distance of one-half the current stroke width.

Now, if all of the lines you drew in step (3), for cairo_fill, or in
step (4), for cairo_strike, lie precisely on the integer, printed lines
of your graph paper, then you should be seeing sharp results, (and
you should also not need to set CAIRO_ANTIALIAS_NONE to achieve that).

Good luck. And have fun with cairo!

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20200504/5f3b851f/attachment.sig>


More information about the cairo mailing list