Giter Club home page Giter Club logo

svgkit's Introduction

SVGKit

SVGKit is a Cocoa framework for rendering SVG files natively: it's fast and powerful. Some additional info and links are on the wiki

Versions:

Latest info at: https://github.com/SVGKit/SVGKit/wiki/Versions

  • v3.x = current "in development" branch with latest changes, fixes, features
    • NB: this is now automatically selected in GitHub as the "default" branch when you visit SVGKit's project page

Getting Started

Run the Demo - iOS

  1. Open up "Demo-iOS.xcodeproj", and run it (on simulator or device). Try different SVG's. Zoom, pan, and (with the Monkey only:) hit the "Animate" button. Tap the images to see bounding-boxes / hit dectection (might need you to hit the Debug button first)
  2. If you have ANY problems building the library and embedding it in your app, compare your build settings to the Demo-iOS build settings - if something's different, it's probably the problem.

Installation (add SVGKit to your app)

You have 3 main options for installing SVGKit:

  1. Drag/drop the .framework file into your project <-- PREFERRED / RECOMMENDED
  2. Use CocoaPods
  3. Use Carthage
  4. Drag/drop the static library into your project, and configure the build settings in your project
  5. Use Swift Package Manager

NB: the "static library" is our backwards-compatible, manual install that always works if you have problems with CocoaPods/Carthage/Framework.

OPTION 1: Use the Framework - drag, drop, done!

  1. Open "SVGKit-iOS.xcodeproj"
  2. Build the project once
  3. In Project Navigator, expand the Products folder
  4. Drag/drop SVGKit.framework into your app-project

NB: Frameworks are the preferred way to use libraries in Xcode. But this is a new feature, it might have bugs. If you have ANY problems, please create an Issue, but also try the Static Library method below

You MAY also need to manually add the following Apple Frameworks to your app:

  • CoreText
  • CoreImage
  • libxml2.dylib
  • QuartzCore
  • CoreGraphics
  • UIKit

You MAY also need to add the following 3rd party Frameworks to your app (included with SVGKit):

  • CocoaLumberjack (in the SVGKit-iOS project, select the "3rd-party-frameworks" folder, and drag/drop whichever versions you need: iOS, tvOS, etc) Remember to embed the library too (should show under Target -> General -> Embedded Binaries)

OPTION 2: Using CocoaPods

CocoaPods is a dependency manager for CocoaTouch. To do CocoaPods, adding the following in your podfile:

pod 'SVGKit'

It is also recommended that you setup your podfile to get SVGKit from the latest branch (October 2018: currently 3.x).

pod 'SVGKit', :git => 'https://github.com/SVGKit/SVGKit.git', :branch => '3.x'

OPTION 3: Using Carthage

Carthage is a decentralized dependency manager for Cocoa. To use Carthage, adding the following in your Cartfile:

github "SVGKit/SVGKit"

It is also recommended that you setup your Cartfile to get SVGKit from the current version (October 2018: 3.x branch).

github "SVGKit/SVGKit" "3.x"

OPTION 4: Build the static library

We have a build script that automatically builds ALL versions of the library at once, and ships them as a single file: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4/3647187#3647187

It's all setup already, all you need to do is:

  1. Open "SVGKit-iOS.xcodeproj", switch to "SVGKit-iOS" target and Build it (cmd-B)
  2. in left navbar, scroll to bottom, and open the "Products" section
  3. right click the library ("libSVGKitBLAHBLAH.a") and select "show in finder"
  4. GO UP ONE FOLDER
  5. select the "Debug-universal" (or Release-universal if you were building in Release mode) folder
  6. Drag/drop the .a file and the "usr" folder into your project (select the "Copy files" checkbox)
  7. In Build Settings, select "Other Linker Flags" and add "-ObjC"
  8. Edit your build settings and set "C/C++ Compiler Version" = "LLVM Compiler 2.0"
  9. Add ALL the frameworks and 3rd party libraries listed below (go to "Build Phases", and "Link Binary with Libraries"):
  • CoreText
  • CoreImage
  • libxml2.dylib
  • QuartzCore
  • CoreGraphics
  • UIKit

Everything else is automatic.

OPTION 5: Using Swift Package Manager

