IJSVG is a Mac OSX 10.7+ COCOA library for rendering SVG's within your COCOA applications, its extremely fast and native.
Orignaly written for IconJar (in development)
It takes SVG's files and makes pretty pictures like this:
Add all the IJSVG library files into your project, import the IJSVG.h into the files you wish to use the SVG's. The easiest way to
IJSVG * svg = [[IJSVG alloc] initWithFilePathURL:someURLHere];
// or with and without extension to find it within the bundle
IJSVG * svg = [IJSVG svgNamed:@"my_svg"];
NSImage * svgImage = [svg imageWithSize:NSMakeSize(100.f,100.f)];
#Other ways of drawing
IJSVG does allow you to directly draw the SVG into any focused drawing context for example within the drawRect of an NSView...
- (void)drawRect
{
[svg drawInRect:self.bounds];
}
- Elements: def, use, g, path, circle, elipse, rect, polyline, polygon and line (supports groups heirachy and inheritance)
- Commands: M, L, H, V, C, S, T, Q and Z (have yet to look at A) and full support for multiple parameters of each type
- Transformations: matrix, rotate (not around a point - currently), translate, scale transformations
- Stroking: stroking (not dashed - currently), stroke color, stroke opacity
- Filling: fill color, fill mode ( winding rules ), fill opacity, linear gradients
- Color: supports all predefined colors from the SVG spec and hex values
- Caching: has basic caching implemenation
- Switches and foreign objects, there is a delegate you can implement to handle foreign objects, once you say you can handle it, its up to you to handle the SVG as IJSVG will stop parsing the document once you have told it you will handle it
- Animation
- The A command
- Radial gradients
- Transform for skewX and skewY
- Transform for rotate around a point
- Dashed strokes
- Text!
IJSVG is loosely based on UIBezierPath-SVG by ap4y
SVG icons in example found around the net, some from Sketch App Resources all open source and free to use