• 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: Drawing a 1 pixel-perfect wide bordered NSBezierPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath


  • Subject: Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
  • From: Martin <email@hidden>
  • Date: Thu, 17 Apr 2008 01:17:23 +0200

It works!
Why such a behaviour?

Thanks,
-Martin

On Apr 17, 2008, at 1:15 AM, John Terranova wrote:
Try adding these lines before creating the NSBezierPath:

cellFrame.origin.x += 0.5;
cellFrame.origin.y += 0.5;

Let me know if it works.  It should.

	john

On Apr 16, 2008, at 3:52 PM, Martin wrote:
Hi,

I'm trying to draw a rounded rectangle with a 1 pixel-perfect wide border. Although I made sure that the rect has integral values and its height it an even number (so that height/2.0 is also even), the top and bottom lines look blurry (screenshot: http://img01.picoodle.com/img/img01/4/4/16/f_Picture2m_d4f9168.png ). I don't want to disable anti-alias because of the rounded parts.

What's wrong with my code?

[controlView lockFocus];

NSBezierPath *rectangle = [NSBezierPath bezierPathWithRoundedRect:cellFrame xRadius:cellFrame.size.height/ 2.0 yRadius:cellFrame.size.height/2.0];

[[NSColor colorWithCalibratedRed:222.0/255.0 green:231.0/255.0 blue: 248.0/255.0 alpha:1.0] setFill];
[rectangle fill];


[[NSColor colorWithCalibratedRed:164.0/255.0 green:189.0/255.0 blue: 236.0/255.0 alpha:1.0] setStroke];
[rectangle setLineWidth:1.0];
[rectangle stroke];


[controlView unlockFocus];


Thanks, Martin. _______________________________________________

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


_______________________________________________

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: Drawing a 1 pixel-perfect wide bordered NSBezierPath
      • From: Graham Cox <email@hidden>
References: 
 >Drawing a 1 pixel-perfect wide bordered NSBezierPath (From: Martin <email@hidden>)

  • Prev by Date: Re: Getting selection of IKImageView?
  • Next by Date: Poking NSTextView Binding to Update
  • Previous by thread: Drawing a 1 pixel-perfect wide bordered NSBezierPath
  • Next by thread: Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
  • Index(es):
    • Date
    • Thread