<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<br class=""><br class="">Cairo and Skia is two best library for cross-platform GUI, but I prefer to use Cairo because it smaller and write by c, skia is too huge for apps.<br class=""><br class="">when I used Cairo to draw a rectangle, the line is blurry even if I use round numbers.<br class=""><br class=""><pre lang="go" style="box-sizing:border-box;overflow:visible;font-family:Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace;margin-top:0px;margin-bottom:20px;background-color:rgb(51,51,51);font-size:0.9rem;break-inside:avoid;white-space:normal;padding:10px 10px 10px 30px;width:inherit;color:rgb(184,191,198)" class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;color:rgb(200,143,208)" class="">func</span> (<span style="box-sizing:border-box" class="">me</span> <span style="box-sizing:border-box" class="">*</span><span style="box-sizing:border-box" class="">canvas</span>) <span style="box-sizing:border-box" class="">DrawRectF</span>(<span style="box-sizing:border-box" class="">left</span>, <span style="box-sizing:border-box" class="">top</span>, <span style="box-sizing:border-box" class="">right</span>, <span style="box-sizing:border-box" class="">bottom</span> <span style="box-sizing:border-box;color:rgb(200,143,208)" class="">float32</span>, <span style="box-sizing:border-box" class="">paint</span> <span style="box-sizing:border-box" class="">*</span><span style="box-sizing:border-box" class="">Paint</span>) {</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box;color:rgb(200,143,208)" class="">  if</span> <span style="box-sizing:border-box" class="">right</span> <span style="box-sizing:border-box" class=""><=</span> <span style="box-sizing:border-box" class="">left</span> <span style="box-sizing:border-box" class="">||</span> <span style="box-sizing:border-box" class="">bottom</span> <span style="box-sizing:border-box" class=""><=</span> <span style="box-sizing:border-box" class="">top</span> {</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box;color:rgb(200,143,208)" class="">    return</span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span>  }</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box" class=""></span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  C</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">cairo_set_antialias</span>(<span style="box-sizing:border-box" class="">me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">ptr</span>, <span style="box-sizing:border-box" class="">C</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">CAIRO_ANTIALIAS_NONE</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box" class=""></span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  fix</span> :<span style="box-sizing:border-box" class="">=</span> <span style="box-sizing:border-box" class="">paint</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">Style</span> <span style="box-sizing:border-box" class="">==</span> <span style="box-sizing:border-box" class="">STROKE</span> <span style="box-sizing:border-box" class="">&&</span> <span style="box-sizing:border-box;color:rgb(200,143,208)" class="">int32</span>(<span style="box-sizing:border-box" class="">paint</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">Width</span>)<span style="box-sizing:border-box" class="">%</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">2</span> <span style="box-sizing:border-box" class="">!=</span> <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">0</span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  fix</span> <span style="box-sizing:border-box" class="">=</span> <span style="box-sizing:border-box;color:rgb(132,182,203)" class="">false</span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box;color:rgb(200,143,208)" class="">  if</span> <span style="box-sizing:border-box" class="">fix</span> {</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">    me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">Save</span>()</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">    me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">TranslateF</span>(<span style="box-sizing:border-box;color:rgb(100,171,143)" class="">0.5</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">0.5</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span>  }</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  C</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">cairo_rectangle</span>(<span style="box-sizing:border-box" class="">me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">ptr</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">100</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">100</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">500</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">500</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  C</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">cairo_rectangle</span>(<span style="box-sizing:border-box" class="">me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">ptr</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">110</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">110</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">510</span>, <span style="box-sizing:border-box;color:rgb(100,171,143)" class="">510</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">drawPaint</span>(<span style="box-sizing:border-box" class="">paint</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box" class=""></span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box;color:rgb(200,143,208)" class="">  if</span> <span style="box-sizing:border-box" class="">fix</span> {</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">    me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">Restore</span>()</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span>  }</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class="">}</span></pre><div class="">this is a line in cairo</div><div class=""><div class=""><img apple-inline="yes" id="7CBBDAAA-A22F-4868-A682-AB689E7ADCD7" width="107" height="116" src="cid:5B98456E-BEC0-429E-9433-5991E4940014" class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">this is a line in code editor</div><div class=""><img apple-inline="yes" id="018AFDEB-F579-4001-AD3D-A85FFD97B197" width="107" height="115" src="cid:1FD97606-5F10-4944-AE35-476088EF421D" class=""></div><div class=""><br class=""></div><div class="">I searched and found a guide at official website.I readed the "Frequently Asked Questions" > "How do I draw a sharp, single-pixel-wide line?" and follow the guide</div></div><br class=""><pre lang="c" style="box-sizing:border-box;overflow:visible;font-family:Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace;margin-top:0px;margin-bottom:20px;background-color:rgb(51,51,51);font-size:0.9rem;break-inside:avoid;white-space:normal;padding:10px 10px 10px 30px;width:inherit;color:rgb(184,191,198)" class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box" class="">cairo_user_to_device</span> (<span style="box-sizing:border-box" class="">cr</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">x</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">y</span>);</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box" class="">do_rounding</span> (<span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">x</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">y</span>);</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box" class="">cairo_device_to_user</span> (<span style="box-sizing:border-box" class="">cr</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">x</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">y</span>);</span></pre><br class="">it is used round numbers, so it has none change<br class=""><pre lang="go" style="box-sizing:border-box;overflow:visible;font-family:Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace;margin-top:0px;margin-bottom:20px;background-color:rgb(51,51,51);font-size:0.9rem;break-inside:avoid;white-space:normal;padding:10px 10px 10px 30px;width:inherit;color:rgb(184,191,198)" class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;color:rgb(200,143,208)" class="">func</span> (<span style="box-sizing:border-box" class="">me</span> <span style="box-sizing:border-box" class="">*</span><span style="box-sizing:border-box" class="">canvas</span>) <span style="box-sizing:border-box" class="">UserToDevice</span>(<span style="box-sizing:border-box" class="">x</span>, <span style="box-sizing:border-box" class="">y</span> <span style="box-sizing:border-box;color:rgb(200,143,208)" class="">float32</span>) {</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  dx</span> :<span style="box-sizing:border-box" class="">=</span> <span style="box-sizing:border-box" class="">C</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">double</span>(<span style="box-sizing:border-box" class="">x</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  dy</span> :<span style="box-sizing:border-box" class="">=</span> <span style="box-sizing:border-box" class="">C</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">double</span>(<span style="box-sizing:border-box" class="">y</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  C</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">cairo_user_to_device</span>(<span style="box-sizing:border-box" class="">me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">ptr</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">dx</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">dy</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  log</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">V</span>(<span style="box-sizing:border-box;color:rgb(210,107,107)" class="">"userToDevice x=%f, y=%f, dx=%f, dy=%f"</span>, <span style="box-sizing:border-box" class="">x</span>, <span style="box-sizing:border-box" class="">y</span>, <span style="box-sizing:border-box" class="">dx</span>, <span style="box-sizing:border-box" class="">dy</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  C</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">cairo_device_to_user</span>(<span style="box-sizing:border-box" class="">me</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">ptr</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">dx</span>, <span style="box-sizing:border-box" class="">&</span><span style="box-sizing:border-box" class="">dy</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;display:inline-block" class="">  </span><span style="box-sizing:border-box" class="">  log</span><span style="box-sizing:border-box;color:rgb(100,171,143)" class="">.</span><span style="box-sizing:border-box" class="">V</span>(<span style="box-sizing:border-box;color:rgb(210,107,107)" class="">"deviceToUser x=%f, y=%f, dx=%f, dy=%f"</span>, <span style="box-sizing:border-box" class="">x</span>, <span style="box-sizing:border-box" class="">y</span>, <span style="box-sizing:border-box" class="">dx</span>, <span style="box-sizing:border-box" class="">dy</span>)</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class="">}</span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box" class=""></span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;color:rgb(218,146,74)" class="">// output</span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;color:rgb(218,146,74)" class="">// userToDevice x=100.000000, y=500.000000, dx=100.000000, dy=500.000000</span></span><br class=""><span style="box-sizing:border-box;padding-right:0.1px" class=""><span style="box-sizing:border-box;color:rgb(218,146,74)" class="">// deviceToUser x=100.000000, y=500.000000, dx=100.000000, dy=500.000000</span></span></pre><br class="">I tried Cairo versions cairo-1.14.12  cairo-1.16.0_2 cairo-1.16.0_3<div class=""><br class="">So, how should I do to draw a sharp with single-pixel-wide line like code editor? </div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></body></html>