In XCode go to File -> Add Packages... and provide URL to this repository in the search bar. Choose Dependency Role and select apropriate project.

Usage - OS X

Added in version 2.1.0 / Autumn 2018: support for macOS.

You can use nearly the same API like iOS. Including SVGKFastImageView, SVGKLayeredImageView, and you can use SVGKImage.NSImage to export SVG layer to bitmap image.

We also provide a macOS demo for SVGKit. To run the Demo, open Demo-OSX.xcodeproj and built to run. You can browser the different SVG files using those two different type of view to check the compatibility.

Recipes for using the library

Here are some old posts (some of these APIs have changed slightly since they were written) on using SVGKit, with advice on which methods to use and why:

svgkit's People

Contributors

adamgit avatar alexandre-g avatar avinashdongarwar avatar couloirr avatar dblandin avatar dgileadi avatar dreampiggy avatar edave avatar greghe avatar jeehut avatar johnwong avatar karimhm avatar maddthesane avatar meric avatar notjosh avatar rawrmaan avatar requilence avatar rhcad avatar sciutand avatar seltzered avatar simon-zeng avatar spromicky avatar stephenhouser avatar stich avatar sweetmandm avatar tsaizhenling avatar victorsosa avatar vitalii-tym avatar xlc avatar ziloongyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

svgkit's Issues

How to use SVGKit with iOS when loading svg from URL

Hi,

I am new in iOS and I am trying to use SVGKit to render svg files in my app. I want to load the svg files from URL, but I couldn't get that working. I get the following error:
Thread 1: EXC_BAD_Access (code = 2, address =0x0)
on the following line: NSLog(@"[%@] SVGKit Parse error: %@", [self class], *error); in the SVGDocument.m file.
I tried to implement loading a file from URL by using the already existing SVGPad sample, which works perfectly and loads the pictures but not from URL. I used this code to load the pictures from URL:

NSString urlString = [NSString stringWithFormat:@"http://upload.wikimedia.org/wikipedia/commons/6/66/Blank_Map-Africa.svg"];
NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
SVGDocument
svgDocument = [SVGDocument documentFromURL:url];
self.contentView = [[[SVGView alloc] initWithDocument:svgDocument] autorelease];

Also I tried to create and my simple app that loads just ten a simple picture from local file by using the following code:

SecondViewController *vc = [[SecondViewController alloc] init];
NSString* svgFilename = [@"/Users/XCode Projects/SVGLink/Beastie" stringByAppendingPathExtension:@"svg"];
SVGDocument *svgDocument = [SVGDocument documentWithContentsOfFile:svgFilename];
 vc.view = [[SVGView alloc] initWithDocument:svgDocument];
[self.window setRootViewController:vc];

All I got is this error: [SVGDocument] DEBUG INFO: set document viewBox = {{0, 0}, {340.961, 377.75}}

Can somebody explain me where do I make the error?

Thanks,
Lily

License?

Under which license is the code in this project released?

[sierra117::/Users/Shared/SourceCache/External/Mac/Libraries] $ ack -ai license SVGKit/

[sierra117::/Users/Shared/SourceCache/External/Mac/Libraries] $

Use of undeclared identifier '_stringValue'

Hi, I appologise in advance if this is a wrong place to ask this kind of dumm questions. I'm trying to build the demo example of svgkit but there is an error in SVGElement.m on line 158(and on 400 but i guess they are related) that says that _stringValue is undeclared, I'm three days into ios development and have no idea how to fix it. Thank you for your time.

Ability to handle SVG links; some kind of target-action hook?

I'm looking for the ability to define target-action links from SVG elements inside an SVG document. Does this framework support that? I'm guessing no, since I didn't see a class for the link element, as there are for circles and other shapes/markup.

I'm new to SVG and SVGKit, although familiar with iOS Development.

If anyone has an example of doing this with SVGKit, or a fork they can point me to, that would be much appreciated.

CocoaPods

Hi, I took the liberty of creating a Podspec for your great library, SVGKit.

Please review it here: CocoaPods/Specs#228

Let me know if there's any problem.

Thanks for your great open-source contribution!

adam branch : can't compile because of CALayerExporter errors.

Hi,
I've cloned the adamgit branch.
But when I'm opening the SVGKit-iOS project, compilation failed becaus of errors in CALayerExporter.h.

