Flexible and powerful architecture for vector drawing applications.
Cocoa and Quartz provide some powerful fundamental tools for doing drawing and graphics, but they are very low level. Contrast this with Cocoa's NSTextView system - it's almost a complete word processor. Thus Cocoa's approach to different developers' needs vary a lot from low-level expert tools to almost writing your app for you.
GCDrawKit attempts to do for drawing applications what Cocoa's text system does for text applications. It provides a set of interrelated classes which implement a complete vector-drawing framework, while trying to maximise flexibility and remaining agnostic about the final end use of the application.
To this end, it provides:
- A fully abstracted "drawing" data model
- Unlimited drawing layers
- Any number of views can be simultaneously attached to view and edit the drawing
- A complete hierarchy of classes for vector drawing objects
- Specialised layers for grids, guides and drawing meta-data panels
- "Real-world" coordinates in millimetres, inches, kilometers or whatever you need
- A standardized selection mechanism and selection "knobs" just works, but easily customisable.
- Styles can be shared among objects or individually attached
- Define complex graphical styles and attributes using a simple scripting "language"
- Classes for gradient fills, Bézier pattern fills, strokes and hatches
- Interactively editable Bézier paths of any complexity
- Draw bezier paths point-by-point or "freehand" with automatic smoothing
- Any image format supported by NSImage can be added as a standard object
- Convert any image to vector form
- Editable text objects
- Text or any other shape or image on a path
- Add arrow heads to any path; automatic dimensioning lines for CAD-type applications
- Built-in snap to grid, snap to guides, align and distribute objects
- Group and Ungroup objects to any degree of nesting. Groups can be rotated and scaled like any object
- Rotate, Scale, Skew, Perspective and Free Distort transformations
- Union, Difference, Intersection and Exclusive-Or (Boolean Ops) on any pair of paths or shapes
- Combine or Break Apart arbitrary paths
- All object types can be freely interconverted
- A large array of built-in object path shapes which is simply extendible
- Simple tool-based drawing paradigm
- Core Image Effects may be applied to any object
- Undo handled for you
- Export any part of the drawing (or whole) as a PDF or TIFF image
- All drawing ultimately performed by Quartz for spectacular quality
Source code and demo applications are available at: http://apptree.net/drawkitmain.htm