• 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 do you draw a single pixel line?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you draw a single pixel line?


  • Subject: Re: How do you draw a single pixel line?
  • From: Dietmar Planitzer <email@hidden>
  • Date: Thu, 15 Aug 2002 23:59:33 +0200

> From: Paul Fox <email@hidden>
>
> Are you guessing at the answer or do you know this works for sure?
>
> I tried 0.25, 0.20, 0.0 and same results each time.

Okay, just dug out my good old test app again:

There are more or less two possible ways to get thin diagonal lines with
Quartz:

1) With anti-aliasing turned on, set the line width to 0.8 or 0.75. Setting
the line width to a greater value will result in thick lines. Setting it to
a smaller value will result in a barely visible line. The latter happens
because the area covered by the line becomes smaller and smaller compared to
the area of a single pixel, thus the pixels along the line are assigned a
small coverage value which translates into a small alpha value.

2) With anti-aliasing turned off, set the line width to 0.1 or even 0.01.

You may also try to play around with the context's stroke adjust value:

void CGContextSetStrokeAdjust(CGContextRef ctx, int zeroOrOne)

If this doesn't help, then I think nothing will...

BTW: Quartz doesn't support zero-width lines like (D)PS. So, setting the
line width to 0.0 in the anti-aliased case results in an invisible line and
in the aliased case in a 1 pixel width line.


Regards,

Dietmar Planitzer
_______________________________________________
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: 
 >Re: How do you draw a single pixel line? (From: Paul Fox <email@hidden>)

  • Prev by Date: killing NSThreads
  • Next by Date: Re: How do you draw a single pixel line?
  • Previous by thread: Re: How do you draw a single pixel line?
  • Next by thread: Re: How do you draw a single pixel line?
  • Index(es):
    • Date
    • Thread