• 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: NSBezierPath linewidth not correct
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBezierPath linewidth not correct


  • Subject: Re: NSBezierPath linewidth not correct
  • From: Alastair Houghton <email@hidden>
  • Date: Mon, 4 Jan 2010 16:39:32 +0000

On 2 Jan 2010, at 23:42, Rob Keniger wrote:

> On 02/01/2010, at 8:58 PM, Gustavo Pizano wrote:
>
>> No worries, I modify it and in fact it does work, but the background images will display a .5 gap between along the horizon between the images that conform the background, so I will put just a .5 to everywhere I need instead...
>
> It will probably be easier to create an NSAffineTransform and translate the whole context by 0.5px, so all drawing is offset without you needing to fiddle with individual values.

While it sounds good superficially, that isn't such a great idea.  The reason is that while stroking draws the stroke centred on the specified path, filling draws strictly inside.  So e.g.

  NSRect myRect = NSMakeRect (10.0, 10.0, 100.0, 100.0);

  [[NSColor blueColor] set];
  NSRectFill (myRect);

will draw a sharp blue rectangle (by default), even though

  [[NSColor redColor] set];
  [NSBezierPath strokeRect:myRect];

will (on current displays) add a fuzzy outline.

Also, even if you adjust for the 0.5 pixel offset, you don't necessarily want to do so in both axes (depends what you're doing).  It isn't necessarily 0.5 pixels either---you might be on a high DPI display, which is something Apple spent a lot of time talking about and has gone rather quiet about recently...

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

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

References: 
 >NSBezierPath linewidth not correct (From: Gustavo Pizano <email@hidden>)
 >Re: NSBezierPath linewidth not correct (From: Graham Cox <email@hidden>)
 >Re: NSBezierPath linewidth not correct (From: Gustavo Pizano <email@hidden>)
 >Re: NSBezierPath linewidth not correct (From: Gustavo Pizano <email@hidden>)
 >Re: NSBezierPath linewidth not correct (From: Rob Keniger <email@hidden>)

  • Prev by Date: Re: exposeBinding:
  • Next by Date: Re: NSScrollView scroller size
  • Previous by thread: Re: NSBezierPath linewidth not correct
  • Next by thread: Re: NSBezierPath linewidth not correct
  • Index(es):
    • Date
    • Thread