0

Notes: Working on iOS application.

Hi,
I am pretty sure it is not be possible and I am going to be directed down the "Open GL" route, but I am slightly disappointed with the ability to draw thin black lines in Quartz for the iPhone/iPad. If I set the width like so "CGContextSetLineWidth" (context, 0.1) the line is really faint. I want a nice black dominant line. Is it possible? Or is it possible to do this in "Open GL".

Tulon
  • 4,011
  • 6
  • 36
  • 56
Mixstah
  • 411
  • 1
  • 7
  • 22
  • purely for googlers coming here, here's the total solution and discussion to drawing single-pixel lines at the UIView level, cheers http://stackoverflow.com/a/22694062/294884 Some info may be relevant here – Fattie May 26 '14 at 09:11

1 Answers1

0

CGContextSetLineWidth takes points where

1 point = 1 pixel on non retina display 1 point = 2 pixels on retina display

so you can't use points less than 0.5 which will results to 1 pixel on a retina display. If you use points less than that then the OS will try to make your request by changing the color so that it appears thinner but actually the OS can't draw less than 1 pixel

Another Note

According to the documentation

The default line width is 1 unit. When stroked, the line straddles the path, with half of the total width on either side.

This means that if you are drawing a line on pixel 2 with a width of 2 pixel then you will get a line with a width from 1 to 3

Hani Ibrahim
  • 1,448
  • 11
  • 21