This change includes various error handling methods on all relevant object initializers - also rewrote how we parse floats from strings, this seems to be about 2x quicker at parsing SVG's then it was previously :-)
80 lines
2.2 KiB
Objective-C
80 lines
2.2 KiB
Objective-C
//
|
|
// IJSVGImage.h
|
|
// IconJar
|
|
//
|
|
// Created by Curtis Hard on 30/08/2014.
|
|
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "IJSVGParser.h"
|
|
#import "IJSVGBezierPathAdditions.h"
|
|
|
|
@class IJSVG;
|
|
|
|
@protocol IJSVGDelegate <NSObject,IJSVGParserDelegate>
|
|
|
|
@optional
|
|
- (BOOL)svg:(IJSVG *)svg
|
|
shouldHandleForeignObject:(IJSVGForeignObject *)foreignObject;
|
|
- (void)svg:(IJSVG *)svg
|
|
handleForeignObject:(IJSVGForeignObject *)foreignObject
|
|
document:(NSXMLDocument *)document;
|
|
|
|
@end
|
|
|
|
@interface IJSVG : NSObject <NSPasteboardWriting> {
|
|
|
|
@private
|
|
IJSVGParser * _group;
|
|
CGFloat _scale;
|
|
CGFloat _clipScale;
|
|
NSMutableArray * _colors;
|
|
id<IJSVGDelegate> _delegate;
|
|
|
|
}
|
|
|
|
+ (NSColor *)baseColor;
|
|
- (BOOL)isFont;
|
|
- (NSArray *)glyphs;
|
|
+ (void)setBaseColor:(NSColor *)color;
|
|
+ (id)svgNamed:(NSString *)string;
|
|
+ (id)svgNamed:(NSString *)string
|
|
delegate:(id<IJSVGDelegate>)delegate;
|
|
|
|
- (id)initWithFile:(NSString *)file;
|
|
- (id)initWithFile:(NSString *)file
|
|
error:(NSError **)error;
|
|
- (id)initWithFile:(NSString *)file
|
|
delegate:(id<IJSVGDelegate>)delegate;
|
|
- (id)initWithFile:(NSString *)file
|
|
error:(NSError **)error
|
|
delegate:(id<IJSVGDelegate>)delegate;
|
|
- (id)initWithFilePathURL:(NSURL *)aURL;
|
|
- (id)initWithFilePathURL:(NSURL *)aURL
|
|
error:(NSError **)error;
|
|
- (id)initWithFilePathURL:(NSURL *)aURL
|
|
delegate:(id<IJSVGDelegate>)delegate;
|
|
- (id)initWithFilePathURL:(NSURL *)aURL
|
|
error:(NSError **)error
|
|
delegate:(id<IJSVGDelegate>)delegate;
|
|
- (NSImage *)imageWithSize:(NSSize)aSize;
|
|
- (NSImage *)imageWithSize:(NSSize)aSize
|
|
error:(NSError **)error;
|
|
- (BOOL)drawAtPoint:(NSPoint)point
|
|
size:(NSSize)size;
|
|
- (BOOL)drawAtPoint:(NSPoint)point
|
|
size:(NSSize)aSize
|
|
error:(NSError **)error;
|
|
- (BOOL)drawInRect:(NSRect)rect;
|
|
- (BOOL)drawInRect:(NSRect)rect
|
|
error:(NSError **)error;
|
|
- (NSArray *)colors;
|
|
- (NSData *)PDFData;
|
|
- (NSData *)PDFData:(NSError **)error;
|
|
- (NSData *)PDFDataWithRect:(NSRect)rect;
|
|
- (NSData *)PDFDataWithRect:(NSRect)rect
|
|
error:(NSError **)error;
|
|
|
|
@end
|