Theses errors are strange :
@Property (readwrite,nonatomic,retain) UIView* rootView; => unknown type name UIView

So, I found solution : got to add theses two lines :

import "UIKit/UIKit.h"

import "QuartzCore/QuartzCore.h"

Why ?
Thxs

ARC Compatibility

Hi,

I download to try SVGKit and i found have not compatibility with iOS 5 with ARC.

Will be compatible in a near future?

Thanks!
Manu

How to resize rendered SVG UIView?

I could render the SVG image but i can not resize it to Screen size ? How to resize SVGDocumentView (UIView) ?

Have anyone tried this before? Do you have any solution for this problem?

I'm so fed up now.. Please help me if you can.

Thank you..

SVG format issues

Hi, i have strange issue with svg files created in Illustrator 5. Some of them does not opened at all. Some of them open wrong way ( no text ).
Could you please give recommendation of how to create svg right way. What is the major requirements of SVGKit concerning sag files format ?
By the way , is it possible to render text as vektors ?

Thank you in advanced.

Disable rasterizing when using transforms

In my application i have to use transforms instead of setting the size of the frames/bounds

I was able to do this fine in the previous version.

is there a way to switch off the rasterizing/or rasterise after transform for 2013base?

Steps to Compile on iOS with XCode 4.2.1

Oddly, the sample XCode projects included in the distribution compiled flawlessly on my machine, yet I had difficulty compiling an independent project using the library. It took some time to figure out the solution, so I'm documenting it here in case others have difficulty. The solution ended up being:

(1) Adding the following import call to the top of the file CALayerExporter.m:

#import <QuartzCore/QuartzCore.h>

And the following steps that are documented elsewhere, with minor changes to search paths according to the latest SDK:

(1) Add to following to Header Search Paths (NOT "User Header Search Paths") on the Build Settings Page:

/usr/include/libxml2

(2) Turn off Automatic Reference Counting on the Build Settings Page.

(3) Set "Missing Function Prototypes" to "No" on the Build Settings Page.

(4) Add the QuartzCore.framework and libxml2.dylib

parse from a NSString?

Not really an issue, but more of a question, how could one parse an svg file that is stored in memory within an xml string (NSString). At the moment, in order to use SVGKit with svg files downloaded over the internet, I would have to save the xml string to file first, then load from disk? Is that correct? I don't see something like an -initWithString:(NSString *)xmlString in the SVGDocument class.

Transformations

Transformations aren't commutative and I think you may be handling them in the wrong order. I am trying to get some D3 SVGs to render. I am modifying until it works, once it works may I send you proposed changes?

