Tag Archives: Core Graphics

Part 3: Core Graphics: Lines


via Core Graphics, Part 3: Lines | Big Nerd Ranch.

Consider the humble line: just a straight sequence of pixels connecting two points. There are well-known algorithms you can use to do your own drawing, but these days, we have toolkits to do the hard work. In Core Graphics, a line is just a kind of path. Paths are central to many Core Graphics features, and next time you’ll get a lot of path information. But for now, think of lines as sequences of line segments that are stroked (not filled). There are a bunch of general GState parameters that affect lines (color, line width, shadows, transforms) as well as GState values dedicated to drawing lines.

All of the line images you see here were created by GrafDemo. You can find the source over on Github, with this particular version available as “Release cg-pt3.”