• 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: How to draw a 1 pixel line?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to draw a 1 pixel line?


  • Subject: Re: How to draw a 1 pixel line?
  • From: Janek Priimann <email@hidden>
  • Date: Wed, 25 Dec 2002 22:18:03 +0200

Your problem is very common(it took some time to figure out even for me). The 'problem' is with the Quartz. It uses grid(or something) to draw graphics. And if you give a rounded cordinate it will be between 2 grid cells and that means it will be 2 pixels wide even with linewidth 0.1.

(This ASCII pict shows the problem(i hope))

You want to get something like this,

-----
| x |
-----
| x |
-----

but instead you get something like this
-----
|x|x|
-----
|x|x|
-----

To fix this you need to translate your points or the current transformation matrix itself by 0.5 points. By doing that each cordinate won't be between two grid cells and you get nice 1 pixel wide line.

like this:

-----
| |x|
-----
| |x|
-----

(sorry about my bad english)

-----------------------------------------
Hot Mobiil - helinad, logod ja piltsunumid!
http://portal.hot.ee
_______________________________________________
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.

  • Prev by Date: Web services
  • Next by Date: Maybe OT - Get click from sound output when I drag to Trash
  • Previous by thread: How to draw a 1 pixel line?
  • Next by thread: Re: How to draw a 1 pixel line?
  • Index(es):
    • Date
    • Thread