• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Strange issue in stroking a bezier path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange issue in stroking a bezier path


  • Subject: Re: Strange issue in stroking a bezier path
  • From: Kyle Sluder <email@hidden>
  • Date: Sat, 05 May 2012 16:55:57 -0700

On May 5, 2012, at 4:46 PM, Jens Alfke <email@hidden> wrote:

>
> It does that, but the results may not always be exactly what you want. :) The default behavior is to antialias, so if you stroke a one-point-wide black rectangle on integer point boundaries (assuming the usual 1pt==1px scaling) you will in fact get a two-pixel wide gray rectangle. Which is probably not what you wanted. This is because the edges are on pixel boundaries so the strokes are going halfway through the pixels on either side. The solution as I said is to add 0.5 to the coordinates so that the stroke edges fall on pixel boundaries.
>
> (IIRC there are some AppKit geometry utility functions that will adjust coordinate values to fit pixel boundaries in a resolution-independent way. I don’t remember their names offhand.)

-centerScanRect:, -convertRectToBacking: and friends. Which if I understand correctly you should now *always* use instead of adding half pixels because of HiDPI.

>
> Someday every device will have retina-quality graphics and these details won’t matter

It still matters because coordinates in Quartz always refer to the infinitely thin space between device pixels.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Strange issue in stroking a bezier path
      • From: Peter Teeson <email@hidden>
References: 
 >Strange issue in stroking a bezier path (From: Peter Teeson <email@hidden>)
 >Re: Strange issue in stroking a bezier path (From: Ken Thomases <email@hidden>)
 >Re: Strange issue in stroking a bezier path (From: Peter Teeson <email@hidden>)
 >Re: Strange issue in stroking a bezier path (From: Jens Alfke <email@hidden>)
 >Re: Strange issue in stroking a bezier path (From: Peter Teeson <email@hidden>)
 >Re: Strange issue in stroking a bezier path (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
  • Next by Date: Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
  • Previous by thread: Re: Strange issue in stroking a bezier path
  • Next by thread: Re: Strange issue in stroking a bezier path
  • Index(es):
    • Date
    • Thread