• 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: lines in bezierpath look fuzzy
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lines in bezierpath look fuzzy


  • Subject: Re: lines in bezierpath look fuzzy
  • From: Jens Bauer <email@hidden>
  • Date: Sun, 14 Dec 2003 13:33:13 +0100

Hi Francisco,

(and a copy for the list, sorry, forgot the right account again!)

On Sunday, Dec 14, 2003, at 13:12 Europe/Copenhagen, Francisco Tolmasky wrote:

When I draw lines using an nsbezierpath they look "fuzzy" for some reason.

I think you just discovered the antialiasing feature of Mac OS X...

They're somewhat grayed and the edges look darker.

Yup, that's the symptom!

All I want is a nice one pixel line that does not look darker in the edges.

This is a difficult question that comes up now and then, and there haven't been a proper answer on this list yet.
Most people tell you to add 0.5 to the x position and 0.5 to the y position, and it usually works for straight lines, but if you really *do* want no antialiasing, and turn that off, and need to draw diagonal lines, some of them will be very, ehm, should I say "unbeautiful" ? ;)

I've try changing the joint style and the cap style. Neither have worked. Does anyone know what I'm doing wrong?

It's basically not your fault. It's due to that Mac OS X does not draw on the "pixel surface" but rather on the edge that surrounds the pixel.

If you don't want the antialiasing, and you don't find the (x + 0.5, y + 0.5) solution suitable, you can make your view a NSQuickDrawView, and use MoveTo(...); and LineTo(...); to make it do what you want.
If you need to draw the lines fast, you also have the option to use OpenGL, it depends on what you need.
If you need a pretty printout, though, you should probably try using NSBezierPath, and the +0.5 fixup.

If none of the above solutions suit you, you can also create a NSImage and draw directly into this; this is very fast, if you need to draw many pixels.


Love,
Jens
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >lines in bezierpath look fuzzy (From: Francisco Tolmasky <email@hidden>)

  • Prev by Date: lines in bezierpath look fuzzy
  • Next by Date: this is a test
  • Previous by thread: lines in bezierpath look fuzzy
  • Next by thread: Re: lines in bezierpath look fuzzy
  • Index(es):
    • Date
    • Thread