Re: How to draw a 1 pixel line?
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.