GitXplorerGitXplorer
n

SimpleSVG

public
0 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
38717a5d18cb192d48cb28b5fb4aa3280d046165

Restructure the main interface

nndevenish committed 9 years ago
Unverified
23f18c2cd7701904730f07146f99eb0335ee7436

Remove SubstringWithRange extension

nndevenish committed 9 years ago
Unverified
c6f8d32e5e07bdb2dea1973d3830eb9d5b9646e8

Rename Regex -> SVGRegex

nndevenish committed 9 years ago
Unverified
ce72ff8d5e9073a379a7bf395cd7bdfedd7f0154

More cleaning

nndevenish committed 9 years ago
Unverified
3ca61514a552065d152027c9549a52d0213aedf0

Make much of the interface and extensions private

nndevenish committed 9 years ago
Unverified
ba2f1e6bde54a17f05600d90b5ebd1093c87dff3

Add a routine to draw a specific subelement to a sized context

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)
}