(I don't ever really send 'issues' on this thing, lol)

Major parser bug - buffer overflow in SVGPathElement

Line 134: "accum[accumIdx++] = c;"

There is NOTHING to stop accumIdx from going way over the bounds of the array.

The array is only 16 characters long, and it's easy to find SVG files that will cause that to overflow :(.

Expect app crashes and other horrors ... (I found this because the overflow overwrote the string-length mem location, and eventualy the app wrote to unavailable mem and crashed with EXC_BAD_ACCESS)

SVG text elelment

Hi..

its can't rendering my svgtext within my svg file.

please give me any solution for rendering text element of svg.

Resizing SVGs

Is there a way to resize the SVG that is displayed via SVGKit?

I've tried displaying on iOS through SVGView/SVGDocumentView, but they don't seem to respond to frame/bounds changes.

I'm guessing this is because it is added directly as a CALayer and the SVGView doesn't resize its sublayers?

Please let me know if you can provide any insight.

Cannot remove Observer for key 'size' (if any one know please help)

'Cannot remove an observer <SVGKFastImageView 0x18f974e0> for the key path "size" from <SVGKImage 0x171579f0> because it is not registered as an observer.'

I have not used any addition of observer in my code. this is in kit . Please help me how to get rid this issue because xcode is giving me nothing.

thanks

How to highlight an area in SVGKit?

Hi,

I posted a question here a few days ago:
http://stackoverflow.com/questions/13928800/geographical-maps-with-svgkit

In between I got my hands dirty trying to use CALayer and CAShapeLayer objects in order to understand how these works.
Things have become a bit clearer, but I still am with the main problem unsolved.

How can I highlight a specific area in a map (SVG file) ?
I know this area is identified by: [svgView.document layerWithIdentifier:@"myLayerID"]

I suppose I need to set the proper mask (CAShapeLayer). But how do I set it?
SVGKit probably has some API to make this easy. Am I wrong?

My experience with SVGKit is basically zero. Except for what I just mentioned.

Thanks in advance.

Preloading a large amount of SVGs

Hi!

I am using SVGKit and love it. As I build my app I added more and more SVGs and loading a UIView with them takes a while now. Is there a way to make them render as they show on the screen or some how cache them once I used the files in one view?

Thanks for a great lib.

Build success but missing headers

I've already opened issue on reklis's fork before and had no luck building.

I told my friend to try and he gets the same result as me.

Both of us followed REDME on this page.

Both of us use XCode 4.5.1.

He gets "build" folder in derived data folder, I get "build" folder in project root folder.

Bot of us get .a library file and usr/.... with headers.

After copying .a and .h files to the new project and importing SVGDocument.h, error appears on missing header "SVGStyleCatcher.h".

I looks like this header is slipping somewhere in building process (this happens on both computers, mine and my friend's).

SVG crashes app

Hi guys, we have an SVG that we're trying to use with the 2013 branch that crashes the demo app. Can you guys see what you think is wrong with it? I'm trying to figure it out but I thought I'd send it over to see what you thought.

https://dl.dropbox.com/u/14879894/sprite.svg

Thanks,
Justin

Interface Builder support

Have SVGKFastImageView support Interface Builder, instead of:

WARNING: you have initialized an SVGKImageView with a blank image (nil). Possibly because you're using Storyboards or NIBs which Apple won't allow us to decorate. Make sure you assign an SVGKImage to the .image property!

Exception thrown in SVGGroupElement.m

We are seeing an exception thrown in SVGGroupElement.m :: layoutLayer. The last line is throwing an exception because the layer position from mainRect is (inf, inf). I've uploaded the image to http://relium.com/junk/testbad1.svg. The code is:

NSString *path = [[NSBundle mainBundle] pathForResource:@"testbad1.svg" ofType:nil];
SVGDocument *doc = [SVGDocument documentWithContentsOfFile:path];
if ( doc == nil )
{
    NSLog( @"no doc for %@", path );
    return;
}

SVGView *v = [[SVGView alloc] initWithDocument:doc];  // <---- exception thrown here

SVGKLayeredImageView on retina display

Hi,
I tried to use SVGKLayeredImageView, but rendered image is not smooth on retina display.
Does SVGKLayeredImageView support retina display?

And I added following code to newLayer method in SVGGElement.m, SVGSVGElement.m, SVGGroupElement.m and SVGShapeElement.m,
the image looks smooth.

_layer.contentsScale = [[UIScreen mainScreen] scale];
_layer.rasterizationScale = _layer.contentsScale;

Thanks,

Drawing directly to a CGContext without using UIView or CALayer

I am working on an app that renders shapes, lines, custom drawings into a single view (pretty much like a canvas). I am looking for a library to help me out with rendering SVGs on that same single view.

SVGKit enables me to do that by instantiating a view, so I can render that view's layer to an image or directly to my canvas. But I want to avoid having more than one view in my entire project, so I can use less memory space (I was having trouble on iPad retina having a view for each object on my canvas).

How can I use only the drawing logic of SCGKit without allocating a view or calayer for every SVG I want to render?

Getting started instructions are wrong for iOS

Instructions say: "drag/drop the iOS and Core folders to your project"

There are additional REQUIRED instructions:

  1. you MUST edit "Header Search Paths" and add /usr/share/include/libxml2
  2. you MUST edit the Build Phases, and add to the Libraries phase: libxml2

Additionally, the current git repos won't build even when you've done that because of a const-error. I'm not sure why the SVGPad example compiles OK with this - I guess you ALSO MUST change the compiler settings to suppress this (which by default is an ERROR in current Xcode):

"SVGKit/Core/SVGUtils.m:164: error: initializer element is not constant"

..NB: variations on that cause over TWO HUNDRED build errors on a new empty iPad project which has merely had SVGKit added to it!

Conversion to CGPathRef?

Hi,

I have several very simple svg files (one shape per file). I'd like to load these files and convert the shapes into CGPathRefs.

I've looked through the source / samples and I don't see a way to do it directly. Am I missing something?

Thanks!

Demo app crashes on iOS6

Demo-iOS[8012:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unsupported input units in the SVGLength variable passed in for 'x': 0'

Only some examples cause the crash. I haven't gone through all of them.

SVG parsing not working in 2013branch

Hi,

I'm kinda new in SVG.
I've successfully loaded my SVG file with the source code in the master branch. As I needed to resize the SVG, I tried the 2013branch and I can't make it work anymore.

  • First, I had to change the content of my SVG to pass the first issue (invalid coord) (the SVG is W3C compliant)
<polygon fill="none" stroke="rgb(0,255,0)" stroke-width="2px" points="0 0, 0 767, 1023 767, 1023 0" />
=>
<polygon fill="none" stroke="rgb(0,255,0)" stroke-width="2px" points="0,0 767,1023 767,1023" />
  • now I'm stuck with a NSAssert(FALSE) in SVGImageElement.newLayer. Of course, if I comment it, I get another error.

I'm aware that some functionalities are not implemented yet but as I thought that the purpose of the 2013branch was to enable resizing SVGFile, I'm wondering if I'm not doing anything wrong or if I understood correctly.

Note : I'm just adding the SVG view like that :
[cameraImageView addSubview: [[SVGKFastImageView alloc] initWithSVGKImage: [SVGKImage imageWithContentsOfFile:plistPath]]];

Does anyone have some clue ? It seems to be in the content of the SVG file. Does the parser have changed ?
Thx in advance !

Aline

loading svgs asynchronously

I'm having problems loading the svgs asynchronously. My guess is that SVGKit is not designed to parse multiple SVGs asynchronously to begin with.

I did a test on the demo project
I added to MasterViewController.m

- (UIImage*)imageFromView:(UIView *)view
{
    // Create a graphics context with the target size
   // On iOS 4 and later, use UIGraphicsBeginImageContextWithOptions to take the scale into consideration
   // On iOS prior to 4, fall back to use UIGraphicsBeginImageContext
@synchronized (self) {
    CGSize imageSize = [view bounds].size;
    if (NULL != UIGraphicsBeginImageContextWithOptions)
        UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
    else
        UIGraphicsBeginImageContext(imageSize);

    CGContextRef context = UIGraphicsGetCurrentContext();

    // -renderInContext: renders in the coordinate space of the layer,
    // so we must first apply the layer's geometry to the graphics context
    CGContextSaveGState(context);
    // Center the context around the view's anchor point
    CGContextTranslateCTM(context, [view center].x, [view center].y);
    // Apply the view's transform about the anchor point
    CGContextConcatCTM(context, [view transform]);
    // Offset by the portion of the bounds left of and above the anchor point
    CGContextTranslateCTM(context,
                          -[view bounds].size.width * [[view layer] anchorPoint].x,
                          -[view bounds].size.height * [[view layer] anchorPoint].y);

    // Render the layer hierarchy to the current context
    [[view layer] renderInContext:context];

    // Restore the context
    CGContextRestoreGState(context);

    // Retrieve the screenshot image
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return image;
}
}

- (void)renderAll {
dispatch_queue_t renderingQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

for (NSString *name in _sampleNames) {
   // dispatch_async(renderingQueue, ^{ // uncomment this line to perform tasks asynchronously
        SVGKImage *document = [SVGKImage imageNamed:[name stringByAppendingPathExtension:@"svg"]];
        NSLog(@"document: %@",document);
        SVGKFastImageView *imgV = [[SVGKFastImageView alloc]initWithSVGKImage:document];
        UIImage *img = [self imageFromView:imgV]; // and do something else with it
        [imgV release];
  //  }); uncomment this line to perform tasks asynchronously
}
}

they initialise the vector and rasterises them. (removed @"Reinel_compass_rose" because it crashes) (also disabled global caching)

crashes only happen when the tasks are done asynchronously with various exceptions like
*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFString setString:]: Range or index out of bounds'.
or
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This node has no valid SVG tags as ancestor, but it's not an tag, so this is an impossible SVG file'
or
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM removeObjectAtIndex:]: index 2 beyond bounds [0 .. 1]'
and perhaps more i have yet to find

[SVGKImage imageNamed:[name stringByAppendingPathExtension:@"svg"]]; also returns null when performed asynchronously

Document size

document size differs from the size of the view.. anyone knows why this happens? view size is almost 3.57 times than document size..

Conversion to CGPathRef?

Hi,

I have several very simple svg files (one shape per file). I'd like to load these files and convert the shapes into CGPathRefs.

I've looked through the source / samples and I don't see a way to do it directly. Am I missing something?

Thanks!

SVGKit working with Illustrator SVGs?

I've been trying a number of SVG libraries today, in an attempt to get some images rendering in our iOS project. SVGKit seems to handle the Illustrator generated files we have, the most gracefully, but it still seems to be choking on a number of the xml elements in the file (e.g. pgf).

While other libraries are having the same issues, I was just wondering if there are any known issues with Illustrator formats and the SVGKit libraries?

Awesome work and thanks for the contribution to the community. Hopefully I can use it on this occasion, but I'll definitely turn to it in the future.

Memory Leak

If you use SVGKit on a bunch of SVG's it eventually starts leaking.

The worst problem is that gradients cause a huge leak. If you disable gradients the library works for a lot longer but still runs out of memory after loading enough.

Is anyone else aware of this or working on it? In diagnosing the issue I spotted a lot of comments in the same sections of code about the memory issues.

I have a branch that disables gradients:
https://github.com/ddustin/SVGKit

App crashing after (Feb12) commit

I am getting this error when doing scale convert with this image:
https://dl.dropbox.com/u/25433702/svgImageWithProblems.svg

app crashes with this error

2013-02-28 14:12:59.780 MyApp[5512:907] cols, rows: 1, 1 ... scaleConvert: {0.475728, 0.5} ... tilesize: {784, 40}
2013-02-28 14:12:59.784 MyApp[5478:907] [SVGKImage] WARNING: no CALayer tree found, creating a new one (will cache it once generated)
2013-02-28 14:12:59.874 MyApp[5478:907] *** Assertion failure in -[CSSPrimitiveValue getFloatValue:], /Users/user/Documents/XCode/MyApp/SVGKit/Source/DOM classes/Core DOM/CSSPrimitiveValue.m:178
2013-02-28 14:12:59.875 MyApp[5478:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Asked to convert a (19) value to a (5) (couldn't find a valid conversion route). Float (4 d.p.) = 0.0000, String = NaN'
*** First throw call stack:
(0x316443e7 0x394d4963 0x3164429d 0x31f1afa3 0x429273 0x404e7b 0x411b8d 0x41fb47 0x41fd1f 0x41feaf 0x41ff6d 0x4225d7 0x3345cd61 0x3320d315 0x3320c8c3 0x3320c037 0x332030b7 0x33202fe1 0x332029c3 0x332027d5 0x33202639 0x31619941 0x31617c39 0x31617f93 0x3158b23d 0x3158b0c9 0x3514533b 0x334a72b9 0xfa975 0x39901b20)
libc++abi.dylib: terminate called throwing an exception

this happens in all commits after:
(Feb 12)
69aa145

Assertion failure on attached svg...





<inkscape:path-effect
effect="skeletal"
id="path-effect3841" />
<inkscape:path-effect
effect="skeletal"
id="path-effect3845" />
<inkscape:path-effect
effect="skeletal"
id="path-effect3849" />
<inkscape:path-effect
effect="spiro"
id="path-effect3853" />
<inkscape:path-effect
effect="skeletal"
id="path-effect3855" />
<inkscape:path-effect
effect="spiro"
id="path-effect3859" />
<inkscape:path-effect
effect="skeletal"
id="path-effect3861" />














rdf:RDF
<cc:Work
rdf:about="">
dc:formatimage/svg+xml/dc:format
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
dc:title/dc:title
/cc:Work
/rdf:RDF










Load SVG content from memory

i have an app that generates SVG content in memory. I would like to render this content directly from memory.

Right now my only option is to write the content to a temporary file and then load it again.
This is costly for performance.

NSData support

It would be nice if we could initialize an SVGDocument from an NSData rather than requiring a file path or url. We do our own downloading on specific queued threads and don't want SVGKit to download for us. (It's a minor issue, easily worked around)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.