GitXplorerGitXplorer
n

SimpleSVG

public
0 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
b3409fe139b5314814c17e1939d34ae13559f4a1

Remove bound drawing for now

nndevenish committed 9 years ago
Unverified
aa72a392e9080ea0d9de3baa30055cd031ccf608

Use an estimate of miter for polygon bounds

nndevenish committed 9 years ago
Unverified
00d0bd853c762e8be64504c35f3eb215cf60c519

Tidy some interfaces

nndevenish committed 9 years ago
Unverified
d8e58e6666a26d6412a75da1bcf3e02f05f14d71

Remove state object from passing chain

nndevenish committed 9 years ago
Unverified
85a61e0f221d3823e89bb45db88b8549b6c9f0ff

Read and apply transforms when rendering

nndevenish committed 9 years ago
Unverified
6d66c5ee1b58b4145d0d5e876ad645e28e2aafd8

Allow drawing of sub-sections

nndevenish committed 9 years ago

README

The README file for this repository.

SimpleSVG

A VERY minimalist SVG parser, for swift, in a single source file. Written because it seemed easier than spending several more hours trying to work out how to get SVGKit working via a framework in a swift application.

It currently supports only a very minimal set of SVG features, mostly so that I can use it for my other applications:

  • Path objects with cubic Bézier curves
  • Line, Circle, Rect, Polygon
  • Solid fills and paths

And can currently only draw the existing SVG onto a provided CGContextRef. This should be enough to be able to e.g. convert an SVG into a texture for rendering with OpenGL.

Usage

Simple add SimpleSVG.swift to your existing project, and instantiate the SVGImage class. You can then use drawToContext to render the image. Example:

let svgFile = SVGImage(withContentsOfFile: sampleImage)
if let context = UIGraphicsGetCurrentContext() {
  svgFile.drawToContext(context)
}