A little demo program showing off various Core Graphics features. It's a sample program for a set of posts over at the Big Nerd Ranch blog:
- In the Beginning
- Contextually Speaking
- Lines
- Paths (forthcoming)
Here are some other, possibly interesting, CG-related blog posts:
- Rectangles, Part 1 - an introduction to CGRect and basic manipulations.
- Rectangles, Part 2 - more CGRect and more fun API (union, intersection, insets, dividing)
Behold the main menu it all of its glory:
For the demo windows, the left-hand view is implemented in Objective-C, the right-hand view is implemented in Swift, and the window controllers alternate ObjC and Swift implementations.
Simple is a view that shows basic drawing, as well as GState hygiene. The "Sloppy" toggle turns off some GState management, showing attribute settings leak out in other method's drawing.
Here are things related to lines. End caps, line joins, drawing mechanisms, and line phases.
A sampler of the different path component calls. Click and drag the control points to see how they behave.
The plethora of "arc" calls are confusing. Here they are with influence lines and tweakable settings.
Transformations are a-fine thing.
A bit of history - Core Graphics is based on the PostScript drawing model. CG also includes a full postscript interpreter. This window lets you enter code and run it. Worst IDE Evar.