Re: Pixel Drawing Program 3
Re: Pixel Drawing Program 3
- Subject: Re: Pixel Drawing Program 3
- From: Shawn Erickson <email@hidden>
- Date: Sat, 15 Feb 2003 12:31:34 -0800
On Saturday, February 15, 2003, at 11:16 AM, Sebastian Gomez Papiol
wrote:
I understand now better how quartz print graphics on the screen and I
believe I have one solution for draw one pixel paths. I explain the
solution.
First of all, I moved the center of the coordinate system to (-0.5,
-0.5) with the method setFrameOrigin:
Now if I paint horizontal or vertical lines with a 0.5 width the lines
measures only 1 pixel in the screen.
But this solves partially my problem, since if I draw curved or
inclined lines, in some cases quartz draw 2 or 4 pixels instead of 1.
My question is, I can, with some trick, modify que coordinate system,
adding clipping or something else for draw always lines only 1 pixel
width?
Quartz is correctly modeling 1 point width paths in all situations,
however...
When rendered on screen (or anything without resolution matching or
surpassing that of single point math) approximations have to be made,
this cannot be avoided. This results in the potential for more then one
pixel to be painted while attempting to approximate the path you
requested (anti-aliasing will help by reducing the intensity of pixels
that are drawn based on how far from the path they are, an
oversimplification of anti-aliasing).
You can try shrinking the line width more (0.75, 0.25, etc.)...
How would you draw a circle or diagonal line on a fixed pixel grid? Try
it on some graph paper to get an idea at what is going on. The reality
is that an arbitrary path does not always fall on a pixel nor can it
always (except for a few fringe cases, vertical/horizontal line). If it
doesn't fall on a pixel then the closest pixel in theory could be
painted but what happens if no closest exists, etc.
-Shawn
_______________________________________________
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.