W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2013

Re: [whatwg] Blurry lines in 2D Canvas (and SVG)

From: Rik Cabanier <cabanier@gmail.com>
Date: Tue, 23 Jul 2013 18:13:19 -0700
Message-ID: <CAGN7qDBLSExNvPGR-ZLbY94jLuizdScBSWqO9PJk5cmWy=k3dQ@mail.gmail.com>
To: Kornel Lesiński <kornel@geekhood.net>
Cc: whatwg@lists.whatwg.org
On Tue, Jul 23, 2013 at 5:34 PM, Kornel Lesiński <kornel@geekhood.net>wrote:

> On Wed, 24 Jul 2013 01:18:35 +0100, David Dailey <ddailey@zoominternet.net>
> wrote:
>  Just affirming what you've said in SVG:
>> http://cs.sru.edu/~ddailey/**svg/edgeblurs.svg<http://cs.sru.edu/~ddailey/svg/edgeblurs.svg>
>> The middle rects are crisp, having been merely translated leftward and
>> downward by half a pixel. Zooming in from the browser rectifies the
>> problem
>> (as expected) after a single tick.
>> I remember folks discussing sub-pixel antialiasing quite a bit on the SVG
>> lists circa fall/winter 2011. It seemed to cause some troubles for D3. Is
>> that the same issue?
> It's not a bug, it's a feature ;)
> The line is centered around edge of the box. You haven't specified whether
> you want the line to be outside or inside the box (or overlapping left edge
> of the box, but not the right, etc.), so you get line in the middle
> approximated as well as possible.
> It's not intuitive. It's a pretty common pitfall, but it's logical.
> For 1-pixel lines it could be fixed by allowing authors to specify that
> path should be stroked with lines aligned to inside/outside of the path
> (which is a useful feature on its own).

Sure, but how can we fix this?
It's not very intuitive that I have to keep track of the devicePixelRatio
(and the current CTM?) to get crisp lines.

What we need is that artwork 'snaps' to the native pixels while still being

Illustrator tries to work around this by offering a 'snap to grid' option
but users are running into lots of issues (just do a google search for
'illustrator snap to grid')
Received on Wednesday, 24 July 2013 01:13:42 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:03 UTC