diff --git a/.gitmodules b/.gitmodules index bc19b17a7..e69de29bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "calayer-exporter"] - path = calayer-exporter - url = git://github.com/reklis/calayer-exporter.git diff --git a/Core/SVGDefsElement.h b/Core/SVGDefsElement.h deleted file mode 100644 index b7badf44f..000000000 --- a/Core/SVGDefsElement.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// SVGDefsElement.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGElement.h" - -@interface SVGDefsElement : SVGElement { } - -@end diff --git a/Core/SVGDefsElement.m b/Core/SVGDefsElement.m deleted file mode 100644 index 2ae5d1f18..000000000 --- a/Core/SVGDefsElement.m +++ /dev/null @@ -1,12 +0,0 @@ -// -// SVGDefsElement.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGDefsElement.h" - -@implementation SVGDefsElement - -@end diff --git a/Core/SVGDocument+CA.h b/Core/SVGDocument+CA.h deleted file mode 100644 index 50769a046..000000000 --- a/Core/SVGDocument+CA.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// SVGDocument+CA.h -// SVGKit -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -#import "SVGDocument.h" -#import - -@interface SVGDocument (CA) - -- (CALayer *)layerWithIdentifier:(NSString *)identifier; - -- (CALayer *)layerTree; - -- (CALayer *)layerWithIdentifier:(NSString *)identifier layer:(CALayer *)layer; - -- (CALayer *)layerWithElement:(SVGElement < SVGLayeredElement > *)element; - -@end diff --git a/Core/SVGDocument+CA.m b/Core/SVGDocument+CA.m deleted file mode 100644 index 7c9055ede..000000000 --- a/Core/SVGDocument+CA.m +++ /dev/null @@ -1,74 +0,0 @@ -// -// SVGDocument+CA.m -// SVGKit -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -#import "SVGDocument+CA.h" - -#import - -@implementation SVGDocument (CA) - -static const char *kLayerTreeKey = "svgkit.layertree"; - -- (CALayer *)layerWithIdentifier:(NSString *)identifier { - return [self layerWithIdentifier:identifier layer:self.layerTree]; -} - -- (CALayer *)layerWithIdentifier:(NSString *)identifier layer:(CALayer *)layer { - if ([layer.name isEqualToString:identifier]) { - return layer; - } - - for (CALayer *child in layer.sublayers) { - CALayer *resultingLayer = [self layerWithIdentifier:identifier layer:child]; - - if (resultingLayer) - return resultingLayer; - } - - return nil; -} - -- (CALayer *)layerTree { - CALayer *cachedLayerTree = objc_getAssociatedObject(self, (void *) kLayerTreeKey); - - if (!cachedLayerTree) { - cachedLayerTree = [self layerWithElement:self]; - objc_setAssociatedObject(self, (void *) kLayerTreeKey, cachedLayerTree, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - - return cachedLayerTree; -} - -- (CALayer *)layerWithElement:(SVGElement *)element { - CALayer *layer = [element newLayer]; - - if (![element.children count]) { - return layer; - } - - for (SVGElement *child in element.children) { - if ([child conformsToProtocol:@protocol(SVGLayeredElement)]) { - CALayer *sublayer = [self layerWithElement:(id)child]; - - if (!sublayer) { - continue; - } - - [layer addSublayer:sublayer]; - } - } - - if (element != self) { - [element layoutLayer:layer]; - } - - [layer setNeedsDisplay]; - - return layer; -} - -@end diff --git a/Core/SVGDocument.h b/Core/SVGDocument.h deleted file mode 100644 index f019d7f47..000000000 --- a/Core/SVGDocument.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// SVGDocument.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGElement.h" - -#import "SVGGroupElement.h" - -#import "SVGParser.h" - -#if NS_BLOCKS_AVAILABLE -typedef void (^SVGElementAggregationBlock)(SVGElement < SVGLayeredElement > * layeredElement); -#endif - -@class SVGDefsElement; - -@interface SVGDocument : SVGElement < SVGLayeredElement > { -} - -// only absolute widths and heights are supported (no percentages) -@property (nonatomic, readonly) CGFloat width; -@property (nonatomic, readonly) CGFloat height; -@property (nonatomic, readonly, copy) NSString *version; -@property (nonatomic, readonly) CGRect viewBoxFrame; - -// convenience accessors to parsed children -@property (nonatomic, readonly) NSString *title; -@property (nonatomic, readonly) NSString *desc; // 'description' is reserved by NSObject -@property (nonatomic, readonly) SVGDefsElement *defs; - -/*! from the SVG spec, each "g" tag in the XML is a separate "group of graphics things", - * this dictionary contains a mapping from "value of id attribute" to "SVGGroupElement" - * - * see also: anonymousGraphicsGroups (for groups that have no "id=" attribute) - */ -@property (nonatomic, retain) NSDictionary *graphicsGroups; -/*! from the SVG spec, each "g" tag in the XML is a separate "group of graphics things", - * this array contains all the groups that had no "id=" attribute - * - * see also: graphicsGroups (for groups that have an "id=" attribute) - */ -@property (nonatomic, retain) NSArray *anonymousGraphicsGroups; - -+ (void) addSVGParserExtension:(NSObject*) extension; -+ (id)documentNamed:(NSString *)name; // 'name' in mainBundle -+ (id)documentFromURL:(NSURL *)url; -+ (id)documentWithContentsOfFile:(NSString *)aPath; - -- (id)initWithContentsOfFile:(NSString *)aPath; -- (id)initWithFrame:(CGRect)frame; - -#if NS_BLOCKS_AVAILABLE - -- (void) applyAggregator:(SVGElementAggregationBlock)aggregator; - -#endif - -@end diff --git a/Core/SVGDocument.m b/Core/SVGDocument.m deleted file mode 100644 index 545b76fbc..000000000 --- a/Core/SVGDocument.m +++ /dev/null @@ -1,282 +0,0 @@ -// -// SVGDocument.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGDocument.h" - -#import "SVGDefsElement.h" -#import "SVGDescriptionElement.h" -#import "SVGElement+Private.h" -#import "SVGParser.h" -#import "SVGTitleElement.h" -#import "SVGPathElement.h" - -#import "SVGParserSVG.h" - -@interface SVGDocument () - -@property (nonatomic, copy) NSString *version; - -/*! Only preserved for temporary backwards compatibility */ -- (BOOL)parseFileAtPath:(NSString *)aPath; -/*! Only preserved for temporary backwards compatibility */ --(BOOL)parseFileAtURL:(NSURL *)url; - -- (BOOL)parseFileAtPath:(NSString *)aPath error:(NSError**) error; -- (BOOL)parseFileAtURL:(NSURL *)url error:(NSError**) error; - -- (SVGElement *)findFirstElementOfClass:(Class)class; - -@end - - -@implementation SVGDocument - -@synthesize width = _width; -@synthesize height = _height; -@synthesize version = _version; -@synthesize viewBoxFrame = _viewBoxFrame; - -@synthesize graphicsGroups, anonymousGraphicsGroups; - -@dynamic title, desc, defs; - -static NSMutableArray* _parserExtensions; -+ (void) addSVGParserExtension:(NSObject*) extension -{ - if( _parserExtensions == nil ) - { - _parserExtensions = [NSMutableArray new]; - } - - [_parserExtensions addObject:extension]; -} - -/* TODO: parse 'viewBox' */ - -+ (id)documentNamed:(NSString *)name { - NSParameterAssert(name != nil); - - NSBundle *bundle = [NSBundle mainBundle]; - - if (!bundle) - return nil; - - NSString *newName = [name stringByDeletingPathExtension]; - NSString *extension = [name pathExtension]; - if ([@"" isEqualToString:extension]) { - extension = @"svg"; - } - - NSString *path = [bundle pathForResource:newName ofType:extension]; - - if (!path) - { - NSLog(@"[%@] MISSING FILE, COULD NOT CREATE DOCUMENT: filename = %@, extension = %@", [self class], newName, extension); - return nil; - } - - return [self documentWithContentsOfFile:path]; -} - -+ (id)documentFromURL:(NSURL *)url { - NSParameterAssert(url != nil); - - return [[[[self class] alloc] initWithContentsOfURL:url] autorelease]; -} - -+ (id)documentWithContentsOfFile:(NSString *)aPath { - return [[[[self class] alloc] initWithContentsOfFile:aPath] autorelease]; -} - -- (id)initWithContentsOfFile:(NSString *)aPath { - NSParameterAssert(aPath != nil); - - self = [super initWithDocument:self name:@"svg"]; - if (self) { - _width = _height = 100; - - NSError* parseError = nil; - if (![self parseFileAtPath:aPath error:&parseError]) { - NSLog(@"[%@] MISSING OR CORRUPT FILE, OR FILE USES FEATURES THAT SVGKit DOES NOT YET SUPPORT, COULD NOT CREATE DOCUMENT: path = %@, error = %@", [self class], aPath, parseError); - - [self release]; - return nil; - } - } - return self; -} - -- (id)initWithContentsOfURL:(NSURL *)url { - NSParameterAssert(url != nil); - - self = [super initWithDocument:self name:@"svg"]; - if (self) { - _width = _height = 100; - - if (![self parseFileAtURL:url]) { - NSLog(@"[%@] ERROR: COULD NOT FIND SVG AT URL = %@", [self class], url); - - [self release]; - return nil; - } - } - return self; -} - -- (id) initWithFrame:(CGRect)frame -{ - self = [super initWithDocument:self name:@"svg"]; - if (self) { - _width = CGRectGetWidth(frame); - _height = CGRectGetHeight(frame); - } - return self; -} - -- (void)dealloc { - [_version release]; - self.graphicsGroups = nil; - self.anonymousGraphicsGroups = nil; - [super dealloc]; -} - -- (BOOL)parseFileAtPath:(NSString *)aPath error:(NSError**) error { - SVGParser *parser = [[SVGParser alloc] initWithPath:aPath document:self]; - SVGParserSVG *subParserSVG = [[[SVGParserSVG alloc] init] autorelease]; - [parser.parserExtensions addObject:subParserSVG]; - for( NSObject* extension in _parserExtensions ) - { - [parser.parserExtensions addObject:extension]; - } - - if (![parser parse:error]) { - NSLog(@"[%@] SVGKit Parse error: %@", [self class], *error); - [parser release]; - - return NO; - } - - [parser release]; - - return YES; -} - -- (BOOL)parseFileAtPath:(NSString *)aPath { - return [self parseFileAtPath:aPath error:nil]; -} - - --(BOOL)parseFileAtURL:(NSURL *)url error:(NSError**) error { - SVGParser *parser = [[SVGParser alloc] initWithURL:url document:self]; - SVGParserSVG *subParserSVG = [[[SVGParserSVG alloc] init] autorelease]; - [parser.parserExtensions addObject:subParserSVG]; - for( NSObject* extension in _parserExtensions ) - { - [parser.parserExtensions addObject:extension]; - } - - if (![parser parse:error]) { - NSLog(@"[%@] SVGKit Parse error: %@", [self class], *error); - [parser release]; - - return NO; - } - - [parser release]; - - return YES; -} - --(BOOL)parseFileAtURL:(NSURL *)url { - return [self parseFileAtURL:url error:nil]; -} - -- (CALayer *)newLayer { - - CALayer* _layer = [CALayer layer]; - _layer.frame = CGRectMake(0.0f, 0.0f, _width, _height); - - return _layer; -} - -- (void)layoutLayer:(CALayer *)layer { } - -- (SVGElement *)findFirstElementOfClass:(Class)class { - for (SVGElement *element in self.children) { - if ([element isKindOfClass:class]) - return element; - } - - return nil; -} - -- (NSString *)title { - return [self findFirstElementOfClass:[SVGTitleElement class]].stringValue; -} - -- (NSString *)desc { - return [self findFirstElementOfClass:[SVGDescriptionElement class]].stringValue; -} - -- (SVGDefsElement *)defs { - return (SVGDefsElement *) [self findFirstElementOfClass:[SVGDefsElement class]]; -} - -- (void)parseAttributes:(NSDictionary *)attributes { - [super parseAttributes:attributes]; - - id value = nil; - - if ((value = [attributes objectForKey:@"width"])) { - _width = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"height"])) { - _height = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"version"])) { - self.version = value; - } - - if( (value = [attributes objectForKey:@"viewBox"])) { - NSArray* boxElements = [(NSString*) value componentsSeparatedByString:@" "]; - - _viewBoxFrame = CGRectMake([[boxElements objectAtIndex:0] floatValue], [[boxElements objectAtIndex:1] floatValue], [[boxElements objectAtIndex:2] floatValue], [[boxElements objectAtIndex:3] floatValue]); - NSLog(@"[%@] DEBUG INFO: set document viewBox = %@", [self class], NSStringFromCGRect(self.viewBoxFrame)); - } -} - -#if NS_BLOCKS_AVAILABLE - -- (void) applyAggregator:(SVGElementAggregationBlock)aggregator toElement:(SVGElement < SVGLayeredElement > *)element -{ - if (![element.children count]) { - return; - } - - for (SVGElement *child in element.children) { - if ([child conformsToProtocol:@protocol(SVGLayeredElement)]) { - SVGElement* layeredElement = (SVGElement*)child; - if (layeredElement) { - aggregator(layeredElement); - - [self applyAggregator:aggregator - toElement:layeredElement]; - } - } - } -} - -- (void) applyAggregator:(SVGElementAggregationBlock)aggregator -{ - [self applyAggregator:aggregator toElement:self]; -} - -#endif - -@end diff --git a/Core/SVGElement+Private.h b/Core/SVGElement+Private.h deleted file mode 100644 index 30a18c0c3..000000000 --- a/Core/SVGElement+Private.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SVGElement+Private.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGElement.h" - -@interface SVGElement (Private) - -- (void)parseAttributes:(NSDictionary *)attributes; -- (void)addChild:(SVGElement *)element; -- (void)parseContent:(NSString *)content; - -@end diff --git a/Core/SVGElement.h b/Core/SVGElement.h deleted file mode 100644 index 5af720579..000000000 --- a/Core/SVGElement.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// SVGElement.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import - -@class SVGDocument; - -#define EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES 1 - -@interface SVGElement : NSObject { - @private - NSMutableArray *_children; -} - -/*! This is used when generating CALayer objects, to store the id of the SVGElement that created the CALayer */ -#define kSVGElementIdentifier @"SVGElementIdentifier" - -#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR -@property (nonatomic, readonly) SVGDocument *document; -#else -@property (nonatomic, readonly) __weak SVGDocument *document; -#endif - -@property (nonatomic, readonly) NSArray *children; -@property (nonatomic, readonly, copy) NSString *stringValue; -@property (nonatomic, readonly) NSString *localName; - -@property (nonatomic, readwrite, retain) NSString *identifier; // 'id' is reserved - -@property (nonatomic, retain) NSMutableArray* metadataChildren; - -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES -/*! Transform to be applied to this node and all sub-nodes; does NOT take account of any transforms applied by parent / ancestor nodes */ -@property (nonatomic) CGAffineTransform transformRelative; -/*! Required by SVG transform and SVG viewbox: you have to be able to query your parent nodes at all times to find out your actual values */ -@property (nonatomic, retain) SVGElement *parent; -#endif - -+ (BOOL)shouldStoreContent; // to optimize parser, default is NO - -- (id)initWithDocument:(SVGDocument *)aDocument name:(NSString *)name; - -- (void)loadDefaults; // should be overriden to set element defaults - -/*! Parser uses this to add non-rendering-SVG XML tags to the element they were embedded in */ -- (void) addMetadataChild:(NSObject*) child; - -/*! Overridden by sub-classes. Be sure to call [super parseAttributes:attributes]; */ -- (void)parseAttributes:(NSDictionary *)attributes; - -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES -/*! Re-calculates the absolute transform on-demand by querying parent's absolute transform and appending self's relative transform */ --(CGAffineTransform) transformAbsolute; -#endif - -@end - -@protocol SVGLayeredElement < NSObject > - -/*! - NB: the returned layer has - as its "name" property - the "identifier" property of the SVGElement that created it; - but that can be overwritten by applications (for valid reasons), so we ADDITIONALLY store the identifier into a - custom key - kSVGElementIdentifier - on the CALayer. Because it's a custom key, it's (almost) guaranteed not to be - overwritten / altered by other application code - */ -- (CALayer *)newLayer; -- (void)layoutLayer:(CALayer *)layer; - -@end diff --git a/Core/SVGElement.m b/Core/SVGElement.m deleted file mode 100644 index 62b88d264..000000000 --- a/Core/SVGElement.m +++ /dev/null @@ -1,192 +0,0 @@ -// -// SVGElement.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGElement.h" - -@interface SVGElement () - -@property (nonatomic, copy) NSString *stringValue; - -@end - -/*! main class implementation for the base SVGElement: NOTE: in practice, most of the interesting - stuff happens in subclasses, e.g.: - - SVGShapeElement - SVGGroupElement - SVGImageElement - SVGLineElement - SVGPathElement - ...etc - */ -@implementation SVGElement - -@synthesize document = _document; - -@synthesize children = _children; -@synthesize stringValue = _stringValue; -@synthesize localName = _localName; - -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES -@synthesize parent = _parent; -@synthesize transformRelative = _transformRelative; -#endif - -@synthesize identifier = _identifier; - -@synthesize metadataChildren; - -+ (BOOL)shouldStoreContent { - return NO; -} - -- (id)init { - self = [super init]; - if (self) { - [self loadDefaults]; - _children = [[NSMutableArray alloc] init]; -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES - self.transformRelative = CGAffineTransformIdentity; -#endif - self.metadataChildren = [NSMutableArray array]; - } - return self; -} - -- (id)initWithDocument:(SVGDocument *)aDocument name:(NSString *)name { - self = [self init]; - if (self) { - _document = aDocument; - _localName = [name retain]; -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES - self.transformRelative = CGAffineTransformIdentity; -#endif - } - return self; -} - -- (void)dealloc { - self.metadataChildren = nil; - [_children release]; - [_stringValue release]; - [_localName release]; - [_identifier release]; - - [super dealloc]; -} - -- (void)loadDefaults { - // to be overriden by subclasses -} - -- (void)addChild:(SVGElement *)element { - [_children addObject:element]; -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES - element.parent = self; -#endif -} - --(void) addMetadataChild:(NSObject*) child -{ - [self.metadataChildren addObject:child]; -} - -- (void)parseAttributes:(NSDictionary *)attributes { - // to be overriden by subclasses - // make sure super implementation is called - - id value = nil; - - if ((value = [attributes objectForKey:@"id"])) { - _identifier = [value copy]; - } - -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES - /** - http://www.w3.org/TR/SVG/coords.html#TransformAttribute - - The available types of transform definitions include: - - * matrix( ), which specifies a transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f]. - - * translate( []), which specifies a translation by tx and ty. If is not provided, it is assumed to be zero. - - * scale( []), which specifies a scale operation by sx and sy. If is not provided, it is assumed to be equal to . - - * rotate( [ ]), which specifies a rotation by degrees about a given point. - If optional parameters and are not supplied, the rotate is about the origin of the current user coordinate system. The operation corresponds to the matrix [cos(a) sin(a) -sin(a) cos(a) 0 0]. - If optional parameters and are supplied, the rotate is about the point (cx, cy). The operation represents the equivalent of the following specification: translate(, ) rotate() translate(-, -). - - * skewX(), which specifies a skew transformation along the x-axis. - - * skewY(), which specifies a skew transformation along the y-axis. - */ - if( (value = [attributes objectForKey:@"transform"]) ) - { - /** - http://www.w3.org/TR/SVG/coords.html#TransformAttribute - - The individual transform definitions are separated by whitespace and/or a comma. - */ - - NSError* error = nil; - NSRegularExpression* regexpTransformListItem = [NSRegularExpression regularExpressionWithPattern:@"[^\\(,]*\\([^\\)]*\\)" options:0 error:&error]; - - [regexpTransformListItem enumerateMatchesInString:value options:0 range:NSMakeRange(0, [value length]) usingBlock: - ^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) - { - NSString* transformString = [value substringWithRange:[result range]]; - - NSRange loc = [transformString rangeOfString:@"("]; - if( loc.length == 0 ) - { - NSLog(@"[%@] ERROR: input file is illegal, has an item in the SVG transform attribute which has no open-bracket. Item = %@, transform attribute value = %@", [self class], transformString, value ); - return; - } - NSString* command = [transformString substringToIndex:loc.location]; - NSArray* parameterStrings = [[transformString substringFromIndex:loc.location+1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]]; - - if( [command isEqualToString:@"translate"] ) - { - CGFloat xtrans = [(NSString*)[parameterStrings objectAtIndex:0] floatValue]; - CGFloat ytrans = [parameterStrings count] > 1 ? [(NSString*)[parameterStrings objectAtIndex:1] floatValue] : 0.0; - - CGAffineTransform nt = CGAffineTransformMakeTranslation(xtrans, ytrans); - self.transformRelative = CGAffineTransformConcat( self.transformRelative, nt ); - - } - }]; - - NSLog(@"[%@] Set local / relative transform = (%2.2f, %2.2f // %2.2f, %2.2f) + (%2.2f, %2.2f translate)", [self class], self.transformRelative.a, self.transformRelative.b, self.transformRelative.c, self.transformRelative.d, self.transformRelative.tx, self.transformRelative.ty ); - } -#endif -} - -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES --(CGAffineTransform) transformAbsolute -{ - if( self.parent == nil ) - return self.transformRelative; - else - { - CGAffineTransform inheritedTransform = [self.parent transformAbsolute]; - - return CGAffineTransformConcat( inheritedTransform, self.transformRelative ); - } -} -#endif - -- (void)parseContent:(NSString *)content { - self.stringValue = content; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"<%@ %p | id=%@ | localName=%@ | stringValue=%@ | children=%d>", - [self class], self, _identifier, _localName, _stringValue, [_children count]]; -} - -@end diff --git a/Core/SVGEllipseElement.m b/Core/SVGEllipseElement.m deleted file mode 100644 index 2b78cee76..000000000 --- a/Core/SVGEllipseElement.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// SVGEllipseElement.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGEllipseElement.h" - -#import "SVGElement+Private.h" -#import "SVGShapeElement+Private.h" - -@implementation SVGEllipseElement - -@synthesize cx = _cx; -@synthesize cy = _cy; -@synthesize rx = _rx; -@synthesize ry = _ry; - -- (void)parseAttributes:(NSDictionary *)attributes { - [super parseAttributes:attributes]; - - id value = nil; - - if ((value = [attributes objectForKey:@"cx"])) { - _cx = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"cy"])) { - _cy = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"rx"])) { - _rx = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"ry"])) { - _ry = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"r"])) { // circle - _rx = [value floatValue]; - _ry = _rx; - } - - CGMutablePathRef path = CGPathCreateMutable(); - CGPathAddEllipseInRect(path, NULL, CGRectMake(_cx - _rx, _cy - _ry, _rx * 2, _ry * 2)); - - [self loadPath:path]; - CGPathRelease(path); -} - -@end diff --git a/Core/SVGGroupElement.m b/Core/SVGGroupElement.m deleted file mode 100644 index dcf6872a0..000000000 --- a/Core/SVGGroupElement.m +++ /dev/null @@ -1,82 +0,0 @@ -// -// SVGGroupElement.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGGroupElement.h" - -#import "SVGDocument.h" - -#import "SVGElement+Private.h" -#import "CALayerWithChildHitTest.h" - -@implementation SVGGroupElement - -@synthesize opacity = _opacity; - -- (void)dealloc { - - [super dealloc]; -} - -- (void)loadDefaults { - _opacity = 1.0f; -} - -- (void)parseAttributes:(NSDictionary *)attributes { - [super parseAttributes:attributes]; - - id value = nil; - - if ((value = [attributes objectForKey:@"opacity"])) { - _opacity = [value floatValue]; - } -} - -- (CALayer *)newLayer { - - CALayer* _layer = [CALayerWithChildHitTest layer]; - - _layer.name = self.identifier; - [_layer setValue:self.identifier forKey:kSVGElementIdentifier]; - _layer.opacity = _opacity; - - if ([_layer respondsToSelector:@selector(setShouldRasterize:)]) { - [_layer performSelector:@selector(setShouldRasterize:) - withObject:[NSNumber numberWithBool:YES]]; - } - - return _layer; -} - -- (void)layoutLayer:(CALayer *)layer { - NSArray *sublayers = [layer sublayers]; - CGRect mainRect = CGRectZero; - - for (NSUInteger n = 0; n < [sublayers count]; n++) { - CALayer *currentLayer = [sublayers objectAtIndex:n]; - - if (n == 0) { - mainRect = currentLayer.frame; - } - else { - mainRect = CGRectUnion(mainRect, currentLayer.frame); - } - } - - mainRect = CGRectIntegral(mainRect); // round values to integers - - layer.frame = mainRect; - - for (CALayer *currentLayer in sublayers) { - CGRect frame = currentLayer.frame; - frame.origin.x -= mainRect.origin.x; - frame.origin.y -= mainRect.origin.y; - - currentLayer.frame = CGRectIntegral(frame); - } -} - -@end diff --git a/Core/SVGKit.h b/Core/SVGKit.h deleted file mode 100644 index 68f20142b..000000000 --- a/Core/SVGKit.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// SVGKit.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#include "TargetConditionals.h" - -#if TARGET_OS_IPHONE - #import "SVGCircleElement.h" - #import "SVGDefsElement.h" - #import "SVGDescriptionElement.h" - #import "SVGDocument.h" - #import "SVGDocument+CA.h" - #import "SVGElement.h" - #import "SVGEllipseElement.h" - #import "SVGGroupElement.h" - #import "SVGImageElement.h" - #import "SVGLineElement.h" - #import "SVGPathElement.h" - #import "SVGPolygonElement.h" - #import "SVGPolylineElement.h" - #import "SVGRectElement.h" - #import "SVGShapeElement.h" - #import "SVGTitleElement.h" - #import "SVGUtils.h" - #import "SVGView.h" - #import "SVGPathView.h" - #import "SVGPattern.h" -#else - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import - #import -#endif diff --git a/Core/SVGLineElement.m b/Core/SVGLineElement.m deleted file mode 100644 index 595ed7efc..000000000 --- a/Core/SVGLineElement.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// SVGLineElement.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGLineElement.h" - -#import "SVGElement+Private.h" -#import "SVGShapeElement+Private.h" - -@implementation SVGLineElement - -@synthesize x1 = _x1; -@synthesize y1 = _y1; -@synthesize x2 = _x2; -@synthesize y2 = _y2; - -- (void)parseAttributes:(NSDictionary *)attributes { - [super parseAttributes:attributes]; - - id value = nil; - - if ((value = [attributes objectForKey:@"x1"])) { - _x1 = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"y1"])) { - _y1 = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"x2"])) { - _x2 = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"y2"])) { - _y2 = [value floatValue]; - } - - CGMutablePathRef path = CGPathCreateMutable(); - CGPathMoveToPoint(path, NULL, _x1, _y1); - CGPathAddLineToPoint(path, NULL, _x2, _y2); - - [self loadPath:path]; - CGPathRelease(path); -} - -@end diff --git a/Core/SVGParser.h b/Core/SVGParser.h deleted file mode 100644 index 9becccef2..000000000 --- a/Core/SVGParser.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// SVGParser.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -/*! RECOMMENDED: leave this set to 1 to get warnings about "legal, but poorly written" SVG */ -#define PARSER_WARN_FOR_ANONYMOUS_SVG_G_TAGS 1 - -/*! Verbose parser logging - ONLY needed if you have an SVG file that's failing to load / crashing */ -#define DEBUG_VERBOSE_LOG_EVERY_TAG 0 - -@class SVGDocument; - -@protocol SVGParserExtension - -/*! Array of URI's as NSString's, one string for each XMLnamespace that this parser-extension can parse - * - * e.g. the main parser returns "[NSArray arrayWithObjects:@"http://www.w3.org/2000/svg", nil];" - */ --(NSArray*) supportedNamespaces; - -/*! Array of NSString's, one string for each XML tag (within a supported namespace!) that this parser-extension can parse - * - * e.g. the main parser returns "[NSArray arrayWithObjects:@"svg", @"title", @"defs", @"path", @"line", @"circle", ...etc... , nil];" - */ --(NSArray*) supportedTags; - -- (NSObject*)handleStartElement:(NSString *)name document:(SVGDocument*) document xmlns:(NSString*) namespaceURI attributes:(NSMutableDictionary *)attributes; --(void) addChildObject:(NSObject*)child toObject:(NSObject*)parent inDocument:(SVGDocument*) svgDocument; --(void) parseContent:(NSMutableString*) content forItem:(NSObject*) item; --(BOOL) createdItemShouldStoreContent:(NSObject*) item; - -@end - -@interface SVGParser : NSObject { - @private - NSString *_path; - BOOL _failed; - BOOL _storingChars; - NSMutableString *_storedChars; - NSMutableArray *_elementStack; -#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR - SVGDocument *_document; -#else - __weak SVGDocument *_document; -#endif - NSError* errorForCurrentParse; -} - -@property(nonatomic,retain) NSURL* sourceURL; - -@property(nonatomic,retain) NSMutableArray* parserExtensions; - -@property(nonatomic, retain) NSMutableArray* parseWarnings; - -- (id)initWithPath:(NSString *)aPath document:(SVGDocument *)document; -- (id) initWithURL:(NSURL*)aURL document:(SVGDocument *)document; - -- (BOOL)parse:(NSError **)outError; - -+(NSDictionary *) NSDictionaryFromCSSAttributes: (NSString *)css; - -@end diff --git a/Core/SVGParser.m b/Core/SVGParser.m deleted file mode 100644 index b14d6e0d4..000000000 --- a/Core/SVGParser.m +++ /dev/null @@ -1,514 +0,0 @@ -// -// SVGParser.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGParser.h" - -#import - -#import "SVGDocument.h" - -@interface SVGParserStackItem : NSObject -@property(nonatomic,retain) NSObject* parserForThisItem; -@property(nonatomic,retain) NSObject* item; - -@end - -@implementation SVGParserStackItem -@synthesize item; -@synthesize parserForThisItem; - -- (void) dealloc -{ - self.item = nil; - self.parserForThisItem = nil; - [super dealloc]; -} - -@end - -@implementation SVGParser - -@synthesize sourceURL; -@synthesize parserExtensions; -@synthesize parseWarnings; - -static xmlSAXHandler SAXHandler; - -static void startElementSAX(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes); -static void endElementSAX(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI); -static void charactersFoundSAX(void * ctx, const xmlChar * ch, int len); -static void errorEncounteredSAX(void * ctx, const char * msg, ...); - -static NSString *NSStringFromLibxmlString (const xmlChar *string); -static NSMutableDictionary *NSDictionaryFromLibxmlAttributes (const xmlChar **attrs, int attr_ct); - -#define READ_CHUNK_SZ 1024*10 - -- (id)initWithPath:(NSString *)aPath document:(SVGDocument *)document { - self = [super init]; - if (self) { - self.parseWarnings = [NSMutableArray array]; - self.parserExtensions = [NSMutableArray array]; - _path = [aPath copy]; - self.sourceURL = nil; - _document = document; - _storedChars = [NSMutableString new]; - _elementStack = [NSMutableArray new]; - _failed = NO; - - } - return self; -} - -- (id) initWithURL:(NSURL*)aURL document:(SVGDocument *)document { - self = [super init]; - if( self) { - self.parseWarnings = [NSMutableArray array]; - self.parserExtensions = [NSMutableArray array]; - self.sourceURL = aURL; - _document = document; - _storedChars = [NSMutableString new]; - _elementStack = [NSMutableArray new]; - _failed = NO; - } - - return self; -} - -- (void)dealloc { - [_path release]; - [_storedChars release]; - [_elementStack release]; - self.parserExtensions = nil; - [super dealloc]; -} - -- (BOOL)parse:(NSError **)outError { - errorForCurrentParse = nil; - [self.parseWarnings removeAllObjects]; - - /** - Is this file being loaded from disk? - Or from network? - */ - NSURLResponse* response; - NSData* httpData = nil; - if( self.sourceURL != nil ) - { - NSURLRequest* request = [NSURLRequest requestWithURL:self.sourceURL]; - NSError* error = nil; - - httpData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; - - if( error != nil ) - { - NSLog( @"[%@] ERROR: failed to parse SVG from URL, because failed to download file at URL = %@, error = %@", [self class], self.sourceURL, error ); - return false; - } - } - - FILE *file; - if( self.sourceURL == nil ) - { - const char *cPath = [_path fileSystemRepresentation]; - file = fopen(cPath, "r"); - - if (!file) - return NO; - } - - xmlParserCtxtPtr ctx = xmlCreatePushParserCtxt(&SAXHandler, self, NULL, 0, NULL); - - if( self.sourceURL == nil ) - { - if (!ctx) { - fclose(file); - return NO; - } - } - - if( self.sourceURL == nil ) - { - size_t read = 0; - char buff[READ_CHUNK_SZ]; - while ((read = fread(buff, 1, READ_CHUNK_SZ, file)) > 0) { - if (xmlParseChunk(ctx, buff, read, 0) != 0) { - _failed = YES; - NSLog(@"An error occured while parsing the current XML chunk"); - - break; - } - } - - fclose(file); - } - else - { - if (xmlParseChunk(ctx, (const char*) [httpData bytes], [httpData length], 0) != 0) { - _failed = YES; -// NSLog(@"An error occured while parsing the current XML chunk"); - - } - } - - if (!_failed) - xmlParseChunk(ctx, NULL, 0, 1); // EOF - - xmlFreeParserCtxt(ctx); - - if( errorForCurrentParse != nil ) - { - *outError = errorForCurrentParse; - _failed = TRUE; - } - - return !_failed; -} - -/** ADAM: use this for a higher-performance, *non-blocking* parse - (when someone upgrades this class and the interface to support non-blocking parse) -// Called when a chunk of data has been downloaded. -- (void)connection:(NSURLConnection *)connection - didReceiveData:(NSData *)data -{ - // Process the downloaded chunk of data. - xmlParseChunk(_xmlParserContext, (const char *)[data bytes], [data length], 0);//....Getting Exception at this line. -} - */ - - -- (void)handleStartElement:(NSString *)name xmlns:(NSString*) prefix attributes:(NSMutableDictionary *)attributes { - - for( NSObject* subParser in self.parserExtensions ) - { - if( [[subParser supportedNamespaces] containsObject:prefix] - && [[subParser supportedTags] containsObject:name] ) - { - NSObject* subParserResult = nil; - - if( nil != (subParserResult = [subParser handleStartElement:name document:_document xmlns:prefix attributes:attributes]) ) - { - NSLog(@"[%@] tag: <%@:%@> -- handled by subParser: %@", [self class], prefix, name, subParser ); - - SVGParserStackItem* stackItem = [[[SVGParserStackItem alloc] init] autorelease];; - stackItem.parserForThisItem = subParser; - stackItem.item = subParserResult; - - [_elementStack addObject:stackItem]; - - if ([subParser createdItemShouldStoreContent:stackItem.item]) { - [_storedChars setString:@""]; - _storingChars = YES; - } - else { - _storingChars = NO; - } - return; - } - - } - } - - NSLog(@"[%@] ERROR: could not find a parser for tag: <%@:%@>; adding empty placeholder", [self class], prefix, name ); - - SVGParserStackItem* emptyItem = [[[SVGParserStackItem alloc] init] autorelease]; - [_elementStack addObject:emptyItem]; -} - - -static void startElementSAX (void *ctx, const xmlChar *localname, const xmlChar *prefix, - const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, - int nb_attributes, int nb_defaulted, const xmlChar **attributes) { - - SVGParser *self = (SVGParser *) ctx; - - NSString *name = NSStringFromLibxmlString(localname); - NSMutableDictionary *attrs = NSDictionaryFromLibxmlAttributes(attributes, nb_attributes); - - //NSString *url = NSStringFromLibxmlString(URI); - NSString *prefix2 = nil; - if( prefix != NULL ) - prefix2 = NSStringFromLibxmlString(prefix); - - NSString *objcURIString = nil; - if( URI != NULL ) - objcURIString = NSStringFromLibxmlString(URI); - -#if DEBUG_VERBOSE_LOG_EVERY_TAG - NSLog(@"[%@] DEBUG_VERBOSE: <%@%@> (namespace URL:%@), attributes: %i", [self class], (prefix2==nil)?@"":[NSString stringWithFormat:@"%@:",prefix2], name, (URI==NULL)?@"n/a":objcURIString, nb_attributes ); -#endif - -#if DEBUG_VERBOSE_LOG_EVERY_TAG - if( prefix2 == nil ) - { - /* The XML library allows this, although it's very unhelpful when writing application code */ - - /* Let's find out what namespaces DO exist... */ - - /* - - TODO / DEVELOPER WARNING: the library says nb_namespaces is the number of elements in the array, - but it keeps returning nil pointer (not always, but often). WTF? Not sure what we're doing wrong - here, but commenting it out for now... - - if( nb_namespaces > 0 ) - { - for( int i=0; i) - this will NOT be added to the output tree", [self class], name ); - } - else - { - SVGParserStackItem* parentStackItem = [_elementStack lastObject]; - - NSObject* parserHandlingTheParentItem = parentStackItem.parserForThisItem; - - if( parentStackItem.item == nil ) - { - /** - Special case: we've hit the closing of the root tag. - - Because each parser-extension MIGHT need to do cleanup / post-processing on the end tag, - we need to ensure that whichever class parsed the root tag gets one final callback to tell it that the end - tag has been reached - */ - - parserHandlingTheParentItem = stackItem.parserForThisItem; - } - - NSLog(@"[%@] DEBUG-PARSER: ended tag (): telling parser (%@) to add that item to tree-parent = %@", [self class], name, parserHandlingTheParentItem, parentStackItem.item ); - [parserHandlingTheParentItem addChildObject:stackItem.item toObject:parentStackItem.item inDocument:_document]; - - if ( [stackItem.parserForThisItem createdItemShouldStoreContent:stackItem.item]) { - [stackItem.parserForThisItem parseContent:_storedChars forItem:stackItem.item]; - - [_storedChars setString:@""]; - _storingChars = NO; - } - } -} - -static void endElementSAX (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI) { - SVGParser *self = (SVGParser *) ctx; - [self handleEndElement:NSStringFromLibxmlString(localname)]; -} - -- (void)handleFoundCharacters:(const xmlChar *)chars length:(int)len { - if (_storingChars) { - char value[len + 1]; - strncpy(value, (const char *) chars, len); - value[len] = '\0'; - - [_storedChars appendString:[NSString stringWithUTF8String:value]]; - } -} - -static void charactersFoundSAX (void *ctx, const xmlChar *chars, int len) { - SVGParser *self = (SVGParser *) ctx; - [self handleFoundCharacters:chars length:len]; -} - --(void) setParseError:(NSError*) error -{ - errorForCurrentParse = error; -} - --(void) addParseWarning:(NSError*) error -{ - errorForCurrentParse = error; -} - -- (void)handleError { - _failed = YES; -} - -static void errorEncounteredSAX (void *ctx, const char *msg, ...) { - NSLog(@"Error encountered during parse: %s", msg); - [ (SVGParser *) ctx handleError]; -} - -static void unparsedEntityDeclaration(void * ctx, - const xmlChar * name, - const xmlChar * publicId, - const xmlChar * systemId, - const xmlChar * notationName) -{ - NSLog(@"ERror: unparsed entity Decl"); -} - -static void structuredError (void * userData, - xmlErrorPtr error) -{ - /** - XML_ERR_WARNING = 1 : A simple warning - XML_ERR_ERROR = 2 : A recoverable error - XML_ERR_FATAL = 3 : A fatal error - */ - xmlErrorLevel errorLevel = error->level; - - NSError* objcError = [NSError errorWithDomain:[[NSNumber numberWithInt:error->domain] stringValue] code:error->code userInfo:[NSDictionary dictionaryWithObjectsAndKeys: - [NSString stringWithCString:error->message encoding:NSUTF8StringEncoding], NSLocalizedDescriptionKey, - [NSNumber numberWithInt:error->line], @"lineNumber", - nil] - ]; - - switch( errorLevel ) - { - case XML_ERR_WARNING: - { - NSLog(@"Warning: parser reports: %@", objcError ); - }break; - - case XML_ERR_ERROR: /** FIXME: ADAM: "non-fatal" errors should be reported as warnings, but SVGDocument + this class need rewriting to return something better than "TRUE/FALSE" on parse finishing */ - case XML_ERR_FATAL: - { - NSLog(@"Error: parser reports: %@", objcError ); - [(SVGParser*) userData setParseError:objcError]; - } - default: - break; - } - -} - -static xmlSAXHandler SAXHandler = { - NULL, /* internalSubset */ - NULL, /* isStandalone */ - NULL, /* hasInternalSubset */ - NULL, /* hasExternalSubset */ - NULL, /* resolveEntity */ - NULL, /* getEntity */ - NULL, /* entityDecl */ - NULL, /* notationDecl */ - NULL, /* attributeDecl */ - NULL, /* elementDecl */ - unparsedEntityDeclaration, /* unparsedEntityDecl */ - NULL, /* setDocumentLocator */ - NULL, /* startDocument */ - NULL, /* endDocument */ - NULL, /* startElement*/ - NULL, /* endElement */ - NULL, /* reference */ - charactersFoundSAX, /* characters */ - NULL, /* ignorableWhitespace */ - NULL, /* processingInstruction */ - NULL, /* comment */ - NULL, /* warning */ - errorEncounteredSAX, /* error */ - NULL, /* fatalError //: unused error() get all the errors */ - NULL, /* getParameterEntity */ - NULL, /* cdataBlock */ - NULL, /* externalSubset */ - XML_SAX2_MAGIC, - NULL, - startElementSAX, /* startElementNs */ - endElementSAX, /* endElementNs */ - structuredError, /* serror */ -}; - -#pragma mark - -#pragma mark Utility - -static NSString *NSStringFromLibxmlString (const xmlChar *string) { - return [NSString stringWithUTF8String:(const char *) string]; -} - -static NSMutableDictionary *NSDictionaryFromLibxmlAttributes (const xmlChar **attrs, int attr_ct) { - NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; - - for (int i = 0; i < attr_ct * 5; i += 5) { - const char *begin = (const char *) attrs[i + 3]; - const char *end = (const char *) attrs[i + 4]; - int vlen = strlen(begin) - strlen(end); - - char val[vlen + 1]; - strncpy(val, begin, vlen); - val[vlen] = '\0'; - - [dict setObject:[NSString stringWithUTF8String:val] - forKey:NSStringFromLibxmlString(attrs[i])]; - } - - return [dict autorelease]; -} - -#define MAX_ACCUM 256 -#define MAX_NAME 256 - -+(NSDictionary *) NSDictionaryFromCSSAttributes: (NSString *)css { - NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; - - const char *cstr = [css UTF8String]; - size_t len = strlen(cstr); - - char name[MAX_NAME]; - bzero(name, MAX_NAME); - - char accum[MAX_ACCUM]; - bzero(accum, MAX_ACCUM); - - size_t accumIdx = 0; - - for (size_t n = 0; n <= len; n++) { - char c = cstr[n]; - - if (c == '\n' || c == '\t' || c == ' ') { - continue; - } - - if (c == ':') { - strcpy(name, accum); - name[accumIdx] = '\0'; - - bzero(accum, MAX_ACCUM); - accumIdx = 0; - - continue; - } - else if (c == ';' || c == '\0') { - accum[accumIdx] = '\0'; - - [dict setObject:[NSString stringWithUTF8String:accum] - forKey:[NSString stringWithUTF8String:name]]; - - bzero(name, MAX_NAME); - - bzero(accum, MAX_ACCUM); - accumIdx = 0; - - continue; - } - - accum[accumIdx++] = c; - } - - return [dict autorelease]; -} - -@end diff --git a/Core/SVGParserSVG.h b/Core/SVGParserSVG.h deleted file mode 100644 index 41acd6eb9..000000000 --- a/Core/SVGParserSVG.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -#import "SVGParser.h" - -@interface SVGParserSVG : NSObject { - NSMutableDictionary *_graphicsGroups; - NSMutableArray *_anonymousGraphicsGroups; -} - -@end diff --git a/Core/SVGParserSVG.m b/Core/SVGParserSVG.m deleted file mode 100644 index b399c5868..000000000 --- a/Core/SVGParserSVG.m +++ /dev/null @@ -1,187 +0,0 @@ -#import "SVGParserSVG.h" - -#import "SVGCircleElement.h" -#import "SVGDefsElement.h" -#import "SVGDescriptionElement.h" -#import "SVGDocument.h" -#import "SVGEllipseElement.h" -#import "SVGGroupElement.h" -#import "SVGImageElement.h" -#import "SVGLineElement.h" -#import "SVGPathElement.h" -#import "SVGPolygonElement.h" -#import "SVGPolylineElement.h" -#import "SVGRectElement.h" -#import "SVGTitleElement.h" -#import "SVGElement+Private.h" - -@implementation SVGParserSVG - -static NSDictionary *elementMap; - -- (id)init { - self = [super init]; - if (self) { - - if (!elementMap) { - elementMap = [[NSDictionary dictionaryWithObjectsAndKeys: - [SVGCircleElement class], @"circle", - [SVGDefsElement class], @"defs", - [SVGDescriptionElement class], @"description", - [SVGEllipseElement class], @"ellipse", - [SVGGroupElement class], @"g", - [SVGImageElement class], @"image", - [SVGLineElement class], @"line", - [SVGPathElement class], @"path", - [SVGPolygonElement class], @"polygon", - [SVGPolylineElement class], @"polyline", - [SVGRectElement class], @"rect", - [SVGTitleElement class], @"title", nil] retain]; - } - } - return self; -} - -- (void)dealloc { - [_anonymousGraphicsGroups release]; - [_graphicsGroups release]; - - [super dealloc]; -} - --(NSArray*) supportedNamespaces -{ - return [NSArray arrayWithObjects: - @"http://www.w3.org/2000/svg", - nil]; -} - --(NSArray*) supportedTags -{ - NSMutableArray* result = [NSMutableArray arrayWithArray:[elementMap allKeys]]; - [result addObject:@"svg"]; - [result addObject:@"defs"]; - [result addObject:@"g"]; - [result addObject:@"path"]; - return result; -} - -- (NSObject*) handleStartElement:(NSString *)name document:(SVGDocument*) svgDocument xmlns:(NSString*) prefix attributes:(NSMutableDictionary *)attributes { - if( [[self supportedNamespaces] containsObject:prefix] ) - { - NSObject* result = nil; - - // handle svg:svg tag separately - if ([name isEqualToString:@"svg"]) { - result = svgDocument; - [svgDocument parseAttributes:attributes]; - - return result; - } - - Class elementClass = [elementMap objectForKey:name]; - - if (!elementClass) { - elementClass = [SVGElement class]; - NSLog(@"Support for '%@' element has not been implemented", name); - } - - id style = nil; - - if ((style = [attributes objectForKey:@"style"])) { - [attributes removeObjectForKey:@"style"]; - [attributes addEntriesFromDictionary:[SVGParser NSDictionaryFromCSSAttributes:style]]; - } - - SVGElement *element = [[elementClass alloc] initWithDocument:svgDocument name:name]; - [element parseAttributes:attributes]; - - return element; - } - - return nil; -} - --(BOOL) createdItemShouldStoreContent:(NSObject*) item -{ - if( [item isKindOfClass:[SVGElement class]] ) - { - if ([[item class] shouldStoreContent]) { - return TRUE; - } - else { - return FALSE; - } - } - else - return false; -} - --(void) addChildObject:(NSObject*)child toObject:(NSObject*)parent inDocument:(SVGDocument*) svgDocument -{ - SVGElement *parentElement = (SVGElement*) parent; - - if( [child isKindOfClass:[SVGElement class]] ) - { - SVGElement *childElement = (SVGElement*) child; - - if ( parent == nil ) // i.e. the root SVG tag - { - NSLog(@"[%@] PARSER_INFO: asked to add object to nil parent; i.e. we've hit the root of the tree; setting global variables on the SVG Document now", [self class]); - [svgDocument setGraphicsGroups:_graphicsGroups]; - [svgDocument setAnonymousGraphicsGroups:_anonymousGraphicsGroups]; - - [_graphicsGroups release]; - [_anonymousGraphicsGroups release]; - _graphicsGroups = nil; - _anonymousGraphicsGroups = nil; - } - else - { - [parentElement addChild:childElement]; - - /*! - SVG Spec attaches special meaning to the "g" tag - and applications - need to be able to pull-out the "g"-tagged items later on - */ - if( [childElement.localName isEqualToString:@"g"] ) - { - if( childElement.identifier == nil ) - { - if( _anonymousGraphicsGroups == nil ) - _anonymousGraphicsGroups = [NSMutableArray new]; - - [_anonymousGraphicsGroups addObject:childElement]; - -#if PARSER_WARN_FOR_ANONYMOUS_SVG_G_TAGS - NSLog(@"[%@] PARSER_WARN: Found anonymous g tag (tag has no XML 'id=' attribute). Loading OK, but check your SVG file (id tags are highly recommended!)...", [self class] ); -#endif - } - else - { - if( _graphicsGroups == nil ) - _graphicsGroups = [NSMutableDictionary new]; - - [_graphicsGroups setValue:childElement forKey:childElement.identifier]; - } - } - } - } - else - { - /*! - Unknown metadata - */ - - [parentElement addMetadataChild:child]; - } -} - --(void) parseContent:(NSMutableString*) content forItem:(NSObject*) item -{ - SVGElement* element = (SVGElement*) item; - - [element parseContent:content]; -} - -@end diff --git a/Core/SVGPolylineElement.m b/Core/SVGPolylineElement.m deleted file mode 100644 index 798e88ea3..000000000 --- a/Core/SVGPolylineElement.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// SVGPolylineElement.m -// SVGKit -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -#import "SVGPolylineElement.h" - -#import "SVGElement+Private.h" -#import "SVGShapeElement+Private.h" -#import "SVGUtils.h" - -@implementation SVGPolylineElement - -- (void)parseAttributes:(NSDictionary *)attributes { - [super parseAttributes:attributes]; - - id value = nil; - - if ((value = [attributes objectForKey:@"points"])) { - CGMutablePathRef path = SVGPathFromPointsInString([value UTF8String], NO); - - [self loadPath:path]; - CGPathRelease(path); - } -} - -@end diff --git a/Core/SVGShapeElement+Private.h b/Core/SVGShapeElement+Private.h deleted file mode 100644 index 8648bbb5b..000000000 --- a/Core/SVGShapeElement+Private.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// SVGShapeElement+Private.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGShapeElement.h" - -@interface SVGShapeElement (Private) - -- (void)loadPath:(CGPathRef)aPath; - -@end diff --git a/Core/SVGShapeElement.h b/Core/SVGShapeElement.h deleted file mode 100644 index 5ce3f4101..000000000 --- a/Core/SVGShapeElement.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// SVGShapeElement.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGElement.h" -#import "SVGUtils.h" - -@class SVGGradientElement; -@class SVGPattern; - -typedef enum { - SVGFillTypeNone = 0, - SVGFillTypeSolid, -} SVGFillType; - -@interface SVGShapeElement : SVGElement < SVGLayeredElement > { } - -@property (nonatomic, readwrite) CGFloat opacity; - -@property (nonatomic, readwrite) SVGFillType fillType; -@property (nonatomic, readwrite) SVGColor fillColor; -@property (nonatomic, readwrite, retain) SVGPattern* fillPattern; - -@property (nonatomic, readwrite) CGFloat strokeWidth; -@property (nonatomic, readwrite) SVGColor strokeColor; - -@property (nonatomic, readonly) CGPathRef path; - -@end diff --git a/Core/SVGShapeElement.m b/Core/SVGShapeElement.m deleted file mode 100644 index 4586ba71f..000000000 --- a/Core/SVGShapeElement.m +++ /dev/null @@ -1,223 +0,0 @@ -// -// SVGShapeElement.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGShapeElement.h" - -#import "CGPathAdditions.h" -#import "SVGDefsElement.h" -#import "SVGDocument.h" -#import "SVGElement+Private.h" -#import "SVGPattern.h" -#import "CAShapeLayerWithHitTest.h" - -#define ADAM_IS_FIXING_THE_TRANSFORM_AND_VIEW_BOX_CODE 0 - -@implementation SVGShapeElement - -#define IDENTIFIER_LEN 256 - -@synthesize opacity = _opacity; - -@synthesize fillType = _fillType; -@synthesize fillColor = _fillColor; -@synthesize fillPattern = _fillPattern; - -@synthesize strokeWidth = _strokeWidth; -@synthesize strokeColor = _strokeColor; - -@synthesize path = _path; - -- (void)finalize { - CGPathRelease(_path); - [super finalize]; -} - -- (void)dealloc { - CGPathRelease(_path); - self.fillPattern = nil; - - [super dealloc]; -} - -- (void)loadDefaults { - _opacity = 1.0f; - - _fillColor = SVGColorMake(0, 0, 0, 255); - _fillType = SVGFillTypeSolid; -} - -- (void)parseAttributes:(NSDictionary *)attributes { - [super parseAttributes:attributes]; - - id value = nil; - - if ((value = [attributes objectForKey:@"opacity"])) { - _opacity = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"fill"])) { - const char *cvalue = [value UTF8String]; - - if (!strncmp(cvalue, "none", 4)) { - _fillType = SVGFillTypeNone; - } - else if (!strncmp(cvalue, "url", 3)) { - NSLog(@"Gradients are no longer supported"); - _fillType = SVGFillTypeNone; - } - else { - _fillColor = SVGColorFromString([value UTF8String]); - _fillType = SVGFillTypeSolid; - } - } - - if ((value = [attributes objectForKey:@"stroke-width"])) { - _strokeWidth = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"stroke"])) { - const char *cvalue = [value UTF8String]; - - if (!strncmp(cvalue, "none", 4)) { - _strokeWidth = 0.0f; - } - else { - _strokeColor = SVGColorFromString(cvalue); - - if (!_strokeWidth) - _strokeWidth = 1.0f; - } - } - - if ((value = [attributes objectForKey:@"stroke-opacity"])) { - _strokeColor.a = (uint8_t) ([value floatValue] * 0xFF); - } - - if ((value = [attributes objectForKey:@"fill-opacity"])) { - _fillColor.a = (uint8_t) ([value floatValue] * 0xFF); - } -} - -- (void)loadPath:(CGPathRef)aPath { - if (_path) { - CGPathRelease(_path); - _path = NULL; - } - - if (aPath) { - _path = CGPathCreateCopy(aPath); - } -} - -- (CALayer *) newLayer { - CAShapeLayer* _shapeLayer = [CAShapeLayerWithHitTest layer]; - _shapeLayer.name = self.identifier; - [_shapeLayer setValue:self.identifier forKey:kSVGElementIdentifier]; - _shapeLayer.opacity = _opacity; - -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES - CGAffineTransform svgEffectiveTransform = [self transformAbsolute]; -#endif - -#if OUTLINE_SHAPES - -#if TARGET_OS_IPHONE - _shapeLayer.borderColor = [UIColor redColor].CGColor; -#endif - - _shapeLayer.borderWidth = 1.0f; -#endif - -#if ADAM_IS_FIXING_THE_TRANSFORM_AND_VIEW_BOX_CODE - To fix this, and to test the code that follows, you need to: - - 1. create a simple SVG file with a single square - 2. Set the viewport to be straingely shaped (e.g. a fat short rectangle) - 3. set the square to fill the exact bottom right of viewport - - ...which will let you see easily if/when the viewbox is being correctly used to scale the contents - - /** - We've parsed this shape using the size values specified RAW inside the SVG. - - Before we attempt to *render* it, we need to convert those values into - screen-space. - - Most SVG docs have screenspace == unit space - but some docs have an explicit "viewBox" - attribute on the SVG document. As per the SVG spec, this defines an alternative - conversion from unit space to screenspace - */ -#endif - CGAffineTransform transformFromSVGUnitsToScreenUnits; - - #if ADAM_IS_FIXING_THE_TRANSFORM_AND_VIEW_BOX_CODE - if( CGRectIsNull( self.document.viewBoxFrame ) ) -#endif - transformFromSVGUnitsToScreenUnits = CGAffineTransformIdentity; - #if ADAM_IS_FIXING_THE_TRANSFORM_AND_VIEW_BOX_CODE - else - transformFromSVGUnitsToScreenUnits = CGAffineTransformMakeScale( self.document.width / self.document.viewBoxFrame.size.width, - self.document.height / self.document.viewBoxFrame.size.height ); -#endif - - CGMutablePathRef pathToPlaceInLayer = CGPathCreateMutable(); - CGPathAddPath( pathToPlaceInLayer, &transformFromSVGUnitsToScreenUnits, _path); - - CGRect rect = CGRectIntegral(CGPathGetPathBoundingBox( pathToPlaceInLayer )); - - CGPathRef finalPath = CGPathCreateByOffsettingPath( pathToPlaceInLayer, rect.origin.x, rect.origin.y ); - - /** Can't use this - iOS 5 only! path = CGPathCreateCopyByTransformingPath(path, transformFromSVGUnitsToScreenUnits ); */ - - _shapeLayer.path = finalPath; - CGPathRelease(finalPath); - CGPathRelease(pathToPlaceInLayer); - -#if EXPERIMENTAL_SUPPORT_FOR_SVG_TRANSFORM_ATTRIBUTES - /** - ADAM: this is an INCOMPLETE implementation of SVG transform. The original code only deals with offsets (translate). - We're actually correctly parsing + calculating SVG's arbitrary transforms - but it will require a lot more work at - this point here to interpret those arbitrary transforms correctly. - - For now, we're just going to assume we're only doing translates. - */ - /** - NB: this line, by changing the FRAME of the layer, has the side effect of also changing the CGPATH's position in absolute - space! - */ - _shapeLayer.frame = CGRectApplyAffineTransform( rect, svgEffectiveTransform ); -#else - _shapeLayer.frame = rect; -#endif - - if (_strokeWidth) { - _shapeLayer.lineWidth = _strokeWidth; - _shapeLayer.strokeColor = CGColorWithSVGColor(_strokeColor); - } - - if (_fillType == SVGFillTypeNone) { - _shapeLayer.fillColor = nil; - } - else if (_fillType == SVGFillTypeSolid) { - _shapeLayer.fillColor = CGColorWithSVGColor(_fillColor); - } - - if (nil != _fillPattern) { - _shapeLayer.fillColor = [_fillPattern CGColor]; - } - - if ([_shapeLayer respondsToSelector:@selector(setShouldRasterize:)]) { - [_shapeLayer performSelector:@selector(setShouldRasterize:) - withObject:[NSNumber numberWithBool:YES]]; - } - - return _shapeLayer; -} - -- (void)layoutLayer:(CALayer *)layer { } - -@end diff --git a/Default-568h@2x.png b/Default-568h@2x.png new file mode 100644 index 000000000..0891b7aab Binary files /dev/null and b/Default-568h@2x.png differ diff --git a/Mac/SVGView.h b/Mac/SVGView.h deleted file mode 100644 index 46cb81535..000000000 --- a/Mac/SVGView.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SVGView.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -@class SVGDocument; - -@interface SVGView : NSView { } - -@property (nonatomic, retain) SVGDocument *document; - -- (id)initWithDocument:(SVGDocument *)document; // set frame to position - -@end diff --git a/Mac/SVGView.m b/Mac/SVGView.m deleted file mode 100644 index 45aec74e7..000000000 --- a/Mac/SVGView.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// SVGView.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGView.h" - -#import "SVGDocument.h" -#import "SVGDocument+CA.h" - -@implementation SVGView - -@synthesize document = _document; - -- (id)initWithDocument:(SVGDocument *)document { - NSParameterAssert(document != nil); - - self = [self initWithFrame:NSMakeRect(0.0f, 0.0f, document.width, document.height)]; - if (self) { - self.document = document; - } - return self; -} - -- (BOOL)isFlipped { - return YES; -} - -- (void)dealloc { - self.document = nil; - - [super dealloc]; -} - -- (void)setDocument:(SVGDocument *)aDocument { - [aDocument retain]; - [_document release]; - if (_document != nil) { - _document = aDocument; - for (CALayer *sublayer in [self.layer sublayers]) { - [sublayer removeFromSuperlayer]; - } - [self.layer addSublayer:[_document layerTree]]; - } -} - -@end diff --git a/README.mdown b/README.mdown index 8d097722f..dd77f2c20 100644 --- a/README.mdown +++ b/README.mdown @@ -3,73 +3,107 @@ SVGKit SVGKit is a Cocoa framework for rendering SVG files as Core Animation layers. All shapes are represented by instances of the `CAShapeLayer` class, and are, by design, animatable. SVGKit is compatible with the latest iOS SDK's. -Installation +This specific branch contains a MASSIVE re-factor of the original SVGKit, aiming to make it easier to use in your apps. Please read the "usage" instructions carefully - they have changed from previous SVGKit versions! + + +Usage - Basic (iPhone/iPad) ----- -Dependencies: +Instantiate an SVGKImageView using the filename of an SVG file, and add it to your view with [UIView addSubview:] - git submodule init && git submodule update + [self.view addSubview: [[SVGKFastImageView alloc] initWithSVGKImage: [SVGKImage imageNamed:@"mySVGfile.svg"]]]; -iOS (iPhone/iPad): - 1. Open the project "XcodeProjects/SVGKit/SVGKit" - 2. Select the target "SVGKit Library" from the dropdown build selector at top left - 3. Build - 4. Look in your output directory for a folder named "debug-universal" - this contains a library + headers for: iPhone, iPad, iOS Simulator +Usage - Intermediate (iPhone/iPad) +----- - 5. Drag/drop the library file, and the headers folder (should be called "usr") into your iPhone/iPad project. - 6. Edit your build settings and set "C/C++ Compiler Version" = "LLVM Compiler 2.0" - 7. Edit your build settings and add "Other Linker Flags" = "-ObjC" +OPTION 1: Load an SVG file, and convert the document to CALayer's which Apple can render + 1. SVGKImage *im = [SVGKImage imageNamed:@"my_svg_file"]; //this loads the file, parses the SVG, and outputs an SVGImage object + 2. [self.view.layer addSublayer:im.CALayerTree]; // SVGKImage can export itself as Apple's CALayer's - 8. (Optional but recommended): Edit your build settings and add "Header Search Paths" = "/usr/include/libxml2" - 9. (Optional but recommended): Add the framework "libxml2.dylib" +...and if you want to display the same SVG somewhere else simultaneously, you don't have to re-parse it, you can just call: + 3. [self.view.layer addSublayer:[im newCALayerTree]; // Creates a clone of the CALayers, you can edit without affecting originals + + +OPTION 2: Load an SVG file, and read the SVG data directly by looking at the tree of SVGElement subclasses + 1. SVGKImage *im = [SVGKImage imageNamed:@"my_svg_file"]; //this loads the file, parses the SVG, and outputs an SVGImage object + 2. SVGSVGElement* rootOfTree = im.DOMTree; // NB: this is a partial implementation of the official "SVG DOM" standard. See the header file for this class and its superclass to see what you can do with it -OS X: ...this needs updating; some minor code changes are needed to "fix" this project. The OS X framework currently DOES NOT BUILD because iOS classes are being referenced in a couple of places. +Advanced Features (this branch/fork only!) (iPhone/iPad) +===== -Usage - iPhone/iPad +FEATURE 1: use an SVG just like it's a normal PNG file: use SVGKFastImageView like it's UIImageView: ----- -To use this, you must: - 1. Load an SVG file, using SVGDocument (this parses the SVG) - 2. Convert the document to CALayer's which Apple can render, using SVGDocumentView - -NB: if you want to render the same SVG in different places on screen, create an additional SVGDocumentView for each instance. That way, you don't have to re-parse the SVG source file each time. - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - // Override point for customization after application launch. - [self.window makeKeyAndVisible]; - - NSString* svgFilename = @"Monkey"; - - NSLog( @"[%@] Loading SVG document, filename = %@", [self class], svgFilename ); - - /** Optional: if you're using the parser extensions, add them here - [SVGDocument addSVGParserExtension:[[SVGParserConquest alloc] init]]; - */ - - SVGDocument* svgDocument = [SVGDocument documentNamed:svgFilename]; - - SVGDocumentView* docView = [SVGDocumentView documentViewWithDocument:svgDocument]; - - [self.window.layer addSublayer:docView.rootLayer]; - - return YES; -} + - SVGKImage = equivalent of UIImage (same methods and properties - some not implemented, but all core items implemented) + - SVGKFastImageView = equivalent of UIImageView (same methods, with extra properties to support the features of SVG that plain bitmaps lack - e.g. resolution independent rendering) -Usage - OS X +...NB: by default, if you change the "frame" property of an SVGKFastImageView, it automatically re-renders the SVG at the new resolution. +...NB: bugs in Apple's UIScrollView mean you MUST disable the above feature before allowing user's pinch-zoom: a property on SVGKFastImageView lets you turn this on/off + + +FEATURE 2: load SVG from web, or from disk +----- + - [SVGKParser parse: (SVGKSource*)]; // anything that's an "SVGKSource" can be parsed + + - [SVGKSource sourceWithFile:@"monkey.svg"]; // create a source from disk... + - [SVGKSource sourceWithURL:@"http://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg"]; // create a source from disk... + + +FEATURE 3: search an SVG file for particular tags / nodes / elements: +----- + - Find all and tags: NodeList* gElements = [svgImage.DOMDocument getElementsByTagName:@"g"]; + - Find ALL tags (from root of SVG down): NodeList* allElements = [svgImage.DOMDocument getElementsByTagName:@"*"]; + +FEATURE 4: resize your SVG file to any size: +----- + - COMPLICATED: c.f. this thread: https://github.com/adamgit/SVGKit/issues/7 + +FEATURE 5: automatic scaling of your SVG to fit in memory ----- + - AUTOMATIC: SVG files are scaled to fit the co-ordinate system as required/intended by spec + - ...many files that ran out of memory in previous versions of SVGKit now render OK -First, initialize an instance of `SVGDocument`, the model object which encompasses the entire SVG element tree. This can be accomplished using the `initWithContentsOfFile:` initializer. To load a SVG file which resides in your application bundle, use the `documentNamed:` class method and pass in a file name (without the extension). The `SVGDocument` class encapsulates certain document metadata, including width, height, version, title, and description. +FEATURE 6: Access to the DOM Document Object Model +----- + - PARTIALLY IMPLEMENTED: SVGKImage.DOMDocument is a true DOMDocument, but many of the methods aren't fully implemented - SVGDocument *document = [SVGDocument documentNamed:@"Monkey"]; // located in the application bundle +FEATURE 7: Retrieve any part of your SVG document positioned correctly in space +----- + - [((SVGKImage*) image).newCopyPositionedAbsoluteLayerWithIdentifier:@"id of the SVG tag / node /element"]; + - NB: this MUST return a copy, because it's moving your layer out of the tree and into a fresh CALayer of its own -On Mac OS X, make sure your instance of `NSView` is layer-backed. The layer tree can be accessed using the `layerTree` method on `SVGDocument`, for example: +FEATURE 8: detailed information on whether and WHY parsing failed: +----- + - (SVGKParser*).currentParseRun.warnings; // array of NSError objects, each one a "WARNING" from the parser + - (SVGKParser*).currentParseRun.errorsFatal; // array of NSError objects, each one a "FATAL ERROR" from the parser - if your SVG didn't render at all, this is why! + - (SVGKParser*).currentParseRun.errorsRecoverable; // array of NSError objects, each one a "RECOVERABLE ERROR" from the parser - if your SVG didn't render correctly, this is why! (although you probably still got to see something) - NSView *ourView = ... ; - [ourView setWantsLayer:YES]; - [ourView.layer addSublayer:[document layerTree]]; + - (SVGKImage*).parseErrorsAndWarnings; // this is a convenience pointer to (SVGKParser*).currentParseRun used above + +Usage - OS X +----- -Your SVG file should now be rendered on-screen. You can query for specific layers by using the `layerWithIdentifier:` method, also defined on `SVGDocument`. The identifier corresponds to the `id` attribute defined on elements. Once a reference to a subclass of `CALayer` is returned, its properties can be animated using implicit or explicit [Core Animation](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/AnimatingLayers.html%23//apple_ref/doc/uid/TP40006085-SW1) animations. +UNSUPPORTED: the code exists, but none of the maintainers have used it recently, so we're not even sure if the OS X build still works! Feel free to report any issues or suggest improvements in the issue tracker + + +Installation +----- + +iOS (iPhone/iPad): + 1. Open the project "XcodeProjects/SVGKit/SVGKit" + 2. Select the target "SVGKit Library" from the dropdown build selector at top left + 3. Build + 4a. (open the Products section on left hand bar in Xcode, right click the product, and select "Show in Finder". THEN GO UP ONE DIRECTORY! You MUST NOT USE the Product that Xcode shows you - it IS WRONG, it is a BUG IN APPLE'S XCODE) + 4. Look in your output directory for a folder named "debug-universal" - this contains a library + headers for: iPhone, iPad, iOS Simulator + + 5. Drag/drop the library file, and the headers folder (should be called "usr") into your iPhone/iPad project. + 6. Edit your build settings and set "C/C++ Compiler Version" = "LLVM Compiler 2.0" + 7. Edit your build settings and add "Other Linker Flags" = "-ObjC" + + 8. (Optional but recommended): Edit your build settings and add "Header Search Paths" = "/usr/include/libxml2" + 9. (Optional but recommended): Add the framework "libxml2.dylib" + +OS X: ...this needs updating; some minor code changes are needed to "fix" this project. The OS X framework currently DOES NOT BUILD because iOS classes are being referenced in a couple of places. diff --git a/SVGKit-iOS.xcodeproj/project.pbxproj b/SVGKit-iOS.xcodeproj/project.pbxproj new file mode 100644 index 000000000..0088782dc --- /dev/null +++ b/SVGKit-iOS.xcodeproj/project.pbxproj @@ -0,0 +1,875 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 661008931632E30B00DD3C38 /* SVGKParserDOM.h in Headers */ = {isa = PBXBuildFile; fileRef = 661008911632E30B00DD3C38 /* SVGKParserDOM.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 661008941632E30B00DD3C38 /* SVGKParserDOM.m in Sources */ = {isa = PBXBuildFile; fileRef = 661008921632E30B00DD3C38 /* SVGKParserDOM.m */; }; + 6639619216145D0400E58CCA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6639619116145D0400E58CCA /* Foundation.framework */; }; + 6639634016145DDC00E58CCA /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 6639633F16145DDC00E58CCA /* libxml2.dylib */; }; + 6639634216148CDF00E58CCA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6639634116148CDF00E58CCA /* QuartzCore.framework */; }; + 6639634716148DEC00E58CCA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6639634616148DEC00E58CCA /* CoreGraphics.framework */; }; + 6649DFE816172CCC00AFE92A /* CGPathAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF6D16172CCC00AFE92A /* CGPathAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFE916172CCC00AFE92A /* CGPathAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF6E16172CCC00AFE92A /* CGPathAdditions.m */; }; + 6649DFEA16172CCC00AFE92A /* AppleSucksDOMImplementation.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF7116172CCC00AFE92A /* AppleSucksDOMImplementation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFEB16172CCC00AFE92A /* AppleSucksDOMImplementation.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF7216172CCC00AFE92A /* AppleSucksDOMImplementation.m */; }; + 6649DFEC16172CCC00AFE92A /* Attr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF7316172CCC00AFE92A /* Attr.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFED16172CCC00AFE92A /* Attr.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF7416172CCC00AFE92A /* Attr.m */; }; + 6649DFEE16172CCC00AFE92A /* CDATASection.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF7516172CCC00AFE92A /* CDATASection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFEF16172CCC00AFE92A /* CDATASection.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF7616172CCC00AFE92A /* CDATASection.m */; }; + 6649DFF016172CCC00AFE92A /* CharacterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF7716172CCC00AFE92A /* CharacterData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFF116172CCC00AFE92A /* CharacterData.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF7816172CCC00AFE92A /* CharacterData.m */; }; + 6649DFF216172CCC00AFE92A /* Comment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF7916172CCC00AFE92A /* Comment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFF316172CCC00AFE92A /* Comment.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF7A16172CCC00AFE92A /* Comment.m */; }; + 6649DFF416172CCC00AFE92A /* Document+Mutable.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF7B16172CCC00AFE92A /* Document+Mutable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFF516172CCC00AFE92A /* Document.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF7C16172CCC00AFE92A /* Document.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFF616172CCC00AFE92A /* Document.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF7D16172CCC00AFE92A /* Document.m */; }; + 6649DFF716172CCC00AFE92A /* DocumentFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF7E16172CCC00AFE92A /* DocumentFragment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFF816172CCC00AFE92A /* DocumentFragment.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF7F16172CCC00AFE92A /* DocumentFragment.m */; }; + 6649DFF916172CCC00AFE92A /* DocumentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8016172CCC00AFE92A /* DocumentType.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFFA16172CCC00AFE92A /* DocumentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF8116172CCC00AFE92A /* DocumentType.m */; }; + 6649DFFB16172CCC00AFE92A /* Element.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8216172CCC00AFE92A /* Element.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFFC16172CCC00AFE92A /* Element.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF8316172CCC00AFE92A /* Element.m */; }; + 6649DFFD16172CCC00AFE92A /* EntityReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8416172CCC00AFE92A /* EntityReference.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649DFFE16172CCC00AFE92A /* EntityReference.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF8516172CCC00AFE92A /* EntityReference.m */; }; + 6649DFFF16172CCC00AFE92A /* NamedNodeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8616172CCC00AFE92A /* NamedNodeMap.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00016172CCC00AFE92A /* NamedNodeMap.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF8716172CCC00AFE92A /* NamedNodeMap.m */; }; + 6649E00116172CCC00AFE92A /* Node+Mutable.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8816172CCC00AFE92A /* Node+Mutable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00216172CCC00AFE92A /* Node.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8916172CCC00AFE92A /* Node.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00316172CCC00AFE92A /* Node.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF8A16172CCC00AFE92A /* Node.m */; }; + 6649E00416172CCC00AFE92A /* NodeList+Mutable.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8B16172CCC00AFE92A /* NodeList+Mutable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00516172CCC00AFE92A /* NodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8C16172CCC00AFE92A /* NodeList.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00616172CCC00AFE92A /* NodeList.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF8D16172CCC00AFE92A /* NodeList.m */; }; + 6649E00716172CCC00AFE92A /* ProcessingInstruction.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF8E16172CCC00AFE92A /* ProcessingInstruction.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00816172CCC00AFE92A /* ProcessingInstruction.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF8F16172CCC00AFE92A /* ProcessingInstruction.m */; }; + 6649E00916172CCC00AFE92A /* Text.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9016172CCC00AFE92A /* Text.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00A16172CCC00AFE92A /* Text.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF9116172CCC00AFE92A /* Text.m */; }; + 6649E00B16172CCC00AFE92A /* SVGAngle.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9316172CCC00AFE92A /* SVGAngle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00C16172CCC00AFE92A /* SVGAngle.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF9416172CCC00AFE92A /* SVGAngle.m */; }; + 6649E00D16172CCC00AFE92A /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9516172CCC00AFE92A /* SVGDocument.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E00E16172CCC00AFE92A /* SVGDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF9616172CCC00AFE92A /* SVGDocument.m */; }; + 6649E00F16172CCC00AFE92A /* SVGDocument_Mutable.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9716172CCC00AFE92A /* SVGDocument_Mutable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01016172CCC00AFE92A /* SVGLength.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9816172CCC00AFE92A /* SVGLength.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01116172CCC00AFE92A /* SVGLength.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF9916172CCC00AFE92A /* SVGLength.m */; }; + 6649E01216172CCC00AFE92A /* SVGMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9A16172CCC00AFE92A /* SVGMatrix.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01316172CCC00AFE92A /* SVGMatrix.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF9B16172CCC00AFE92A /* SVGMatrix.m */; }; + 6649E01416172CCC00AFE92A /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9C16172CCC00AFE92A /* SVGNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01516172CCC00AFE92A /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9D16172CCC00AFE92A /* SVGPoint.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01616172CCC00AFE92A /* SVGPoint.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DF9E16172CCC00AFE92A /* SVGPoint.m */; }; + 6649E01716172CCC00AFE92A /* SVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DF9F16172CCC00AFE92A /* SVGRect.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01816172CCC00AFE92A /* SVGSVGElement_Mutable.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFA016172CCC00AFE92A /* SVGSVGElement_Mutable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01916172CCC00AFE92A /* SVGTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFA116172CCC00AFE92A /* SVGTransform.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01A16172CCC00AFE92A /* SVGTransform.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFA216172CCC00AFE92A /* SVGTransform.m */; }; + 6649E01B16172CCC00AFE92A /* SVGViewSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFA316172CCC00AFE92A /* SVGViewSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01C16172CCC00AFE92A /* SVGCircleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFA416172CCC00AFE92A /* SVGCircleElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E01D16172CCC00AFE92A /* SVGCircleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFA516172CCC00AFE92A /* SVGCircleElement.m */; }; + 6649E02016172CCC00AFE92A /* SVGDescriptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFA816172CCC00AFE92A /* SVGDescriptionElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02116172CCC00AFE92A /* SVGDescriptionElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFA916172CCC00AFE92A /* SVGDescriptionElement.m */; }; + 6649E02216172CCC00AFE92A /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFAA16172CCC00AFE92A /* SVGElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02316172CCC00AFE92A /* SVGElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFAB16172CCC00AFE92A /* SVGElement.m */; }; + 6649E02416172CCC00AFE92A /* SVGElement_ForParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFAC16172CCC00AFE92A /* SVGElement_ForParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02516172CCC00AFE92A /* SVGEllipseElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFAD16172CCC00AFE92A /* SVGEllipseElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02616172CCC00AFE92A /* SVGEllipseElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFAE16172CCC00AFE92A /* SVGEllipseElement.m */; }; + 6649E02716172CCC00AFE92A /* SVGGroupElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFAF16172CCC00AFE92A /* SVGGroupElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02816172CCC00AFE92A /* SVGGroupElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFB016172CCC00AFE92A /* SVGGroupElement.m */; }; + 6649E02916172CCC00AFE92A /* SVGImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFB116172CCC00AFE92A /* SVGImageElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02A16172CCC00AFE92A /* SVGImageElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFB216172CCC00AFE92A /* SVGImageElement.m */; }; + 6649E02B16172CCC00AFE92A /* SVGLayeredElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFB316172CCC00AFE92A /* SVGLayeredElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02C16172CCC00AFE92A /* SVGLineElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFB416172CCC00AFE92A /* SVGLineElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02D16172CCC00AFE92A /* SVGLineElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFB516172CCC00AFE92A /* SVGLineElement.m */; }; + 6649E02E16172CCC00AFE92A /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFB616172CCC00AFE92A /* SVGPathElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E02F16172CCC00AFE92A /* SVGPathElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFB716172CCC00AFE92A /* SVGPathElement.m */; }; + 6649E03016172CCC00AFE92A /* SVGPolygonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFB816172CCC00AFE92A /* SVGPolygonElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E03116172CCC00AFE92A /* SVGPolygonElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFB916172CCC00AFE92A /* SVGPolygonElement.m */; }; + 6649E03216172CCC00AFE92A /* SVGPolylineElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFBA16172CCC00AFE92A /* SVGPolylineElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E03316172CCC00AFE92A /* SVGPolylineElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFBB16172CCC00AFE92A /* SVGPolylineElement.m */; }; + 6649E03416172CCC00AFE92A /* SVGRectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFBC16172CCC00AFE92A /* SVGRectElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E03516172CCC00AFE92A /* SVGRectElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFBD16172CCC00AFE92A /* SVGRectElement.m */; }; + 6649E03616172CCC00AFE92A /* SVGShapeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFBE16172CCC00AFE92A /* SVGShapeElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E03716172CCC00AFE92A /* SVGShapeElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFBF16172CCC00AFE92A /* SVGShapeElement.m */; }; + 6649E03816172CCC00AFE92A /* SVGSVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFC016172CCC00AFE92A /* SVGSVGElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E03916172CCC00AFE92A /* SVGSVGElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFC116172CCC00AFE92A /* SVGSVGElement.m */; }; + 6649E03A16172CCC00AFE92A /* SVGTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFC216172CCC00AFE92A /* SVGTextElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E03B16172CCC00AFE92A /* SVGTextElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFC316172CCC00AFE92A /* SVGTextElement.m */; }; + 6649E03C16172CCC00AFE92A /* SVGTitleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFC416172CCC00AFE92A /* SVGTitleElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E03D16172CCC00AFE92A /* SVGTitleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFC516172CCC00AFE92A /* SVGTitleElement.m */; }; + 6649E03E16172CCC00AFE92A /* SVGKParseResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFC716172CCC00AFE92A /* SVGKParseResult.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E03F16172CCC00AFE92A /* SVGKParseResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFC816172CCC00AFE92A /* SVGKParseResult.m */; }; + 6649E04016172CCC00AFE92A /* SVGKParserExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFC916172CCC00AFE92A /* SVGKParserExtension.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04116172CCC00AFE92A /* SVGKParserPatternsAndGradients.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFCA16172CCC00AFE92A /* SVGKParserPatternsAndGradients.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04216172CCC00AFE92A /* SVGKParserPatternsAndGradients.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFCB16172CCC00AFE92A /* SVGKParserPatternsAndGradients.m */; }; + 6649E04316172CCC00AFE92A /* SVGKParserSVG.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFCC16172CCC00AFE92A /* SVGKParserSVG.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04416172CCC00AFE92A /* SVGKParserSVG.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFCD16172CCC00AFE92A /* SVGKParserSVG.m */; }; + 6649E04516172CCC00AFE92A /* SVGKPointsAndPathsParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFCE16172CCC00AFE92A /* SVGKPointsAndPathsParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04616172CCC00AFE92A /* SVGKPointsAndPathsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFCF16172CCC00AFE92A /* SVGKPointsAndPathsParser.m */; }; + 6649E04716172CCC00AFE92A /* SVGKImage+SVGPathView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFD016172CCC00AFE92A /* SVGKImage+SVGPathView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04816172CCC00AFE92A /* SVGKImage+SVGPathView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFD116172CCC00AFE92A /* SVGKImage+SVGPathView.m */; }; + 6649E04916172CCC00AFE92A /* SVGKImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFD216172CCC00AFE92A /* SVGKImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04A16172CCC00AFE92A /* SVGKImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFD316172CCC00AFE92A /* SVGKImage.m */; }; + 6649E04B16172CCC00AFE92A /* SVGKImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFD416172CCC00AFE92A /* SVGKImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04C16172CCC00AFE92A /* SVGKImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFD516172CCC00AFE92A /* SVGKImageView.m */; }; + 6649E04D16172CCC00AFE92A /* SVGKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFD616172CCC00AFE92A /* SVGKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04E16172CCC00AFE92A /* SVGKParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFD716172CCC00AFE92A /* SVGKParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E04F16172CCC00AFE92A /* SVGKParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFD816172CCC00AFE92A /* SVGKParser.m */; }; + 6649E05016172CCC00AFE92A /* SVGKPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFD916172CCC00AFE92A /* SVGKPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E05116172CCC00AFE92A /* SVGKPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFDA16172CCC00AFE92A /* SVGKPattern.m */; }; + 6649E05216172CCC00AFE92A /* SVGKSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFDB16172CCC00AFE92A /* SVGKSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E05316172CCC00AFE92A /* SVGKSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFDC16172CCC00AFE92A /* SVGKSource.m */; }; + 6649E05616172CCC00AFE92A /* SVGUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFDF16172CCC00AFE92A /* SVGUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E05716172CCC00AFE92A /* SVGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFE016172CCC00AFE92A /* SVGUtils.m */; }; + 6649E05816172CCC00AFE92A /* CALayerWithChildHitTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFE216172CCC00AFE92A /* CALayerWithChildHitTest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E05916172CCC00AFE92A /* CALayerWithChildHitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFE316172CCC00AFE92A /* CALayerWithChildHitTest.m */; }; + 6649E05A16172CCC00AFE92A /* CAShapeLayerWithHitTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 6649DFE416172CCC00AFE92A /* CAShapeLayerWithHitTest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6649E05B16172CCC00AFE92A /* CAShapeLayerWithHitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649DFE516172CCC00AFE92A /* CAShapeLayerWithHitTest.m */; }; + 666053231650184000B3B493 /* SVGKFastImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 666053211650184000B3B493 /* SVGKFastImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 666053241650184000B3B493 /* SVGKFastImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 666053221650184000B3B493 /* SVGKFastImageView.m */; }; + 666414C0165006F80051A356 /* SVGKLayeredImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 666414BE165006F80051A356 /* SVGKLayeredImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 666414C1165006F80051A356 /* SVGKLayeredImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 666414BF165006F80051A356 /* SVGKLayeredImageView.m */; }; + 666414C416500D900051A356 /* SVGKLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 666414C216500D900051A356 /* SVGKLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 666414C516500D900051A356 /* SVGKLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 666414C316500D900051A356 /* SVGKLayer.m */; }; + 66C0132F16179DCC00359714 /* SVGDefsElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 66C0132D16179DCC00359714 /* SVGDefsElement.m */; }; + 66C0133316179E6F00359714 /* SVGUseElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 66C0133116179E6F00359714 /* SVGUseElement.m */; }; + 66C0133716179F4400359714 /* SVGElementInstance.m in Sources */ = {isa = PBXBuildFile; fileRef = 66C0133516179F4400359714 /* SVGElementInstance.m */; }; + 66C0133B16179FD700359714 /* SVGElementInstanceList.m in Sources */ = {isa = PBXBuildFile; fileRef = 66C0133916179FD700359714 /* SVGElementInstanceList.m */; }; + 66C0133F1617A33000359714 /* SVGKParserDefsAndUse.m in Sources */ = {isa = PBXBuildFile; fileRef = 66C0133D1617A33000359714 /* SVGKParserDefsAndUse.m */; }; + 66E861F3168786900059C9C4 /* CALayerExporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 66E861F1168786900059C9C4 /* CALayerExporter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 66E861F4168786900059C9C4 /* CALayerExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 66E861F2168786900059C9C4 /* CALayerExporter.m */; }; + 66FED67C165FB9C6006A43F6 /* DOMHelperUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 66FED67A165FB9C6006A43F6 /* DOMHelperUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 66FED67D165FB9C6006A43F6 /* DOMHelperUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 66FED67B165FB9C6006A43F6 /* DOMHelperUtilities.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 6639618C16145D0400E58CCA /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/${PRODUCT_NAME}"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 661008911632E30B00DD3C38 /* SVGKParserDOM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKParserDOM.h; sourceTree = ""; }; + 661008921632E30B00DD3C38 /* SVGKParserDOM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKParserDOM.m; sourceTree = ""; }; + 6639618E16145D0400E58CCA /* libSVGKit-iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libSVGKit-iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6639619116145D0400E58CCA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 6639633F16145DDC00E58CCA /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; + 6639634116148CDF00E58CCA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 6639634616148DEC00E58CCA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 6649DF6D16172CCC00AFE92A /* CGPathAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGPathAdditions.h; sourceTree = ""; }; + 6649DF6E16172CCC00AFE92A /* CGPathAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGPathAdditions.m; sourceTree = ""; }; + 6649DF7116172CCC00AFE92A /* AppleSucksDOMImplementation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleSucksDOMImplementation.h; sourceTree = ""; }; + 6649DF7216172CCC00AFE92A /* AppleSucksDOMImplementation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppleSucksDOMImplementation.m; sourceTree = ""; }; + 6649DF7316172CCC00AFE92A /* Attr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Attr.h; sourceTree = ""; }; + 6649DF7416172CCC00AFE92A /* Attr.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Attr.m; sourceTree = ""; }; + 6649DF7516172CCC00AFE92A /* CDATASection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDATASection.h; sourceTree = ""; }; + 6649DF7616172CCC00AFE92A /* CDATASection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDATASection.m; sourceTree = ""; }; + 6649DF7716172CCC00AFE92A /* CharacterData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharacterData.h; sourceTree = ""; }; + 6649DF7816172CCC00AFE92A /* CharacterData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CharacterData.m; sourceTree = ""; }; + 6649DF7916172CCC00AFE92A /* Comment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Comment.h; sourceTree = ""; }; + 6649DF7A16172CCC00AFE92A /* Comment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Comment.m; sourceTree = ""; }; + 6649DF7B16172CCC00AFE92A /* Document+Mutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Document+Mutable.h"; sourceTree = ""; }; + 6649DF7C16172CCC00AFE92A /* Document.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Document.h; sourceTree = ""; }; + 6649DF7D16172CCC00AFE92A /* Document.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Document.m; sourceTree = ""; }; + 6649DF7E16172CCC00AFE92A /* DocumentFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentFragment.h; sourceTree = ""; }; + 6649DF7F16172CCC00AFE92A /* DocumentFragment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DocumentFragment.m; sourceTree = ""; }; + 6649DF8016172CCC00AFE92A /* DocumentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentType.h; sourceTree = ""; }; + 6649DF8116172CCC00AFE92A /* DocumentType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DocumentType.m; sourceTree = ""; }; + 6649DF8216172CCC00AFE92A /* Element.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Element.h; sourceTree = ""; }; + 6649DF8316172CCC00AFE92A /* Element.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Element.m; sourceTree = ""; }; + 6649DF8416172CCC00AFE92A /* EntityReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EntityReference.h; sourceTree = ""; }; + 6649DF8516172CCC00AFE92A /* EntityReference.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EntityReference.m; sourceTree = ""; }; + 6649DF8616172CCC00AFE92A /* NamedNodeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NamedNodeMap.h; sourceTree = ""; }; + 6649DF8716172CCC00AFE92A /* NamedNodeMap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NamedNodeMap.m; sourceTree = ""; }; + 6649DF8816172CCC00AFE92A /* Node+Mutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Node+Mutable.h"; sourceTree = ""; }; + 6649DF8916172CCC00AFE92A /* Node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Node.h; sourceTree = ""; }; + 6649DF8A16172CCC00AFE92A /* Node.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Node.m; sourceTree = ""; }; + 6649DF8B16172CCC00AFE92A /* NodeList+Mutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NodeList+Mutable.h"; sourceTree = ""; }; + 6649DF8C16172CCC00AFE92A /* NodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeList.h; sourceTree = ""; }; + 6649DF8D16172CCC00AFE92A /* NodeList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NodeList.m; sourceTree = ""; }; + 6649DF8E16172CCC00AFE92A /* ProcessingInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessingInstruction.h; sourceTree = ""; }; + 6649DF8F16172CCC00AFE92A /* ProcessingInstruction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProcessingInstruction.m; sourceTree = ""; }; + 6649DF9016172CCC00AFE92A /* Text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Text.h; sourceTree = ""; }; + 6649DF9116172CCC00AFE92A /* Text.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Text.m; sourceTree = ""; }; + 6649DF9316172CCC00AFE92A /* SVGAngle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAngle.h; sourceTree = ""; }; + 6649DF9416172CCC00AFE92A /* SVGAngle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGAngle.m; sourceTree = ""; }; + 6649DF9516172CCC00AFE92A /* SVGDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDocument.h; sourceTree = ""; }; + 6649DF9616172CCC00AFE92A /* SVGDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDocument.m; sourceTree = ""; }; + 6649DF9716172CCC00AFE92A /* SVGDocument_Mutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDocument_Mutable.h; sourceTree = ""; }; + 6649DF9816172CCC00AFE92A /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = ""; }; + 6649DF9916172CCC00AFE92A /* SVGLength.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGLength.m; sourceTree = ""; }; + 6649DF9A16172CCC00AFE92A /* SVGMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMatrix.h; sourceTree = ""; }; + 6649DF9B16172CCC00AFE92A /* SVGMatrix.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGMatrix.m; sourceTree = ""; }; + 6649DF9C16172CCC00AFE92A /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = ""; }; + 6649DF9D16172CCC00AFE92A /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = ""; }; + 6649DF9E16172CCC00AFE92A /* SVGPoint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPoint.m; sourceTree = ""; }; + 6649DF9F16172CCC00AFE92A /* SVGRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRect.h; sourceTree = ""; }; + 6649DFA016172CCC00AFE92A /* SVGSVGElement_Mutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGSVGElement_Mutable.h; sourceTree = ""; }; + 6649DFA116172CCC00AFE92A /* SVGTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTransform.h; sourceTree = ""; }; + 6649DFA216172CCC00AFE92A /* SVGTransform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTransform.m; sourceTree = ""; }; + 6649DFA316172CCC00AFE92A /* SVGViewSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGViewSpec.h; sourceTree = ""; }; + 6649DFA416172CCC00AFE92A /* SVGCircleElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGCircleElement.h; sourceTree = ""; }; + 6649DFA516172CCC00AFE92A /* SVGCircleElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGCircleElement.m; sourceTree = ""; }; + 6649DFA816172CCC00AFE92A /* SVGDescriptionElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDescriptionElement.h; sourceTree = ""; }; + 6649DFA916172CCC00AFE92A /* SVGDescriptionElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDescriptionElement.m; sourceTree = ""; }; + 6649DFAA16172CCC00AFE92A /* SVGElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElement.h; sourceTree = ""; }; + 6649DFAB16172CCC00AFE92A /* SVGElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGElement.m; sourceTree = ""; }; + 6649DFAC16172CCC00AFE92A /* SVGElement_ForParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElement_ForParser.h; sourceTree = ""; }; + 6649DFAD16172CCC00AFE92A /* SVGEllipseElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGEllipseElement.h; sourceTree = ""; }; + 6649DFAE16172CCC00AFE92A /* SVGEllipseElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGEllipseElement.m; sourceTree = ""; }; + 6649DFAF16172CCC00AFE92A /* SVGGroupElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGroupElement.h; sourceTree = ""; }; + 6649DFB016172CCC00AFE92A /* SVGGroupElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGGroupElement.m; sourceTree = ""; }; + 6649DFB116172CCC00AFE92A /* SVGImageElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageElement.h; sourceTree = ""; }; + 6649DFB216172CCC00AFE92A /* SVGImageElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGImageElement.m; sourceTree = ""; }; + 6649DFB316172CCC00AFE92A /* SVGLayeredElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLayeredElement.h; sourceTree = ""; }; + 6649DFB416172CCC00AFE92A /* SVGLineElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLineElement.h; sourceTree = ""; }; + 6649DFB516172CCC00AFE92A /* SVGLineElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGLineElement.m; sourceTree = ""; }; + 6649DFB616172CCC00AFE92A /* SVGPathElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathElement.h; sourceTree = ""; }; + 6649DFB716172CCC00AFE92A /* SVGPathElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPathElement.m; sourceTree = ""; }; + 6649DFB816172CCC00AFE92A /* SVGPolygonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPolygonElement.h; sourceTree = ""; }; + 6649DFB916172CCC00AFE92A /* SVGPolygonElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPolygonElement.m; sourceTree = ""; }; + 6649DFBA16172CCC00AFE92A /* SVGPolylineElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPolylineElement.h; sourceTree = ""; }; + 6649DFBB16172CCC00AFE92A /* SVGPolylineElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPolylineElement.m; sourceTree = ""; }; + 6649DFBC16172CCC00AFE92A /* SVGRectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectElement.h; sourceTree = ""; }; + 6649DFBD16172CCC00AFE92A /* SVGRectElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGRectElement.m; sourceTree = ""; }; + 6649DFBE16172CCC00AFE92A /* SVGShapeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGShapeElement.h; sourceTree = ""; }; + 6649DFBF16172CCC00AFE92A /* SVGShapeElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGShapeElement.m; sourceTree = ""; }; + 6649DFC016172CCC00AFE92A /* SVGSVGElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGSVGElement.h; sourceTree = ""; }; + 6649DFC116172CCC00AFE92A /* SVGSVGElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGSVGElement.m; sourceTree = ""; }; + 6649DFC216172CCC00AFE92A /* SVGTextElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextElement.h; sourceTree = ""; }; + 6649DFC316172CCC00AFE92A /* SVGTextElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTextElement.m; sourceTree = ""; }; + 6649DFC416172CCC00AFE92A /* SVGTitleElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTitleElement.h; sourceTree = ""; }; + 6649DFC516172CCC00AFE92A /* SVGTitleElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTitleElement.m; sourceTree = ""; }; + 6649DFC716172CCC00AFE92A /* SVGKParseResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKParseResult.h; sourceTree = ""; }; + 6649DFC816172CCC00AFE92A /* SVGKParseResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKParseResult.m; sourceTree = ""; }; + 6649DFC916172CCC00AFE92A /* SVGKParserExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKParserExtension.h; sourceTree = ""; }; + 6649DFCA16172CCC00AFE92A /* SVGKParserPatternsAndGradients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKParserPatternsAndGradients.h; sourceTree = ""; }; + 6649DFCB16172CCC00AFE92A /* SVGKParserPatternsAndGradients.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKParserPatternsAndGradients.m; sourceTree = ""; }; + 6649DFCC16172CCC00AFE92A /* SVGKParserSVG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKParserSVG.h; sourceTree = ""; }; + 6649DFCD16172CCC00AFE92A /* SVGKParserSVG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKParserSVG.m; sourceTree = ""; }; + 6649DFCE16172CCC00AFE92A /* SVGKPointsAndPathsParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKPointsAndPathsParser.h; sourceTree = ""; }; + 6649DFCF16172CCC00AFE92A /* SVGKPointsAndPathsParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKPointsAndPathsParser.m; sourceTree = ""; }; + 6649DFD016172CCC00AFE92A /* SVGKImage+SVGPathView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGKImage+SVGPathView.h"; sourceTree = ""; }; + 6649DFD116172CCC00AFE92A /* SVGKImage+SVGPathView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SVGKImage+SVGPathView.m"; sourceTree = ""; }; + 6649DFD216172CCC00AFE92A /* SVGKImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKImage.h; sourceTree = ""; }; + 6649DFD316172CCC00AFE92A /* SVGKImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKImage.m; sourceTree = ""; }; + 6649DFD416172CCC00AFE92A /* SVGKImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKImageView.h; sourceTree = ""; }; + 6649DFD516172CCC00AFE92A /* SVGKImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKImageView.m; sourceTree = ""; }; + 6649DFD616172CCC00AFE92A /* SVGKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKit.h; sourceTree = ""; }; + 6649DFD716172CCC00AFE92A /* SVGKParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKParser.h; sourceTree = ""; }; + 6649DFD816172CCC00AFE92A /* SVGKParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKParser.m; sourceTree = ""; }; + 6649DFD916172CCC00AFE92A /* SVGKPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKPattern.h; sourceTree = ""; }; + 6649DFDA16172CCC00AFE92A /* SVGKPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKPattern.m; sourceTree = ""; }; + 6649DFDB16172CCC00AFE92A /* SVGKSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKSource.h; sourceTree = ""; }; + 6649DFDC16172CCC00AFE92A /* SVGKSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKSource.m; sourceTree = ""; }; + 6649DFDF16172CCC00AFE92A /* SVGUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGUtils.h; sourceTree = ""; }; + 6649DFE016172CCC00AFE92A /* SVGUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGUtils.m; sourceTree = ""; }; + 6649DFE216172CCC00AFE92A /* CALayerWithChildHitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CALayerWithChildHitTest.h; sourceTree = ""; }; + 6649DFE316172CCC00AFE92A /* CALayerWithChildHitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CALayerWithChildHitTest.m; sourceTree = ""; }; + 6649DFE416172CCC00AFE92A /* CAShapeLayerWithHitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAShapeLayerWithHitTest.h; sourceTree = ""; }; + 6649DFE516172CCC00AFE92A /* CAShapeLayerWithHitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CAShapeLayerWithHitTest.m; sourceTree = ""; }; + 6649E05F16172CE200AFE92A /* SVGKit-iOS-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGKit-iOS-Prefix.pch"; sourceTree = ""; }; + 666053211650184000B3B493 /* SVGKFastImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKFastImageView.h; sourceTree = ""; }; + 666053221650184000B3B493 /* SVGKFastImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKFastImageView.m; sourceTree = ""; }; + 666414BE165006F80051A356 /* SVGKLayeredImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKLayeredImageView.h; sourceTree = ""; }; + 666414BF165006F80051A356 /* SVGKLayeredImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKLayeredImageView.m; sourceTree = ""; }; + 666414C216500D900051A356 /* SVGKLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKLayer.h; sourceTree = ""; }; + 666414C316500D900051A356 /* SVGKLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKLayer.m; sourceTree = ""; }; + 66C0132C16179DCC00359714 /* SVGDefsElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDefsElement.h; sourceTree = ""; }; + 66C0132D16179DCC00359714 /* SVGDefsElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDefsElement.m; sourceTree = ""; }; + 66C0133016179E6F00359714 /* SVGUseElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGUseElement.h; sourceTree = ""; }; + 66C0133116179E6F00359714 /* SVGUseElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGUseElement.m; sourceTree = ""; }; + 66C0133416179F4400359714 /* SVGElementInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElementInstance.h; sourceTree = ""; }; + 66C0133516179F4400359714 /* SVGElementInstance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGElementInstance.m; sourceTree = ""; }; + 66C0133816179FD700359714 /* SVGElementInstanceList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElementInstanceList.h; sourceTree = ""; }; + 66C0133916179FD700359714 /* SVGElementInstanceList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGElementInstanceList.m; sourceTree = ""; }; + 66C0133C1617A33000359714 /* SVGKParserDefsAndUse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKParserDefsAndUse.h; sourceTree = ""; }; + 66C0133D1617A33000359714 /* SVGKParserDefsAndUse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGKParserDefsAndUse.m; sourceTree = ""; }; + 66C013401617A52600359714 /* SVGUseElement_Mutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGUseElement_Mutable.h; sourceTree = ""; }; + 66C013421617A8FF00359714 /* SVGElementInstance_Mutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElementInstance_Mutable.h; sourceTree = ""; }; + 66C013441617AA8600359714 /* SVGElementInstanceList_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElementInstanceList_Internal.h; sourceTree = ""; }; + 66E861F1168786900059C9C4 /* CALayerExporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CALayerExporter.h; sourceTree = ""; }; + 66E861F2168786900059C9C4 /* CALayerExporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CALayerExporter.m; sourceTree = ""; }; + 66FED67A165FB9C6006A43F6 /* DOMHelperUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHelperUtilities.h; sourceTree = ""; }; + 66FED67B165FB9C6006A43F6 /* DOMHelperUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DOMHelperUtilities.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6639618B16145D0400E58CCA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6639634716148DEC00E58CCA /* CoreGraphics.framework in Frameworks */, + 6639634216148CDF00E58CCA /* QuartzCore.framework in Frameworks */, + 6639634016145DDC00E58CCA /* libxml2.dylib in Frameworks */, + 6639619216145D0400E58CCA /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6639618316145D0400E58CCA = { + isa = PBXGroup; + children = ( + 6639633E16145D7700E58CCA /* EXTERNAL REFERENCES */, + 6649E05E16172CE200AFE92A /* SVGKit-iOS */, + 6639619016145D0400E58CCA /* Frameworks */, + 6639618F16145D0400E58CCA /* Products */, + ); + sourceTree = ""; + }; + 6639618F16145D0400E58CCA /* Products */ = { + isa = PBXGroup; + children = ( + 6639618E16145D0400E58CCA /* libSVGKit-iOS.a */, + ); + name = Products; + sourceTree = ""; + }; + 6639619016145D0400E58CCA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6639633F16145DDC00E58CCA /* libxml2.dylib */, + 6639634616148DEC00E58CCA /* CoreGraphics.framework */, + 6639634116148CDF00E58CCA /* QuartzCore.framework */, + 6639619116145D0400E58CCA /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 6639633E16145D7700E58CCA /* EXTERNAL REFERENCES */ = { + isa = PBXGroup; + children = ( + 6649DF6B16172CCC00AFE92A /* Source */, + ); + name = "EXTERNAL REFERENCES"; + sourceTree = ""; + }; + 6649DF6B16172CCC00AFE92A /* Source */ = { + isa = PBXGroup; + children = ( + 6649DF6C16172CCC00AFE92A /* Core */, + 6649DFE116172CCC00AFE92A /* iOS */, + ); + path = Source; + sourceTree = ""; + }; + 6649DF6C16172CCC00AFE92A /* Core */ = { + isa = PBXGroup; + children = ( + 6649DF6D16172CCC00AFE92A /* CGPathAdditions.h */, + 6649DF6E16172CCC00AFE92A /* CGPathAdditions.m */, + 6649DF6F16172CCC00AFE92A /* DOM classes */, + 6649DFC616172CCC00AFE92A /* Parsing */, + 6649DFD016172CCC00AFE92A /* SVGKImage+SVGPathView.h */, + 6649DFD116172CCC00AFE92A /* SVGKImage+SVGPathView.m */, + 6649DFD216172CCC00AFE92A /* SVGKImage.h */, + 6649DFD316172CCC00AFE92A /* SVGKImage.m */, + 666053211650184000B3B493 /* SVGKFastImageView.h */, + 666053221650184000B3B493 /* SVGKFastImageView.m */, + 6649DFD416172CCC00AFE92A /* SVGKImageView.h */, + 6649DFD516172CCC00AFE92A /* SVGKImageView.m */, + 666414C216500D900051A356 /* SVGKLayer.h */, + 666414C316500D900051A356 /* SVGKLayer.m */, + 666414BE165006F80051A356 /* SVGKLayeredImageView.h */, + 666414BF165006F80051A356 /* SVGKLayeredImageView.m */, + 6649DFD616172CCC00AFE92A /* SVGKit.h */, + 6649DFD716172CCC00AFE92A /* SVGKParser.h */, + 6649DFD816172CCC00AFE92A /* SVGKParser.m */, + 6649DFD916172CCC00AFE92A /* SVGKPattern.h */, + 6649DFDA16172CCC00AFE92A /* SVGKPattern.m */, + 6649DFDB16172CCC00AFE92A /* SVGKSource.h */, + 6649DFDC16172CCC00AFE92A /* SVGKSource.m */, + 6649DFDF16172CCC00AFE92A /* SVGUtils.h */, + 6649DFE016172CCC00AFE92A /* SVGUtils.m */, + ); + path = Core; + sourceTree = ""; + }; + 6649DF6F16172CCC00AFE92A /* DOM classes */ = { + isa = PBXGroup; + children = ( + 6649DF7016172CCC00AFE92A /* Core DOM */, + 6649DF9216172CCC00AFE92A /* SVG-DOM */, + 6649DFA416172CCC00AFE92A /* SVGCircleElement.h */, + 6649DFA516172CCC00AFE92A /* SVGCircleElement.m */, + 6649DFA816172CCC00AFE92A /* SVGDescriptionElement.h */, + 6649DFA916172CCC00AFE92A /* SVGDescriptionElement.m */, + 6649DFAA16172CCC00AFE92A /* SVGElement.h */, + 6649DFAB16172CCC00AFE92A /* SVGElement.m */, + 6649DFAC16172CCC00AFE92A /* SVGElement_ForParser.h */, + 6649DFAD16172CCC00AFE92A /* SVGEllipseElement.h */, + 6649DFAE16172CCC00AFE92A /* SVGEllipseElement.m */, + 6649DFAF16172CCC00AFE92A /* SVGGroupElement.h */, + 6649DFB016172CCC00AFE92A /* SVGGroupElement.m */, + 6649DFB116172CCC00AFE92A /* SVGImageElement.h */, + 6649DFB216172CCC00AFE92A /* SVGImageElement.m */, + 6649DFB316172CCC00AFE92A /* SVGLayeredElement.h */, + 6649DFB416172CCC00AFE92A /* SVGLineElement.h */, + 6649DFB516172CCC00AFE92A /* SVGLineElement.m */, + 6649DFB616172CCC00AFE92A /* SVGPathElement.h */, + 6649DFB716172CCC00AFE92A /* SVGPathElement.m */, + 6649DFB816172CCC00AFE92A /* SVGPolygonElement.h */, + 6649DFB916172CCC00AFE92A /* SVGPolygonElement.m */, + 6649DFBA16172CCC00AFE92A /* SVGPolylineElement.h */, + 6649DFBB16172CCC00AFE92A /* SVGPolylineElement.m */, + 6649DFBC16172CCC00AFE92A /* SVGRectElement.h */, + 6649DFBD16172CCC00AFE92A /* SVGRectElement.m */, + 6649DFBE16172CCC00AFE92A /* SVGShapeElement.h */, + 6649DFBF16172CCC00AFE92A /* SVGShapeElement.m */, + 6649DFC016172CCC00AFE92A /* SVGSVGElement.h */, + 6649DFC116172CCC00AFE92A /* SVGSVGElement.m */, + 6649DFC216172CCC00AFE92A /* SVGTextElement.h */, + 6649DFC316172CCC00AFE92A /* SVGTextElement.m */, + 6649DFC416172CCC00AFE92A /* SVGTitleElement.h */, + 6649DFC516172CCC00AFE92A /* SVGTitleElement.m */, + ); + path = "DOM classes"; + sourceTree = ""; + }; + 6649DF7016172CCC00AFE92A /* Core DOM */ = { + isa = PBXGroup; + children = ( + 6649DF7116172CCC00AFE92A /* AppleSucksDOMImplementation.h */, + 6649DF7216172CCC00AFE92A /* AppleSucksDOMImplementation.m */, + 6649DF7316172CCC00AFE92A /* Attr.h */, + 6649DF7416172CCC00AFE92A /* Attr.m */, + 6649DF7516172CCC00AFE92A /* CDATASection.h */, + 6649DF7616172CCC00AFE92A /* CDATASection.m */, + 6649DF7716172CCC00AFE92A /* CharacterData.h */, + 6649DF7816172CCC00AFE92A /* CharacterData.m */, + 6649DF7916172CCC00AFE92A /* Comment.h */, + 6649DF7A16172CCC00AFE92A /* Comment.m */, + 6649DF7B16172CCC00AFE92A /* Document+Mutable.h */, + 6649DF7C16172CCC00AFE92A /* Document.h */, + 6649DF7D16172CCC00AFE92A /* Document.m */, + 6649DF7E16172CCC00AFE92A /* DocumentFragment.h */, + 6649DF7F16172CCC00AFE92A /* DocumentFragment.m */, + 6649DF8016172CCC00AFE92A /* DocumentType.h */, + 6649DF8116172CCC00AFE92A /* DocumentType.m */, + 6649DF8216172CCC00AFE92A /* Element.h */, + 6649DF8316172CCC00AFE92A /* Element.m */, + 6649DF8416172CCC00AFE92A /* EntityReference.h */, + 6649DF8516172CCC00AFE92A /* EntityReference.m */, + 6649DF8616172CCC00AFE92A /* NamedNodeMap.h */, + 6649DF8716172CCC00AFE92A /* NamedNodeMap.m */, + 6649DF8816172CCC00AFE92A /* Node+Mutable.h */, + 6649DF8916172CCC00AFE92A /* Node.h */, + 6649DF8A16172CCC00AFE92A /* Node.m */, + 6649DF8B16172CCC00AFE92A /* NodeList+Mutable.h */, + 6649DF8C16172CCC00AFE92A /* NodeList.h */, + 6649DF8D16172CCC00AFE92A /* NodeList.m */, + 6649DF8E16172CCC00AFE92A /* ProcessingInstruction.h */, + 6649DF8F16172CCC00AFE92A /* ProcessingInstruction.m */, + 6649DF9016172CCC00AFE92A /* Text.h */, + 6649DF9116172CCC00AFE92A /* Text.m */, + 66FED67A165FB9C6006A43F6 /* DOMHelperUtilities.h */, + 66FED67B165FB9C6006A43F6 /* DOMHelperUtilities.m */, + ); + path = "Core DOM"; + sourceTree = ""; + }; + 6649DF9216172CCC00AFE92A /* SVG-DOM */ = { + isa = PBXGroup; + children = ( + 6649DF9316172CCC00AFE92A /* SVGAngle.h */, + 6649DF9416172CCC00AFE92A /* SVGAngle.m */, + 66C0132C16179DCC00359714 /* SVGDefsElement.h */, + 66C0132D16179DCC00359714 /* SVGDefsElement.m */, + 6649DF9516172CCC00AFE92A /* SVGDocument.h */, + 6649DF9616172CCC00AFE92A /* SVGDocument.m */, + 6649DF9716172CCC00AFE92A /* SVGDocument_Mutable.h */, + 66C0133416179F4400359714 /* SVGElementInstance.h */, + 66C0133516179F4400359714 /* SVGElementInstance.m */, + 66C013421617A8FF00359714 /* SVGElementInstance_Mutable.h */, + 66C0133816179FD700359714 /* SVGElementInstanceList.h */, + 66C0133916179FD700359714 /* SVGElementInstanceList.m */, + 66C013441617AA8600359714 /* SVGElementInstanceList_Internal.h */, + 6649DF9816172CCC00AFE92A /* SVGLength.h */, + 6649DF9916172CCC00AFE92A /* SVGLength.m */, + 6649DF9A16172CCC00AFE92A /* SVGMatrix.h */, + 6649DF9B16172CCC00AFE92A /* SVGMatrix.m */, + 6649DF9C16172CCC00AFE92A /* SVGNumber.h */, + 6649DF9D16172CCC00AFE92A /* SVGPoint.h */, + 6649DF9E16172CCC00AFE92A /* SVGPoint.m */, + 6649DF9F16172CCC00AFE92A /* SVGRect.h */, + 6649DFA016172CCC00AFE92A /* SVGSVGElement_Mutable.h */, + 6649DFA116172CCC00AFE92A /* SVGTransform.h */, + 6649DFA216172CCC00AFE92A /* SVGTransform.m */, + 66C0133016179E6F00359714 /* SVGUseElement.h */, + 66C0133116179E6F00359714 /* SVGUseElement.m */, + 66C013401617A52600359714 /* SVGUseElement_Mutable.h */, + 6649DFA316172CCC00AFE92A /* SVGViewSpec.h */, + ); + path = "SVG-DOM"; + sourceTree = ""; + }; + 6649DFC616172CCC00AFE92A /* Parsing */ = { + isa = PBXGroup; + children = ( + 6649DFC716172CCC00AFE92A /* SVGKParseResult.h */, + 6649DFC816172CCC00AFE92A /* SVGKParseResult.m */, + 6649DFC916172CCC00AFE92A /* SVGKParserExtension.h */, + 6649DFCA16172CCC00AFE92A /* SVGKParserPatternsAndGradients.h */, + 6649DFCB16172CCC00AFE92A /* SVGKParserPatternsAndGradients.m */, + 6649DFCC16172CCC00AFE92A /* SVGKParserSVG.h */, + 6649DFCD16172CCC00AFE92A /* SVGKParserSVG.m */, + 6649DFCE16172CCC00AFE92A /* SVGKPointsAndPathsParser.h */, + 6649DFCF16172CCC00AFE92A /* SVGKPointsAndPathsParser.m */, + 66C0133C1617A33000359714 /* SVGKParserDefsAndUse.h */, + 66C0133D1617A33000359714 /* SVGKParserDefsAndUse.m */, + 661008911632E30B00DD3C38 /* SVGKParserDOM.h */, + 661008921632E30B00DD3C38 /* SVGKParserDOM.m */, + ); + path = Parsing; + sourceTree = ""; + }; + 6649DFE116172CCC00AFE92A /* iOS */ = { + isa = PBXGroup; + children = ( + 66E861F1168786900059C9C4 /* CALayerExporter.h */, + 66E861F2168786900059C9C4 /* CALayerExporter.m */, + 6649DFE216172CCC00AFE92A /* CALayerWithChildHitTest.h */, + 6649DFE316172CCC00AFE92A /* CALayerWithChildHitTest.m */, + 6649DFE416172CCC00AFE92A /* CAShapeLayerWithHitTest.h */, + 6649DFE516172CCC00AFE92A /* CAShapeLayerWithHitTest.m */, + ); + path = iOS; + sourceTree = ""; + }; + 6649E05E16172CE200AFE92A /* SVGKit-iOS */ = { + isa = PBXGroup; + children = ( + 6649E05F16172CE200AFE92A /* SVGKit-iOS-Prefix.pch */, + ); + name = "SVGKit-iOS"; + path = "XCodeProjectData/SVGKit-iOS"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 6639624616145D3E00E58CCA /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 6649DFE816172CCC00AFE92A /* CGPathAdditions.h in Headers */, + 6649DFEA16172CCC00AFE92A /* AppleSucksDOMImplementation.h in Headers */, + 6649DFEC16172CCC00AFE92A /* Attr.h in Headers */, + 6649DFEE16172CCC00AFE92A /* CDATASection.h in Headers */, + 6649DFF016172CCC00AFE92A /* CharacterData.h in Headers */, + 6649DFF216172CCC00AFE92A /* Comment.h in Headers */, + 6649DFF416172CCC00AFE92A /* Document+Mutable.h in Headers */, + 6649DFF516172CCC00AFE92A /* Document.h in Headers */, + 6649DFF716172CCC00AFE92A /* DocumentFragment.h in Headers */, + 6649DFF916172CCC00AFE92A /* DocumentType.h in Headers */, + 6649DFFB16172CCC00AFE92A /* Element.h in Headers */, + 6649DFFD16172CCC00AFE92A /* EntityReference.h in Headers */, + 6649DFFF16172CCC00AFE92A /* NamedNodeMap.h in Headers */, + 6649E00116172CCC00AFE92A /* Node+Mutable.h in Headers */, + 6649E00216172CCC00AFE92A /* Node.h in Headers */, + 6649E00416172CCC00AFE92A /* NodeList+Mutable.h in Headers */, + 6649E00516172CCC00AFE92A /* NodeList.h in Headers */, + 6649E00716172CCC00AFE92A /* ProcessingInstruction.h in Headers */, + 6649E00916172CCC00AFE92A /* Text.h in Headers */, + 6649E00B16172CCC00AFE92A /* SVGAngle.h in Headers */, + 6649E00D16172CCC00AFE92A /* SVGDocument.h in Headers */, + 6649E00F16172CCC00AFE92A /* SVGDocument_Mutable.h in Headers */, + 6649E01016172CCC00AFE92A /* SVGLength.h in Headers */, + 6649E01216172CCC00AFE92A /* SVGMatrix.h in Headers */, + 6649E01416172CCC00AFE92A /* SVGNumber.h in Headers */, + 6649E01516172CCC00AFE92A /* SVGPoint.h in Headers */, + 6649E01716172CCC00AFE92A /* SVGRect.h in Headers */, + 6649E01816172CCC00AFE92A /* SVGSVGElement_Mutable.h in Headers */, + 6649E01916172CCC00AFE92A /* SVGTransform.h in Headers */, + 6649E01B16172CCC00AFE92A /* SVGViewSpec.h in Headers */, + 6649E01C16172CCC00AFE92A /* SVGCircleElement.h in Headers */, + 6649E02016172CCC00AFE92A /* SVGDescriptionElement.h in Headers */, + 6649E02216172CCC00AFE92A /* SVGElement.h in Headers */, + 6649E02416172CCC00AFE92A /* SVGElement_ForParser.h in Headers */, + 6649E02516172CCC00AFE92A /* SVGEllipseElement.h in Headers */, + 6649E02716172CCC00AFE92A /* SVGGroupElement.h in Headers */, + 6649E02916172CCC00AFE92A /* SVGImageElement.h in Headers */, + 6649E02B16172CCC00AFE92A /* SVGLayeredElement.h in Headers */, + 6649E02C16172CCC00AFE92A /* SVGLineElement.h in Headers */, + 6649E02E16172CCC00AFE92A /* SVGPathElement.h in Headers */, + 6649E03016172CCC00AFE92A /* SVGPolygonElement.h in Headers */, + 6649E03216172CCC00AFE92A /* SVGPolylineElement.h in Headers */, + 6649E03416172CCC00AFE92A /* SVGRectElement.h in Headers */, + 6649E03616172CCC00AFE92A /* SVGShapeElement.h in Headers */, + 6649E03816172CCC00AFE92A /* SVGSVGElement.h in Headers */, + 6649E03A16172CCC00AFE92A /* SVGTextElement.h in Headers */, + 6649E03C16172CCC00AFE92A /* SVGTitleElement.h in Headers */, + 6649E03E16172CCC00AFE92A /* SVGKParseResult.h in Headers */, + 6649E04016172CCC00AFE92A /* SVGKParserExtension.h in Headers */, + 6649E04116172CCC00AFE92A /* SVGKParserPatternsAndGradients.h in Headers */, + 6649E04316172CCC00AFE92A /* SVGKParserSVG.h in Headers */, + 6649E04516172CCC00AFE92A /* SVGKPointsAndPathsParser.h in Headers */, + 6649E04716172CCC00AFE92A /* SVGKImage+SVGPathView.h in Headers */, + 6649E04916172CCC00AFE92A /* SVGKImage.h in Headers */, + 6649E04D16172CCC00AFE92A /* SVGKit.h in Headers */, + 6649E04E16172CCC00AFE92A /* SVGKParser.h in Headers */, + 6649E05016172CCC00AFE92A /* SVGKPattern.h in Headers */, + 6649E05216172CCC00AFE92A /* SVGKSource.h in Headers */, + 6649E05616172CCC00AFE92A /* SVGUtils.h in Headers */, + 6649E05816172CCC00AFE92A /* CALayerWithChildHitTest.h in Headers */, + 6649E05A16172CCC00AFE92A /* CAShapeLayerWithHitTest.h in Headers */, + 661008931632E30B00DD3C38 /* SVGKParserDOM.h in Headers */, + 6649E04B16172CCC00AFE92A /* SVGKImageView.h in Headers */, + 666053231650184000B3B493 /* SVGKFastImageView.h in Headers */, + 666414C0165006F80051A356 /* SVGKLayeredImageView.h in Headers */, + 666414C416500D900051A356 /* SVGKLayer.h in Headers */, + 66FED67C165FB9C6006A43F6 /* DOMHelperUtilities.h in Headers */, + 66E861F3168786900059C9C4 /* CALayerExporter.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 6639618D16145D0400E58CCA /* SVGKit-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6639619C16145D0400E58CCA /* Build configuration list for PBXNativeTarget "SVGKit-iOS" */; + buildPhases = ( + 6639618A16145D0400E58CCA /* Sources */, + 6639618B16145D0400E58CCA /* Frameworks */, + 6639618C16145D0400E58CCA /* CopyFiles */, + 6639624616145D3E00E58CCA /* Headers */, + 663963481614968A00E58CCA /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SVGKit-iOS"; + productName = "SVGKit-iOS"; + productReference = 6639618E16145D0400E58CCA /* libSVGKit-iOS.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6639618516145D0400E58CCA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0440; + ORGANIZATIONNAME = na; + }; + buildConfigurationList = 6639618816145D0400E58CCA /* Build configuration list for PBXProject "SVGKit-iOS" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 6639618316145D0400E58CCA; + productRefGroup = 6639618F16145D0400E58CCA /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6639618D16145D0400E58CCA /* SVGKit-iOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + 663963481614968A00E58CCA /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#\n# c.f. StackOverflow question/answer here: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4\n#\n# Version 2.3\n#\n# Latest Change:\n# - Apple's handling of \"project files\" is broken; added a workaround for Xcode 4.5\n# - Added automatic FAIL BUILD if any of the internal commands fail\n# \n# Purpose:\n# Create a static library for iPhone from within XCode\n# Because Apple staff DELIBERATELY broke Xcode to make this impossible from the GUI (Xcode 3.2.3 specifically states this in the Release notes!)\n# ...no, I don't understand why they did this!\n#\n# Author: Adam Martin - http://twitter.com/redglassesapps\n# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER)\n#\n\nset -e\nset -o pipefail\n\n#################[ Tests: helps workaround any future bugs in Xcode ]########\n#\nDEBUG_THIS_SCRIPT=\"true\"\n\nif [ $DEBUG_THIS_SCRIPT = \"true\" ]\nthen\necho \"########### TESTS #############\"\necho \"Use the following variables when debugging this script; note that they may change on recursions\"\necho \"BUILD_DIR = $BUILD_DIR\"\necho \"BUILD_ROOT = $BUILD_ROOT\"\necho \"CONFIGURATION_BUILD_DIR = $CONFIGURATION_BUILD_DIR\"\necho \"BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR\"\necho \"CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR\"\necho \"TARGET_BUILD_DIR = $TARGET_BUILD_DIR\"\nfi\n\n#####################[ part 1 ]##################\n# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it)\n# (incidental: searching for substrings in sh is a nightmare! Sob)\n\nSDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\\{3\\}$')\n\n# Next, work out if we're in SIM or DEVICE\n\nif [ ${PLATFORM_NAME} = \"iphonesimulator\" ]\nthen\nOTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION}\nelse\nOTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION}\nfi\n\necho \"XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})\"\necho \"...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}\"\n#\n#####################[ end of part 1 ]##################\n\n#####################[ part 2 ]##################\n#\n# IF this is the original invocation, invoke WHATEVER other builds are required\n#\n# Xcode is already building ONE target...\n#\n# ...but this is a LIBRARY, so Apple is wrong to set it to build just one.\n# ...we need to build ALL targets\n# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!)\n#\n#\n# So: build ONLY the missing platforms/configurations.\n\nif [ \"true\" == ${ALREADYINVOKED:-false} ]\nthen\necho \"RECURSION: I am NOT the root invocation, so I'm NOT going to recurse\"\nelse\n# CRITICAL:\n# Prevent infinite recursion (Xcode sucks)\nexport ALREADYINVOKED=\"true\"\n\necho \"RECURSION: I am the root ... recursing all missing build targets NOW...\"\necho \"RECURSION: ...about to invoke: xcodebuild -configuration \\\"${CONFIGURATION}\\\" -project \\\"${PROJECT_NAME}.xcodeproj\\\" -target \\\"${TARGET_NAME}\\\" -sdk \\\"${OTHER_SDK_TO_BUILD}\\\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO\" BUILD_DIR=\\\"${BUILD_DIR}\\\" BUILD_ROOT=\\\"${BUILD_ROOT}\\\"\n\nxcodebuild -configuration \"${CONFIGURATION}\" -project \"${PROJECT_NAME}.xcodeproj\" -target \"${TARGET_NAME}\" -sdk \"${OTHER_SDK_TO_BUILD}\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\"\n\nACTION=\"build\"\n\n#Merge all platform binaries as a fat binary for each configurations.\n\n# Calculate where the (multiple) built files are coming from:\nCURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos\nCURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator\n\necho \"Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}\"\necho \"Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}\"\n\nCREATING_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION}-universal\necho \"...I will output a universal build to: ${CREATING_UNIVERSAL_DIR}\"\n\n# ... remove the products of previous runs of this script\n# NB: this directory is ONLY created by this script - it should be safe to delete!\n\nrm -rf \"${CREATING_UNIVERSAL_DIR}\"\nmkdir \"${CREATING_UNIVERSAL_DIR}\"\n\n#\necho \"Abou to call: lipo -create -output \\\"${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}\\\" \\\"${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}\\\" \\\"${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}\\\"\"\n\nlipo -create -output \"${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}\" \"${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}\" \"${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}\"\n\n#########\n#\n# Added: StackOverflow suggestion to also copy \"include\" files\n# (untested, but should work OK)\n#\nif [ -d \"${CURRENTCONFIG_DEVICE_DIR}/usr/local/include\" ]\nthen\nmkdir -p \"${CREATING_UNIVERSAL_DIR}/usr/local/include\"\n# * needs to be outside the double quotes?\ncp -r \"${CURRENTCONFIG_DEVICE_DIR}/usr/local/include/\"* \"${CREATING_UNIVERSAL_DIR}/usr/local/include\"\nfi\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6639618A16145D0400E58CCA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6649DFE916172CCC00AFE92A /* CGPathAdditions.m in Sources */, + 6649DFEB16172CCC00AFE92A /* AppleSucksDOMImplementation.m in Sources */, + 6649DFED16172CCC00AFE92A /* Attr.m in Sources */, + 6649DFEF16172CCC00AFE92A /* CDATASection.m in Sources */, + 6649DFF116172CCC00AFE92A /* CharacterData.m in Sources */, + 6649DFF316172CCC00AFE92A /* Comment.m in Sources */, + 6649DFF616172CCC00AFE92A /* Document.m in Sources */, + 6649DFF816172CCC00AFE92A /* DocumentFragment.m in Sources */, + 6649DFFA16172CCC00AFE92A /* DocumentType.m in Sources */, + 6649DFFC16172CCC00AFE92A /* Element.m in Sources */, + 6649DFFE16172CCC00AFE92A /* EntityReference.m in Sources */, + 6649E00016172CCC00AFE92A /* NamedNodeMap.m in Sources */, + 6649E00316172CCC00AFE92A /* Node.m in Sources */, + 6649E00616172CCC00AFE92A /* NodeList.m in Sources */, + 6649E00816172CCC00AFE92A /* ProcessingInstruction.m in Sources */, + 6649E00A16172CCC00AFE92A /* Text.m in Sources */, + 6649E00C16172CCC00AFE92A /* SVGAngle.m in Sources */, + 6649E00E16172CCC00AFE92A /* SVGDocument.m in Sources */, + 6649E01116172CCC00AFE92A /* SVGLength.m in Sources */, + 6649E01316172CCC00AFE92A /* SVGMatrix.m in Sources */, + 6649E01616172CCC00AFE92A /* SVGPoint.m in Sources */, + 6649E01A16172CCC00AFE92A /* SVGTransform.m in Sources */, + 6649E01D16172CCC00AFE92A /* SVGCircleElement.m in Sources */, + 6649E02116172CCC00AFE92A /* SVGDescriptionElement.m in Sources */, + 6649E02316172CCC00AFE92A /* SVGElement.m in Sources */, + 6649E02616172CCC00AFE92A /* SVGEllipseElement.m in Sources */, + 6649E02816172CCC00AFE92A /* SVGGroupElement.m in Sources */, + 6649E02A16172CCC00AFE92A /* SVGImageElement.m in Sources */, + 6649E02D16172CCC00AFE92A /* SVGLineElement.m in Sources */, + 6649E02F16172CCC00AFE92A /* SVGPathElement.m in Sources */, + 6649E03116172CCC00AFE92A /* SVGPolygonElement.m in Sources */, + 6649E03316172CCC00AFE92A /* SVGPolylineElement.m in Sources */, + 6649E03516172CCC00AFE92A /* SVGRectElement.m in Sources */, + 6649E03716172CCC00AFE92A /* SVGShapeElement.m in Sources */, + 6649E03916172CCC00AFE92A /* SVGSVGElement.m in Sources */, + 6649E03B16172CCC00AFE92A /* SVGTextElement.m in Sources */, + 6649E03D16172CCC00AFE92A /* SVGTitleElement.m in Sources */, + 6649E03F16172CCC00AFE92A /* SVGKParseResult.m in Sources */, + 6649E04216172CCC00AFE92A /* SVGKParserPatternsAndGradients.m in Sources */, + 6649E04416172CCC00AFE92A /* SVGKParserSVG.m in Sources */, + 6649E04616172CCC00AFE92A /* SVGKPointsAndPathsParser.m in Sources */, + 6649E04816172CCC00AFE92A /* SVGKImage+SVGPathView.m in Sources */, + 6649E04A16172CCC00AFE92A /* SVGKImage.m in Sources */, + 6649E04C16172CCC00AFE92A /* SVGKImageView.m in Sources */, + 6649E04F16172CCC00AFE92A /* SVGKParser.m in Sources */, + 6649E05116172CCC00AFE92A /* SVGKPattern.m in Sources */, + 6649E05316172CCC00AFE92A /* SVGKSource.m in Sources */, + 6649E05716172CCC00AFE92A /* SVGUtils.m in Sources */, + 6649E05916172CCC00AFE92A /* CALayerWithChildHitTest.m in Sources */, + 6649E05B16172CCC00AFE92A /* CAShapeLayerWithHitTest.m in Sources */, + 66C0132F16179DCC00359714 /* SVGDefsElement.m in Sources */, + 66C0133316179E6F00359714 /* SVGUseElement.m in Sources */, + 66C0133716179F4400359714 /* SVGElementInstance.m in Sources */, + 66C0133B16179FD700359714 /* SVGElementInstanceList.m in Sources */, + 66C0133F1617A33000359714 /* SVGKParserDefsAndUse.m in Sources */, + 661008941632E30B00DD3C38 /* SVGKParserDOM.m in Sources */, + 666414C1165006F80051A356 /* SVGKLayeredImageView.m in Sources */, + 666414C516500D900051A356 /* SVGKLayer.m in Sources */, + 666053241650184000B3B493 /* SVGKFastImageView.m in Sources */, + 66FED67D165FB9C6006A43F6 /* DOMHelperUtilities.m in Sources */, + 66E861F4168786900059C9C4 /* CALayerExporter.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 6639619A16145D0400E58CCA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 6639619B16145D0400E58CCA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6639619D16145D0400E58CCA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/SVGKit_iOS.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "XCodeProjectData/SVGKit-iOS/SVGKit-iOS-Prefix.pch"; + HEADER_SEARCH_PATHS = /usr/include/libxml2; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/Source/Core\"", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 6639619E16145D0400E58CCA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/SVGKit_iOS.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "XCodeProjectData/SVGKit-iOS/SVGKit-iOS-Prefix.pch"; + HEADER_SEARCH_PATHS = /usr/include/libxml2; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/Source/Core\"", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6639618816145D0400E58CCA /* Build configuration list for PBXProject "SVGKit-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6639619A16145D0400E58CCA /* Debug */, + 6639619B16145D0400E58CCA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6639619C16145D0400E58CCA /* Build configuration list for PBXNativeTarget "SVGKit-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6639619D16145D0400E58CCA /* Debug */, + 6639619E16145D0400E58CCA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6639618516145D0400E58CCA /* Project object */; +} diff --git a/RenderedSamples/Monkey.png b/Samples/Bitmap/Monkey.png similarity index 100% rename from RenderedSamples/Monkey.png rename to Samples/Bitmap/Monkey.png diff --git a/RenderedSamples/Note.png b/Samples/Bitmap/Note.png similarity index 100% rename from RenderedSamples/Note.png rename to Samples/Bitmap/Note.png diff --git a/Samples/Blank_Map-Africa.svg b/Samples/SVG/Blank_Map-Africa.svg similarity index 100% rename from Samples/Blank_Map-Africa.svg rename to Samples/SVG/Blank_Map-Africa.svg diff --git a/Samples/CurvedDiamond.svg b/Samples/SVG/CurvedDiamond.svg similarity index 100% rename from Samples/CurvedDiamond.svg rename to Samples/SVG/CurvedDiamond.svg diff --git a/Samples/map-test-Location_European_nation_states-adam1.svg b/Samples/SVG/Europe_states_reduced.svg similarity index 99% rename from Samples/map-test-Location_European_nation_states-adam1.svg rename to Samples/SVG/Europe_states_reduced.svg index 095eb9659..4f4381bfc 100644 --- a/Samples/map-test-Location_European_nation_states-adam1.svg +++ b/Samples/SVG/Europe_states_reduced.svg @@ -16,12 +16,12 @@ id="svg6785" sodipodi:version="0.32" inkscape:version="0.48+devel r9812" - sodipodi:docname="map-test-Location_European_nation_states-adam1.svg" + sodipodi:docname="a1-Location_European_nation_states.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.0">image/svg+xml + @@ -593,21 +606,7 @@ - - - + diff --git a/Samples/Lion.svg b/Samples/SVG/Lion.svg similarity index 100% rename from Samples/Lion.svg rename to Samples/SVG/Lion.svg diff --git a/Samples/Location_European_nation_states.svg b/Samples/SVG/Location_European_nation_states.svg similarity index 100% rename from Samples/Location_European_nation_states.svg rename to Samples/SVG/Location_European_nation_states.svg diff --git a/Samples/Map.svg b/Samples/SVG/Map.svg similarity index 100% rename from Samples/Map.svg rename to Samples/SVG/Map.svg diff --git a/Samples/SVG/MathCurve.svg b/Samples/SVG/MathCurve.svg new file mode 100644 index 000000000..ac8ad2bdb --- /dev/null +++ b/Samples/SVG/MathCurve.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/Samples/Monkey.svg b/Samples/SVG/Monkey.svg similarity index 94% rename from Samples/Monkey.svg rename to Samples/SVG/Monkey.svg index 70581da8f..3edb5b430 100644 --- a/Samples/Monkey.svg +++ b/Samples/SVG/Monkey.svg @@ -19,7 +19,7 @@ - + diff --git a/Samples/Note.svg b/Samples/SVG/Note.svg similarity index 100% rename from Samples/Note.svg rename to Samples/SVG/Note.svg diff --git a/Samples/SVG/Reinel_compass_rose-ADAM.svg b/Samples/SVG/Reinel_compass_rose-ADAM.svg new file mode 100644 index 000000000..ddfa469ac --- /dev/null +++ b/Samples/SVG/Reinel_compass_rose-ADAM.svg @@ -0,0 +1,206 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/SVG/Reinel_compass_rose.svg b/Samples/SVG/Reinel_compass_rose.svg new file mode 100644 index 000000000..6a6f3270d --- /dev/null +++ b/Samples/SVG/Reinel_compass_rose.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/Text.svg b/Samples/SVG/Text.svg similarity index 100% rename from Samples/Text.svg rename to Samples/SVG/Text.svg diff --git a/Samples/map-test-australia_states_blank.svg b/Samples/SVG/australia_states_blank.svg similarity index 100% rename from Samples/map-test-australia_states_blank.svg rename to Samples/SVG/australia_states_blank.svg diff --git a/Samples/SVG/breaking-1.svg b/Samples/SVG/breaking-1.svg new file mode 100644 index 000000000..e8cd9ecf7 --- /dev/null +++ b/Samples/SVG/breaking-1.svg @@ -0,0 +1,491 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 km + + + + + + 1000 km + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 mi + + + + + + 1000 mi + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/SVG/imageWithASinglePointPath.svg b/Samples/SVG/imageWithASinglePointPath.svg new file mode 100644 index 000000000..bf350f2a3 --- /dev/null +++ b/Samples/SVG/imageWithASinglePointPath.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Samples/test-wave-1.svg b/Samples/SVG/test-wave-1.svg similarity index 100% rename from Samples/test-wave-1.svg rename to Samples/SVG/test-wave-1.svg diff --git a/Samples/map-test-Location_European_nation_states-ukonly.svg b/Samples/SVG/uk-only.svg similarity index 100% rename from Samples/map-test-Location_European_nation_states-ukonly.svg rename to Samples/SVG/uk-only.svg diff --git a/Samples/SVG/voies.svg b/Samples/SVG/voies.svg new file mode 100644 index 000000000..783b89e77 --- /dev/null +++ b/Samples/SVG/voies.svg @@ -0,0 +1,103 @@ + + + +image/svg+xml + + + + + + \ No newline at end of file diff --git a/Samples/Sample Licenses.txt b/Samples/Sample Licenses.txt index 071ee972a..52707a389 100644 --- a/Samples/Sample Licenses.txt +++ b/Samples/Sample Licenses.txt @@ -2,6 +2,22 @@ This file exists to document where each sample file came from, in case anyone ne Also, it's helpful to know which SVG-editing software created / exported each file - helps us to check compatibility with particular editors. +URL'S INCLUDED IN SVGKit: +----------- + - NB: we are NOT embedding these, so we do NOT have to license them, but FYI here are the original sources: + +http://upload.wikimedia.org/wikipedia/commons/f/f9/BlankMap-Africa.svg + -- Public Domain, author: http://commons.wikimedia.org/wiki/User:Lokal_Profil + -- http://commons.wikimedia.org/w/index.php?title=File:BlankMap-Africa.svg&page=1 + + +FILES INCLUDED IN SVGKit: +----------- + +australia_states_blank.svg + -- Creative Commons + -- http://commons.wikimedia.org/wiki/File:Australia_states_blank.svg + Blank_Map-Africa.svg -- Public Domain, c.f. - http://en.wikipedia.org/wiki/File:Blank_Map-Africa.svg @@ -9,6 +25,9 @@ CurvedDiamond.svg -- Public Domain, author: Adam Martin (http://t-machine.org) -- Created by: Inkscape +imageWithASinglePointPath.svg + -- Public Domain, author: Eric Shapiro (https://github.com/EricShapiro) + Lion.svg -- ??? Unknown, probably Public Domain. Same file as this one on Mozilla.org: http://www-archive.mozilla.org/projects/svg/lion.svg @@ -18,4 +37,11 @@ test-wave-1.svg Location_European_nation_states -- Creative Commons - -- http://en.wikipedia.org/wiki/File:Location_European_nation_states.svg \ No newline at end of file + -- http://en.wikipedia.org/wiki/File:Location_European_nation_states.svg + + uk-only.svg, Europe_states_reduced.svg + -- Adam Martin's modified versions of Location_European_nation_states, same license + +Reinel_compass_rose.svg + -- Creative Commons + -- http://commons.wikimedia.org/wiki/File:Reinel_compass_rose.svg diff --git a/Core/CGPathAdditions.h b/Source/Core/CGPathAdditions.h similarity index 100% rename from Core/CGPathAdditions.h rename to Source/Core/CGPathAdditions.h diff --git a/Core/CGPathAdditions.m b/Source/Core/CGPathAdditions.m similarity index 100% rename from Core/CGPathAdditions.m rename to Source/Core/CGPathAdditions.m diff --git a/Source/Core/DOM classes/Core DOM/AppleSucksDOMImplementation.h b/Source/Core/DOM classes/Core DOM/AppleSucksDOMImplementation.h new file mode 100644 index 000000000..f684956c2 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/AppleSucksDOMImplementation.h @@ -0,0 +1,42 @@ +/* + PLEASE NOTE: Apple has made a PRIVATE implementation of this class, and because of their + stupid App Store rules they ban everyone else in the world from using a class with the + same name. Instead of making the class public, they have stolen it out of the global + namespace. This is the wrong thing to do, but we are required to rename our classes + because of this. + + SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 + + interface DOMImplementation { + boolean hasFeature(in DOMString feature, + in DOMString version); + // Introduced in DOM Level 2: + DocumentType createDocumentType(in DOMString qualifiedName, + in DOMString publicId, + in DOMString systemId) + raises(DOMException); + // Introduced in DOM Level 2: + Document createDocument(in DOMString namespaceURI, + in DOMString qualifiedName, + in DocumentType doctype) + raises(DOMException); + }; +*/ + +#import + +#import "DocumentType.h" + +@interface AppleSucksDOMImplementation : NSObject + +-(BOOL) hasFeature:(NSString*) feature version:(NSString*) version; + +// Introduced in DOM Level 2: +-(DocumentType*) createDocumentType:(NSString*) qualifiedName publicId:(NSString*) publicId systemId:(NSString*) systemId; + +// Introduced in DOM Level 2: +-(Document*) createDocument:(NSString*) namespaceURI qualifiedName:(NSString*) qualifiedName doctype:(DocumentType*) doctype; + +@end diff --git a/Source/Core/DOM classes/Core DOM/AppleSucksDOMImplementation.m b/Source/Core/DOM classes/Core DOM/AppleSucksDOMImplementation.m new file mode 100644 index 000000000..40d34d740 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/AppleSucksDOMImplementation.m @@ -0,0 +1,33 @@ + +#import "AppleSucksDOMImplementation.h" + +@implementation AppleSucksDOMImplementation + +-(BOOL) hasFeature:(NSString*) feature version:(NSString*) version +{ + NSAssert( FALSE, @"Apple has made a private class with the same name as this class - we have to rename it because ObjectiveC sucks, and Apple used a foolish name, so we CANNOT adhere to the spec now" ); + + NSAssert( FALSE, @"Not implemented yet" ); + return FALSE; +} + +// Introduced in DOM Level 2: +-(DocumentType*) createDocumentType:(NSString*) qualifiedName publicId:(NSString*) publicId systemId:(NSString*) systemId +{ + NSAssert( FALSE, @"Apple has made a private class with the same name as this class - we have to rename it because ObjectiveC sucks, and Apple used a foolish name, so we CANNOT adhere to the spec now" ); + + NSAssert( FALSE, @"Not implemented yet" ); + return nil; +} + + +// Introduced in DOM Level 2: +-(Document*) createDocument:(NSString*) namespaceURI qualifiedName:(NSString*) qualifiedName doctype:(DocumentType*) doctype +{ + NSAssert( FALSE, @"Apple has made a private class with the same name as this class - we have to rename it because ObjectiveC sucks, and Apple used a foolish name, so we CANNOT adhere to the spec now" ); + + NSAssert( FALSE, @"Not implemented yet" ); + return nil; +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/Attr.h b/Source/Core/DOM classes/Core DOM/Attr.h new file mode 100644 index 000000000..4802d7926 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Attr.h @@ -0,0 +1,38 @@ +/* + SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-637646024 + + interface Attr : Node { + readonly attribute DOMString name; + readonly attribute boolean specified; + attribute DOMString value; + // raises(DOMException) on setting + + // Introduced in DOM Level 2: + readonly attribute Element ownerElement; + }; +*/ +#import + +/** objc won't allow this: @class Node;*/ +#import "Node.h" +@class Element; +#import "Element.h" + +@interface Attr : Node + +/*! NB: The official DOM spec FAILS TO SPECIFY what the value of "name" is */ +@property(nonatomic,retain,readonly) NSString* name; +@property(nonatomic,readonly) BOOL specified; +@property(nonatomic,retain,readonly) NSString* value; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readonly) Element* ownerElement; + +#pragma mark - ObjC methods + +- (id)initWithName:(NSString*) n value:(NSString*) v; +- (id)initWithNamespace:(NSString*) ns qualifiedName:(NSString*) qn value:(NSString*) v; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Attr.m b/Source/Core/DOM classes/Core DOM/Attr.m new file mode 100644 index 000000000..f7f81a36e --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Attr.m @@ -0,0 +1,59 @@ +// +// Attr.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "Attr.h" + +#import "Node+Mutable.h" + +@interface Attr() + @property(nonatomic,retain,readwrite) NSString* name; + @property(nonatomic,readwrite) BOOL specified; + @property(nonatomic,retain,readwrite) NSString* value; + + // Introduced in DOM Level 2: + @property(nonatomic,retain,readwrite) Element* ownerElement; +@end + +@implementation Attr + +@synthesize name; +@synthesize specified; +@synthesize value; + +// Introduced in DOM Level 2: +@synthesize ownerElement; + +- (id)initWithName:(NSString*) n value:(NSString*) v +{ + self = [super initType:SKNodeType_ATTRIBUTE_NODE name:n value:v]; + if (self) + { + self.name = n; + self.value = v; + } + return self; +} + +- (id)initWithNamespace:(NSString*) ns qualifiedName:(NSString*) qn value:(NSString *)v +{ + self = [super initType:SKNodeType_ATTRIBUTE_NODE name:qn value:v inNamespace:ns]; + if (self) + { + self.name = qn; + self.value = v; + } + return self; +} + +- (void)dealloc { + self.name = nil; + self.value = nil; + [super dealloc]; +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/CDATASection.h b/Source/Core/DOM classes/Core DOM/CDATASection.h new file mode 100644 index 000000000..36de5cf43 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/CDATASection.h @@ -0,0 +1,18 @@ +/* + From SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-667469212 + + interface CDATASection : Text { + }; + */ +#import + +@class Text; +#import "Text.h" + +@interface CDATASection : Text + +- (id)initWithValue:(NSString*) v; + +@end diff --git a/Source/Core/DOM classes/Core DOM/CDATASection.m b/Source/Core/DOM classes/Core DOM/CDATASection.m new file mode 100644 index 000000000..47b08b8aa --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/CDATASection.m @@ -0,0 +1,20 @@ +// +// CDATASection.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "CDATASection.h" + +@implementation CDATASection + +- (id)initWithValue:(NSString*) v +{ + self = [super initType:SKNodeType_CDATA_SECTION_NODE name:@"#cdata-section" value:v]; + if (self) { + } + return self; +} +@end diff --git a/Source/Core/DOM classes/Core DOM/CharacterData.h b/Source/Core/DOM classes/Core DOM/CharacterData.h new file mode 100644 index 000000000..bc8c4a30e --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/CharacterData.h @@ -0,0 +1,48 @@ +/* + From SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-FF21A306 + + interface CharacterData : Node { + attribute DOMString data; + // raises(DOMException) on setting + // raises(DOMException) on retrieval + + readonly attribute unsigned long length; + DOMString substringData(in unsigned long offset, + in unsigned long count) + raises(DOMException); + void appendData(in DOMString arg) + raises(DOMException); + void insertData(in unsigned long offset, + in DOMString arg) + raises(DOMException); + void deleteData(in unsigned long offset, + in unsigned long count) + raises(DOMException); + void replaceData(in unsigned long offset, + in unsigned long count, + in DOMString arg) + raises(DOMException); + }; + + */ + +#import + +/** objc won't allow this: @class Node;*/ +#import "Node.h" + +@interface CharacterData : Node + +@property(nonatomic,retain,readonly) NSString* data; + +@property(nonatomic,readonly) unsigned long length; + +-(NSString*) substringData:(unsigned long) offset count:(unsigned long) count; +-(void) appendData:(NSString*) arg; +-(void) insertData:(unsigned long) offset arg:(NSString*) arg; +-(void) deleteData:(unsigned long) offset count:(unsigned long) count; +-(void) replaceData:(unsigned long) offset count:(unsigned long) count arg:(NSString*) arg; + +@end diff --git a/Source/Core/DOM classes/Core DOM/CharacterData.m b/Source/Core/DOM classes/Core DOM/CharacterData.m new file mode 100644 index 000000000..90e999a5c --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/CharacterData.m @@ -0,0 +1,40 @@ +// +// CharacterData.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "CharacterData.h" + +@implementation CharacterData + +@synthesize data; + +@synthesize length; + +-(NSString*) substringData:(unsigned long) offset count:(unsigned long) count +{ + NSAssert( FALSE, @"Not implemented yet" ); + return nil; +} + +-(void) appendData:(NSString*) arg +{ + NSAssert( FALSE, @"Not implemented yet" ); +} +-(void) insertData:(unsigned long) offset arg:(NSString*) arg +{ + NSAssert( FALSE, @"Not implemented yet" ); +} +-(void) deleteData:(unsigned long) offset count:(unsigned long) count +{ + NSAssert( FALSE, @"Not implemented yet" ); +} +-(void) replaceData:(unsigned long) offset count:(unsigned long) count arg:(NSString*) arg +{ + NSAssert( FALSE, @"Not implemented yet" ); +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/Comment.h b/Source/Core/DOM classes/Core DOM/Comment.h new file mode 100644 index 000000000..1c8e18a14 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Comment.h @@ -0,0 +1,18 @@ +/* + From SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1728279322 + + interface Comment : CharacterData { + }; +*/ + +#import + +#import "CharacterData.h" + +@interface Comment : CharacterData + +- (id)initWithValue:(NSString*) v; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Comment.m b/Source/Core/DOM classes/Core DOM/Comment.m new file mode 100644 index 000000000..2723281c6 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Comment.m @@ -0,0 +1,21 @@ +// +// Comment.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "Comment.h" + +@implementation Comment + +- (id)initWithValue:(NSString*) v +{ + self = [super initType:SKNodeType_COMMENT_NODE name:@"#comment" value:v]; + if (self) { + } + return self; +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/DOMHelperUtilities.h b/Source/Core/DOM classes/Core DOM/DOMHelperUtilities.h new file mode 100644 index 000000000..d5b10f229 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/DOMHelperUtilities.h @@ -0,0 +1,23 @@ +/** + There are some shared methods in DOM specification, where two classes have the same method, but + are NOT subclass/superclass of each other. This is very bad from OOP design POV, because it means + we end up with copy/paste duplicated code, very VERY likely to gain long term bugs. + + Also, those methods REQUIRE a second, recursive, method or else you can't implement them easily. + + So, we move their implementations into this helper class, so they can share implementation. + + (c.f. Element vs Document - identical methods for getElementsByName) + */ +#import + +@class Node, NodeList; // avoiding #import here, to avoid C header loop problems. + +@interface DOMHelperUtilities : NSObject + +/*! This useful method provides both the DOM level 1 and the DOM level 2 implementations of searching the tree for a node - because THEY ARE DIFFERENT + yet very similar + */ ++(void) privateGetElementsByName:(NSString*) name inNamespace:(NSString*) namespaceURI childrenOfElement:(Node*) parent addToList:(NodeList*) accumulator; + +@end diff --git a/Source/Core/DOM classes/Core DOM/DOMHelperUtilities.m b/Source/Core/DOM classes/Core DOM/DOMHelperUtilities.m new file mode 100644 index 000000000..05ec12afb --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/DOMHelperUtilities.m @@ -0,0 +1,57 @@ +#import "DOMHelperUtilities.h" + +#import "Element.h" +#import "NodeList.h" +#import "NodeList+Mutable.h" // needed for access to underlying array, because SVG doesnt specify how lists are made mutable + +@implementation DOMHelperUtilities + +/*! This useful method provides both the DOM level 1 and the DOM level 2 implementations of searching the tree for a node - because THEY ARE DIFFERENT + yet very similar + */ ++(void) privateGetElementsByName:(NSString*) name inNamespace:(NSString*) namespaceURI childrenOfElement:(Node*) parent addToList:(NodeList*) accumulator +{ + /** According to spec, this is only valid for ELEMENT nodes */ + if( [parent isKindOfClass:[Element class]] ) + { + if( namespaceURI != nil && ! [parent.namespaceURI isEqualToString:namespaceURI] ) + { + // skip + } + else + { + Element* parentAsElement = (Element*) parent; + + /** According to spec, "tag name" for an Element is the value of its .nodeName property; that means SOMETIMES its a qualified name! */ + BOOL includeThisNode = FALSE; + + + if( [name isEqualToString:@"*"] ) + includeThisNode = TRUE; + + if( !includeThisNode ) + { + if( namespaceURI == nil ) // No namespace? then do a qualified compare + { + includeThisNode = [parentAsElement.tagName isEqualToString:name]; + } + else // namespace? then do an UNqualified compare + { + includeThisNode = [parentAsElement.localName isEqualToString:name]; + } + } + + if( includeThisNode ) + { + [accumulator.internalArray addObject:parent]; + } + } + } + + for( Node* childNode in parent.childNodes ) + { + [self privateGetElementsByName:name inNamespace:namespaceURI childrenOfElement:childNode addToList:accumulator]; + } +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/Document+Mutable.h b/Source/Core/DOM classes/Core DOM/Document+Mutable.h new file mode 100644 index 000000000..72a04c6dd --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Document+Mutable.h @@ -0,0 +1,7 @@ +#import "Document.h" + +@interface Document () + +@property(nonatomic,retain,readwrite) Element* documentElement; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Document.h b/Source/Core/DOM classes/Core DOM/Document.h new file mode 100644 index 000000000..2bb20458c --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Document.h @@ -0,0 +1,111 @@ +/* +// Document.h + + NOT a Cocoa / Apple document, + NOT an SVG document, + BUT INSTEAD: a DOM document (blame w3.org for the too-generic name). + + Required for SVG-DOM + + c.f.: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#i-Document + + interface Document : Node { + readonly attribute DocumentType doctype; + readonly attribute DOMImplementation implementation; + readonly attribute Element documentElement; + Element createElement(in DOMString tagName) + raises(DOMException); + DocumentFragment createDocumentFragment(); + Text createTextNode(in DOMString data); + Comment createComment(in DOMString data); + CDATASection createCDATASection(in DOMString data) + raises(DOMException); + ProcessingInstruction createProcessingInstruction(in DOMString target, + in DOMString data) + raises(DOMException); + Attr createAttribute(in DOMString name) + raises(DOMException); + EntityReference createEntityReference(in DOMString name) + raises(DOMException); + NodeList getElementsByTagName(in DOMString tagname); + // Introduced in DOM Level 2: + Node importNode(in Node importedNode, + in boolean deep) + raises(DOMException); + // Introduced in DOM Level 2: + Element createElementNS(in DOMString namespaceURI, + in DOMString qualifiedName) + raises(DOMException); + // Introduced in DOM Level 2: + Attr createAttributeNS(in DOMString namespaceURI, + in DOMString qualifiedName) + raises(DOMException); + // Introduced in DOM Level 2: + NodeList getElementsByTagNameNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + Element getElementById(in DOMString elementId); + }; + + + */ + +#import + +/** ObjectiveC won't allow this: @class Node; */ +#import "Node.h" +@class Element; +#import "Element.h" +@class Comment; +#import "Comment.h" +@class CDATASection; +#import "CDATASection.h" +@class DocumentFragment; +#import "DocumentFragment.h" +@class EntityReference; +#import "EntityReference.h" +@class NodeList; +#import "NodeList.h" +@class ProcessingInstruction; +#import "ProcessingInstruction.h" +@class DocumentType; +#import "DocumentType.h" +@class AppleSucksDOMImplementation; +#import "AppleSucksDOMImplementation.h" + +@interface Document : Node + +@property(nonatomic,retain,readonly) DocumentType* doctype; +@property(nonatomic,retain,readonly) AppleSucksDOMImplementation* implementation; +@property(nonatomic,retain,readonly) Element* documentElement; + + +-(Element*) createElement:(NSString*) tagName __attribute__((ns_returns_retained)); +-(DocumentFragment*) createDocumentFragment __attribute__((ns_returns_retained)); +-(Text*) createTextNode:(NSString*) data __attribute__((ns_returns_retained)); +-(Comment*) createComment:(NSString*) data __attribute__((ns_returns_retained)); +-(CDATASection*) createCDATASection:(NSString*) data __attribute__((ns_returns_retained)); +-(ProcessingInstruction*) createProcessingInstruction:(NSString*) target data:(NSString*) data __attribute__((ns_returns_retained)); +-(Attr*) createAttribute:(NSString*) data __attribute__((ns_returns_retained)); +-(EntityReference*) createEntityReference:(NSString*) data __attribute__((ns_returns_retained)); + +-(NodeList*) getElementsByTagName:(NSString*) data; + +// Introduced in DOM Level 2: +-(Node*) importNode:(Node*) importedNode deep:(BOOL) deep; + +// Introduced in DOM Level 2: +-(Element*) createElementNS:(NSString*) namespaceURI qualifiedName:(NSString*) qualifiedName __attribute__((ns_returns_retained)); + +// Introduced in DOM Level 2: +-(Attr*) createAttributeNS:(NSString*) namespaceURI qualifiedName:(NSString*) qualifiedName; + +// Introduced in DOM Level 2: +-(NodeList*) getElementsByTagNameNS:(NSString*) namespaceURI localName:(NSString*) localName; + +// Introduced in DOM Level 2: +-(Element*) getElementById:(NSString*) elementId; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Document.m b/Source/Core/DOM classes/Core DOM/Document.m new file mode 100644 index 000000000..a0e239c8e --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Document.m @@ -0,0 +1,137 @@ +#import "Document.h" +#import "Document+Mutable.h" + +#import "DOMHelperUtilities.h" + +#import "NodeList+Mutable.h" // needed for access to underlying array, because SVG doesnt specify how lists are made mutable + +@interface Document() +-(Element*) privateGetElementById:(NSString*) idValue childrenOfElement:(Node*) parent; +@end + +@implementation Document + +@synthesize doctype; +@synthesize implementation; +@synthesize documentElement; + + +-(Element*) createElement:(NSString*) tagName +{ + Element* newElement = [[Element alloc] initWithLocalName:tagName attributes:nil]; + + NSLog( @"[%@] WARNING: SVG Spec, missing feature: if there are known attributes with default values, Attr nodes representing them SHOULD BE automatically created and attached to the element.", [self class] ); + + return newElement; +} + +-(DocumentFragment*) createDocumentFragment +{ + return [[DocumentFragment alloc] init]; +} + +-(Text*) createTextNode:(NSString*) data +{ + return [[Text alloc] initWithValue:data]; +} + +-(Comment*) createComment:(NSString*) data +{ + return [[Comment alloc] initWithValue:data]; +} + +-(CDATASection*) createCDATASection:(NSString*) data +{ + return [[CDATASection alloc] initWithValue:data]; +} + +-(ProcessingInstruction*) createProcessingInstruction:(NSString*) target data:(NSString*) data +{ + return [[ProcessingInstruction alloc] initProcessingInstruction:target value:data]; +} + +-(Attr*) createAttribute:(NSString*) n +{ + return [[Attr alloc] initWithName:n value:@""]; +} + +-(EntityReference*) createEntityReference:(NSString*) data +{ + NSAssert( FALSE, @"Not implemented. According to spec: Creates an EntityReference object. In addition, if the referenced entity is known, the child list of the EntityReference node is made the same as that of the corresponding Entity node. Note: If any descendant of the Entity node has an unbound namespace prefix, the corresponding descendant of the created EntityReference node is also unbound; (its namespaceURI is null). The DOM Level 2 does not support any mechanism to resolve namespace prefixes." ); + return nil; +} + +-(NodeList*) getElementsByTagName:(NSString*) data +{ + NodeList* accumulator = [[[NodeList alloc] init] autorelease]; + [DOMHelperUtilities privateGetElementsByName:data inNamespace:nil childrenOfElement:self.documentElement addToList:accumulator]; + + return accumulator; +} + +// Introduced in DOM Level 2: +-(Node*) importNode:(Node*) importedNode deep:(BOOL) deep +{ + NSAssert( FALSE, @"Not implemented." ); + return nil; +} + +// Introduced in DOM Level 2: +-(Element*) createElementNS:(NSString*) namespaceURI qualifiedName:(NSString*) qualifiedName +{ + Element* newElement = [[Element alloc] initWithQualifiedName:qualifiedName inNameSpaceURI:namespaceURI attributes:nil]; + + NSLog( @"[%@] WARNING: SVG Spec, missing feature: if there are known attributes with default values, Attr nodes representing them SHOULD BE automatically created and attached to the element.", [self class] ); + + return newElement; +} + +// Introduced in DOM Level 2: +-(Attr*) createAttributeNS:(NSString*) namespaceURI qualifiedName:(NSString*) qualifiedName +{ + NSAssert( FALSE, @"This should be re-implemented to share code with createElementNS: method above" ); + Attr* newAttr = [[[Attr alloc] initWithNamespace:namespaceURI qualifiedName:qualifiedName value:@""] autorelease]; + return newAttr; +} + +// Introduced in DOM Level 2: +-(NodeList*) getElementsByTagNameNS:(NSString*) namespaceURI localName:(NSString*) localName +{ + NodeList* accumulator = [[[NodeList alloc] init] autorelease]; + [DOMHelperUtilities privateGetElementsByName:localName inNamespace:namespaceURI childrenOfElement:self.documentElement addToList:accumulator]; + + return accumulator; +} + +// Introduced in DOM Level 2: +-(Element*) getElementById:(NSString*) elementId +{ + return [self privateGetElementById:elementId childrenOfElement:self.documentElement]; +} + +#pragma mark - Non-Spec methods required to implement the Spec methods + +-(Element*) privateGetElementById:(NSString*) idValue childrenOfElement:(Node*) parent +{ + /** According to spec, this is only valid for ELEMENT nodes */ + if( [parent isKindOfClass:[Element class]] ) + { + Element* parentAsElement = (Element*) parent; + + if( [[parentAsElement getAttribute:@"id"] isEqualToString:idValue]) + return parentAsElement; + } + + for( Node* childNode in parent.childNodes ) + { + Element* childResult = [self privateGetElementById:idValue childrenOfElement:childNode]; + + if( childResult != nil ) + return childResult; + } + + return nil; +} + + +@end diff --git a/Source/Core/DOM classes/Core DOM/DocumentFragment.h b/Source/Core/DOM classes/Core DOM/DocumentFragment.h new file mode 100644 index 000000000..c6bd6fcd0 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/DocumentFragment.h @@ -0,0 +1,17 @@ +/* + From SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-B63ED1A3 + + interface DocumentFragment : Node { + }; +*/ + +#import + +/** objc won't allow this: @class Node;*/ +#import "Node.h" + +@interface DocumentFragment : Node + +@end diff --git a/Source/Core/DOM classes/Core DOM/DocumentFragment.m b/Source/Core/DOM classes/Core DOM/DocumentFragment.m new file mode 100644 index 000000000..4a6bbe8a1 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/DocumentFragment.m @@ -0,0 +1,21 @@ +// +// DocumentFragment.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "DocumentFragment.h" + +@implementation DocumentFragment + +- (id)init +{ + self = [super initType:SKNodeType_DOCUMENT_FRAGMENT_NODE name:nil]; + if (self) { + + } + return self; +} +@end diff --git a/Source/Core/DOM classes/Core DOM/DocumentType.h b/Source/Core/DOM classes/Core DOM/DocumentType.h new file mode 100644 index 000000000..0ebd9c633 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/DocumentType.h @@ -0,0 +1,39 @@ +/* + From SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-412266927 + + interface DocumentType : Node { + readonly attribute DOMString name; + readonly attribute NamedNodeMap entities; + readonly attribute NamedNodeMap notations; + // Introduced in DOM Level 2: + readonly attribute DOMString publicId; + // Introduced in DOM Level 2: + readonly attribute DOMString systemId; + // Introduced in DOM Level 2: + readonly attribute DOMString internalSubset; + }; +*/ +#import + +#import "Node.h" +#import "NamedNodeMap.h" + +@interface DocumentType : Node + +@property(nonatomic,retain,readonly) NSString* name; +@property(nonatomic,retain,readonly) NamedNodeMap* entities; +@property(nonatomic,retain,readonly) NamedNodeMap* notations; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readonly) NSString* publicId; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readonly) NSString* systemId; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readonly) NSString* internalSubset; + + +@end diff --git a/Source/Core/DOM classes/Core DOM/DocumentType.m b/Source/Core/DOM classes/Core DOM/DocumentType.m new file mode 100644 index 000000000..67d994475 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/DocumentType.m @@ -0,0 +1,43 @@ +// +// DocumentType.m +// SVGKit +// +// Created by adam on 23/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "DocumentType.h" + +/* + in case we need to redeclare them readwrite: + @property(nonatomic,retain,readonly) NSString* name; + @property(nonatomic,retain,readonly) NamedNodeMap* entities; + @property(nonatomic,retain,readonly) NamedNodeMap* notations; + + // Introduced in DOM Level 2: + @property(nonatomic,retain,readonly) NSString* publicId; + + // Introduced in DOM Level 2: + @property(nonatomic,retain,readonly) NSString* systemId; + + // Introduced in DOM Level 2: + @property(nonatomic,retain,readonly) NSString* internalSubset; + + */ + +@implementation DocumentType + +@synthesize name; +@synthesize entities; +@synthesize notations; + +// Introduced in DOM Level 2: +@synthesize publicId; + +// Introduced in DOM Level 2: +@synthesize systemId; + +// Introduced in DOM Level 2: +@synthesize internalSubset; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Element.h b/Source/Core/DOM classes/Core DOM/Element.h new file mode 100644 index 000000000..1345a9a55 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Element.h @@ -0,0 +1,99 @@ +/* + From SVG-DOM, via Core-DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-745549614 + + interface Element : Node { + readonly attribute DOMString tagName; + DOMString getAttribute(in DOMString name); + void setAttribute(in DOMString name, + in DOMString value) + raises(DOMException); + void removeAttribute(in DOMString name) + raises(DOMException); + Attr getAttributeNode(in DOMString name); + Attr setAttributeNode(in Attr newAttr) + raises(DOMException); + Attr removeAttributeNode(in Attr oldAttr) + raises(DOMException); + NodeList getElementsByTagName(in DOMString name); + // Introduced in DOM Level 2: + DOMString getAttributeNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + void setAttributeNS(in DOMString namespaceURI, + in DOMString qualifiedName, + in DOMString value) + raises(DOMException); + // Introduced in DOM Level 2: + void removeAttributeNS(in DOMString namespaceURI, + in DOMString localName) + raises(DOMException); + // Introduced in DOM Level 2: + Attr getAttributeNodeNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + Attr setAttributeNodeNS(in Attr newAttr) + raises(DOMException); + // Introduced in DOM Level 2: + NodeList getElementsByTagNameNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + boolean hasAttribute(in DOMString name); + // Introduced in DOM Level 2: + boolean hasAttributeNS(in DOMString namespaceURI, + in DOMString localName); + }; + */ + +#import + +/** objc won't allow this: @class Node;*/ +#import "Node.h" +@class Attr; +#import "Attr.h" +@class NodeList; +#import "NodeList.h" + +@interface Element : Node + +@property(nonatomic,retain,readonly) NSString* tagName; + +-(NSString*) getAttribute:(NSString*) name; +-(void) setAttribute:(NSString*) name value:(NSString*) value; +-(void) removeAttribute:(NSString*) name; +-(Attr*) getAttributeNode:(NSString*) name; +-(Attr*) setAttributeNode:(Attr*) newAttr; +-(Attr*) removeAttributeNode:(Attr*) oldAttr; +-(NodeList*) getElementsByTagName:(NSString*) name; + +// Introduced in DOM Level 2: +-(NSString*) getAttributeNS:(NSString*) namespaceURI localName:(NSString*) localName; + +// Introduced in DOM Level 2: +-(void) setAttributeNS:(NSString*) namespaceURI qualifiedName:(NSString*) qualifiedName value:(NSString*) value; + +// Introduced in DOM Level 2: +-(void) removeAttributeNS:(NSString*) namespaceURI localName:(NSString*) localName; + +// Introduced in DOM Level 2: +-(Attr*) getAttributeNodeNS:(NSString*) namespaceURI localName:(NSString*) localName; + +// Introduced in DOM Level 2: +-(Attr*) setAttributeNodeNS:(Attr*) newAttr; + +// Introduced in DOM Level 2: +-(NodeList*) getElementsByTagNameNS:(NSString*) namespaceURI localName:(NSString*) localName; + +// Introduced in DOM Level 2: +-(BOOL) hasAttribute:(NSString*) name; + +// Introduced in DOM Level 2: +-(BOOL) hasAttributeNS:(NSString*) namespaceURI localName:(NSString*) localName; + +#pragma mark - Objective-C init methods (not in SVG Spec - you're supposed to use SVGDocument's createXXX methods instead) + +- (id)initWithLocalName:(NSString*) n attributes:(NSMutableDictionary*) attributes; +- (id)initWithQualifiedName:(NSString*) n inNameSpaceURI:(NSString*) nsURI attributes:(NSMutableDictionary*) attributes; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Element.m b/Source/Core/DOM classes/Core DOM/Element.m new file mode 100644 index 000000000..1205026a6 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Element.m @@ -0,0 +1,168 @@ +#import "Element.h" + +#import "NamedNodeMap.h" +#import "DOMHelperUtilities.h" + +@interface Element() +@property(nonatomic,retain,readwrite) NSString* tagName; +@end + +@implementation Element + +@synthesize tagName; + +- (id)initWithLocalName:(NSString*) n attributes:(NSMutableDictionary*) attributes { + self = [super initType:SKNodeType_ELEMENT_NODE name:n]; + if (self) { + self.tagName = n; + + for( NSString* attributeName in attributes.allKeys ) + { + [self setAttribute:attributeName value:[attributes objectForKey:attributeName]]; + } + } + return self; +} +- (id)initWithQualifiedName:(NSString*) n inNameSpaceURI:(NSString*) nsURI attributes:(NSMutableDictionary *)attributes +{ + self = [super initType:SKNodeType_ELEMENT_NODE name:n inNamespace:nsURI]; + if (self) { + self.tagName = n; + + for( Attr* attribute in attributes.allValues ) + { + [self.attributes setNamedItemNS:attribute inNodeNamespace:nsURI]; + } + } + return self; +} + +-(NSString*) getAttribute:(NSString*) name +{ + /** + WARNING: the definition in the spec WILL CORRUPT all Objective-C code. + + The spec - instead of defining 'nil' - defines "" (empty string) as the + correct response. + + But in most of the modern, C-based, (non-scripting) languages, "" means 0. + + Very dangerous! + */ + Attr* result = (Attr*) [self.attributes getNamedItem:name]; + + if( result == nil || result.value == nil ) + return @""; // according to spec + else + return result.value; +} + +-(void) setAttribute:(NSString*) name value:(NSString*) value +{ + Attr* att = [[[Attr alloc] initWithName:name value:value] autorelease]; + + [self.attributes setNamedItem:att]; +} + +-(void) removeAttribute:(NSString*) name +{ + [self.attributes removeNamedItem:name]; + + NSAssert( FALSE, @"Not fully implemented. Spec says: If the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable." ); +} + +-(Attr*) getAttributeNode:(NSString*) name +{ + return (Attr*) [self.attributes getNamedItem:name]; +} + +-(Attr*) setAttributeNode:(Attr*) newAttr +{ + Attr* oldAtt = (Attr*) [self.attributes getNamedItem:newAttr.nodeName]; + + [self.attributes setNamedItem:newAttr]; + + return oldAtt; +} + +-(Attr*) removeAttributeNode:(Attr*) oldAttr +{ + [self.attributes removeNamedItem:oldAttr.nodeName]; + + NSAssert( FALSE, @"Not fully implemented. Spec: If the removed Attr has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix, when applicable. " ); + + return oldAttr; +} + +-(NodeList*) getElementsByTagName:(NSString*) name +{ + NodeList* accumulator = [[[NodeList alloc] init] autorelease]; + [DOMHelperUtilities privateGetElementsByName:name inNamespace:nil childrenOfElement:self addToList:accumulator]; + + return accumulator; +} + +// Introduced in DOM Level 2: +-(NSString*) getAttributeNS:(NSString*) namespaceURI localName:(NSString*) localName +{ + Attr* result = (Attr*) [self.attributes getNamedItemNS:namespaceURI localName:localName]; + + if( result == nil || result.value == nil ) + return @""; // according to spec + else + return result.value; +} + +// Introduced in DOM Level 2: +-(void) setAttributeNS:(NSString*) namespaceURI qualifiedName:(NSString*) qualifiedName value:(NSString*) value +{ + Attr* att = [[[Attr alloc] initWithNamespace:namespaceURI qualifiedName:qualifiedName value:value] autorelease]; + + [self.attributes setNamedItemNS:att]; +} + +// Introduced in DOM Level 2: +-(void) removeAttributeNS:(NSString*) namespaceURI localName:(NSString*) localName +{ + NSAssert( FALSE, @"Not implemented yet" ); +} + +// Introduced in DOM Level 2: +-(Attr*) getAttributeNodeNS:(NSString*) namespaceURI localName:(NSString*) localName +{ + Attr* result = (Attr*) [self.attributes getNamedItemNS:namespaceURI localName:localName]; + + return result; +} + +// Introduced in DOM Level 2: +-(Attr*) setAttributeNodeNS:(Attr*) newAttr +{ + NSAssert( FALSE, @"Not implemented yet" ); + return nil; +} + +// Introduced in DOM Level 2: +-(NodeList*) getElementsByTagNameNS:(NSString*) namespaceURI localName:(NSString*) localName +{ + NodeList* accumulator = [[[NodeList alloc] init] autorelease]; + [DOMHelperUtilities privateGetElementsByName:localName inNamespace:namespaceURI childrenOfElement:self addToList:accumulator]; + + return accumulator; +} + +// Introduced in DOM Level 2: +-(BOOL) hasAttribute:(NSString*) name +{ + NSAssert( FALSE, @"Not implemented yet" ); + return FALSE; +} + +// Introduced in DOM Level 2: +-(BOOL) hasAttributeNS:(NSString*) namespaceURI localName:(NSString*) localName +{ + NSAssert( FALSE, @"Not implemented yet" ); + return FALSE; +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/EntityReference.h b/Source/Core/DOM classes/Core DOM/EntityReference.h new file mode 100644 index 000000000..bd8a6baad --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/EntityReference.h @@ -0,0 +1,16 @@ +/* + From SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-11C98490 + + interface EntityReference : Node { + }; + */ +#import + +/** objc won't allow this: @class Node; */ +#import "Node.h" + +@interface EntityReference : Node + +@end diff --git a/Source/Core/DOM classes/Core DOM/EntityReference.m b/Source/Core/DOM classes/Core DOM/EntityReference.m new file mode 100644 index 000000000..161bea906 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/EntityReference.m @@ -0,0 +1,13 @@ +// +// EntityReference.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "EntityReference.h" + +@implementation EntityReference + +@end diff --git a/Source/Core/DOM classes/Core DOM/NamedNodeMap.h b/Source/Core/DOM classes/Core DOM/NamedNodeMap.h new file mode 100644 index 000000000..2465dda2d --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/NamedNodeMap.h @@ -0,0 +1,55 @@ +/* + From SVG-DOM, via Core-DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1780488922 + + interface NamedNodeMap { + Node getNamedItem(in DOMString name); + Node setNamedItem(in Node arg) + raises(DOMException); + Node removeNamedItem(in DOMString name) + raises(DOMException); + Node item(in unsigned long index); + readonly attribute unsigned long length; + // Introduced in DOM Level 2: + Node getNamedItemNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + Node setNamedItemNS(in Node arg) + raises(DOMException); + // Introduced in DOM Level 2: + Node removeNamedItemNS(in DOMString namespaceURI, + in DOMString localName) + raises(DOMException); + }; + + */ + +#import + +@class Node; +#import "Node.h" + +@interface NamedNodeMap : NSObject + +-(Node*) getNamedItem:(NSString*) name; +-(Node*) setNamedItem:(Node*) arg; +-(Node*) removeNamedItem:(NSString*) name; +-(Node*) item:(unsigned long) index; + +@property(readonly) unsigned long length; + +// Introduced in DOM Level 2: +-(Node*) getNamedItemNS:(NSString*) namespaceURI localName:(NSString*) localName; + +// Introduced in DOM Level 2: +-(Node*) setNamedItemNS:(Node*) arg; + +// Introduced in DOM Level 2: +-(Node*) removeNamedItemNS:(NSString*) namespaceURI localName:(NSString*) localName; + +#pragma mark - MISSING METHOD FROM SVG Spec, without which you cannot parse documents (don't understand how they intended you to fulfil the spec without this method) + +-(Node*) setNamedItemNS:(Node*) arg inNodeNamespace:(NSString*) nodesNamespace; + +@end diff --git a/Source/Core/DOM classes/Core DOM/NamedNodeMap.m b/Source/Core/DOM classes/Core DOM/NamedNodeMap.m new file mode 100644 index 000000000..acc8745e5 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/NamedNodeMap.m @@ -0,0 +1,180 @@ +// +// NamedNodeMap.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "NamedNodeMap.h" + +@interface NamedNodeMap() +@property(nonatomic,retain) NSMutableDictionary* internalDictionary; +@property(nonatomic,retain) NSMutableDictionary* internalDictionaryOfNamespaces; +@end + +@implementation NamedNodeMap + +@synthesize internalDictionary; +@synthesize internalDictionaryOfNamespaces; + +- (id)init { + self = [super init]; + if (self) { + self.internalDictionary = [NSMutableDictionary dictionary]; + self.internalDictionaryOfNamespaces = [NSMutableDictionary dictionary]; + } + return self; +} + +- (void)dealloc { + self.internalDictionary = nil; + self.internalDictionaryOfNamespaces = nil; + + [super dealloc]; +} + +-(Node*) getNamedItem:(NSString*) name +{ + Node* simpleResult = [self.internalDictionary objectForKey:name]; + + if( simpleResult == nil ) + { + /** + Check the namespaces in turn, to see if we can find this node in one of them + + NB: according to spec, this behaviour is: + + "The result depends on the implementation" + + I've chosen to implement it the most user-friendly way possible. It is NOT the best + solution IMHO - the spec authors should have defined the outcome! + */ + + for( NSString* key in [self.internalDictionaryOfNamespaces allKeys] ) + { + simpleResult = [self getNamedItemNS:key localName:name]; + if( simpleResult != nil ) + break; + } + } + + return simpleResult; +} + +-(Node*) setNamedItem:(Node*) arg +{ + NSAssert( [[self.internalDictionaryOfNamespaces allKeys] count] < 1, @"WARNING: you are using namespaced attributes in parallel with non-namespaced. According to the DOM Spec, this leads to UNDEFINED behaviour. This is insane - you do NOT want to be doing this! Crashing deliberately...." ); + + Node* oldNode = [self.internalDictionary objectForKey:arg.localName]; + + [self.internalDictionary setObject:arg forKey:arg.localName]; + + return oldNode; +} + +-(Node*) removeNamedItem:(NSString*) name +{ + NSAssert( [[self.internalDictionaryOfNamespaces allKeys] count] < 1, @"WARNING: you are using namespaced attributes in parallel with non-namespaced. According to the DOM Spec, this leads to UNDEFINED behaviour. This is insane - you do NOT want to be doing this! Crashing deliberately...." ); + + Node* oldNode = [self.internalDictionary objectForKey:name]; + + [self.internalDictionary removeObjectForKey:name]; + + return oldNode; +} + +-(unsigned long)length +{ + int count = [self.internalDictionary count]; + + for( NSDictionary* namespaceDict in self.internalDictionaryOfNamespaces ) + { + count += [namespaceDict count]; + } + + return count; +} + +-(Node*) item:(unsigned long) index +{ + if( index < [self.internalDictionary count] ) + return [self.internalDictionary.allValues objectAtIndex:index]; + else + { + index -= self.internalDictionary.count; + + for( NSDictionary* namespaceDict in self.internalDictionaryOfNamespaces ) + { + if( index < [namespaceDict count] ) + return [namespaceDict.allValues objectAtIndex:index]; + else + index -= [namespaceDict count]; + } + } + + return nil; +} + +// Introduced in DOM Level 2: +-(Node*) getNamedItemNS:(NSString*) namespaceURI localName:(NSString*) localName +{ + NSMutableDictionary* namespaceDict = [self.internalDictionaryOfNamespaces objectForKey:namespaceURI]; + + return [namespaceDict objectForKey:localName]; +} + +// Introduced in DOM Level 2: +-(Node*) setNamedItemNS:(Node*) arg +{ + return [self setNamedItemNS:arg inNodeNamespace:nil]; +} + +// Introduced in DOM Level 2: +-(Node*) removeNamedItemNS:(NSString*) namespaceURI localName:(NSString*) localName +{ + NSMutableDictionary* namespaceDict = [self.internalDictionaryOfNamespaces objectForKey:namespaceURI]; + Node* oldNode = [namespaceDict objectForKey:localName]; + + [namespaceDict removeObjectForKey:localName]; + + return oldNode; +} + +#pragma mark - MISSING METHOD FROM SVG Spec, without which you cannot parse documents (don't understand how they intended you to fulfil the spec without this method) + +-(Node*) setNamedItemNS:(Node*) arg inNodeNamespace:(NSString*) nodesNamespace +{ + NSString* effectiveNamespace = arg.namespaceURI != nil ? arg.namespaceURI : nodesNamespace; + if( effectiveNamespace == nil ) + { + return [self setNamedItem:arg]; // this should never happen, but there's a lot of malformed SVG files out in the wild + } + + NSMutableDictionary* namespaceDict = [self.internalDictionaryOfNamespaces objectForKey:effectiveNamespace]; + if( namespaceDict == nil ) + { + namespaceDict = [NSMutableDictionary dictionary]; + [self.internalDictionaryOfNamespaces setObject:namespaceDict forKey:effectiveNamespace]; + } + Node* oldNode = [namespaceDict objectForKey:arg.localName]; + + [namespaceDict setObject:arg forKey:arg.localName]; + + return oldNode; +} + +#pragma mark - ADDITIONAL to SVG Spec: useful debug / output / description methods + +-(NSString *)description +{ + /** test (and output) both the "DOM 1" and "DOM 2" dictionaries, if they're non-empty */ + + NSString* dom1 = self.internalDictionary.count > 0 ? [NSString stringWithFormat:@"DOM-v1(%@)", self.internalDictionary] : nil; + NSString* dom2 = self.internalDictionaryOfNamespaces.count > 0 ? [NSString stringWithFormat:@"DOM-v2(%@)", self.internalDictionaryOfNamespaces] : nil; + + return [NSString stringWithFormat:@"NamedNodeMap: %@%@%@", dom1, dom1 != nil && dom2 != nil ? @"\n" : @"", dom2 ]; +} + + +@end diff --git a/Source/Core/DOM classes/Core DOM/Node+Mutable.h b/Source/Core/DOM classes/Core DOM/Node+Mutable.h new file mode 100644 index 000000000..ad8f49e1f --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Node+Mutable.h @@ -0,0 +1,30 @@ +/** + Makes the writable properties all package-private, effectively + */ +#import "Node.h" + +@interface Node() +@property(nonatomic,retain,readwrite) NSString* nodeName; +@property(nonatomic,retain,readwrite) NSString* nodeValue; + +@property(nonatomic,readwrite) SKNodeType nodeType; +@property(nonatomic,retain,readwrite) Node* parentNode; +@property(nonatomic,retain,readwrite) NodeList* childNodes; +@property(nonatomic,retain,readwrite) Node* firstChild; +@property(nonatomic,retain,readwrite) Node* lastChild; +@property(nonatomic,retain,readwrite) Node* previousSibling; +@property(nonatomic,retain,readwrite) Node* nextSibling; +@property(nonatomic,retain,readwrite) NamedNodeMap* attributes; + +@property(nonatomic,retain,readwrite) Document* ownerDocument; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readwrite) NSString* namespaceURI; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readwrite) NSString* prefix; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readwrite) NSString* localName; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Node.h b/Source/Core/DOM classes/Core DOM/Node.h new file mode 100644 index 000000000..227b417d6 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Node.h @@ -0,0 +1,145 @@ +/* +// Node.h +* + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 + + interface Node { + + // NodeType + const unsigned short ELEMENT_NODE = 1; + const unsigned short ATTRIBUTE_NODE = 2; + const unsigned short TEXT_NODE = 3; + const unsigned short CDATA_SECTION_NODE = 4; + const unsigned short ENTITY_REFERENCE_NODE = 5; + const unsigned short ENTITY_NODE = 6; + const unsigned short PROCESSING_INSTRUCTION_NODE = 7; + const unsigned short COMMENT_NODE = 8; + const unsigned short DOCUMENT_NODE = 9; + const unsigned short DOCUMENT_TYPE_NODE = 10; + const unsigned short DOCUMENT_FRAGMENT_NODE = 11; + const unsigned short NOTATION_NODE = 12; + + readonly attribute DOMString nodeName; + attribute DOMString nodeValue; + // raises(DOMException) on setting + // raises(DOMException) on retrieval + + readonly attribute unsigned short nodeType; + readonly attribute Node parentNode; + readonly attribute NodeList childNodes; + readonly attribute Node firstChild; + readonly attribute Node lastChild; + readonly attribute Node previousSibling; + readonly attribute Node nextSibling; + readonly attribute NamedNodeMap attributes; + // Modified in DOM Level 2: + readonly attribute Document ownerDocument; + Node insertBefore(in Node newChild, + in Node refChild) + raises(DOMException); + Node replaceChild(in Node newChild, + in Node oldChild) + raises(DOMException); + Node removeChild(in Node oldChild) + raises(DOMException); + Node appendChild(in Node newChild) + raises(DOMException); + boolean hasChildNodes(); + Node cloneNode(in boolean deep); + // Modified in DOM Level 2: + void normalize(); + // Introduced in DOM Level 2: + boolean isSupported(in DOMString feature, + in DOMString version); + // Introduced in DOM Level 2: + readonly attribute DOMString namespaceURI; + // Introduced in DOM Level 2: + attribute DOMString prefix; + // raises(DOMException) on setting + + // Introduced in DOM Level 2: + readonly attribute DOMString localName; + // Introduced in DOM Level 2: + boolean hasAttributes(); + }; + +*/ + +#import + +@class Document; +/** objc won't allow this: #import "Document.h"*/ +@class NodeList; +/** objc won't allow this: #import "NodeList.h"*/ +@class NamedNodeMap; +/** objc won't allow this: #import "NamedNodeMap.h"*/ + +typedef enum SKNodeType +{ + SKNodeType_ELEMENT_NODE = 1, + SKNodeType_ATTRIBUTE_NODE = 2, + SKNodeType_TEXT_NODE = 3, + SKNodeType_CDATA_SECTION_NODE = 4, + SKNodeType_ENTITY_REFERENCE_NODE = 5, + SKNodeType_ENTITY_NODE = 6, + SKNodeType_PROCESSING_INSTRUCTION_NODE = 7, + SKNodeType_COMMENT_NODE = 8, + SKNodeType_DOCUMENT_NODE = 9, + SKNodeType_DOCUMENT_TYPE_NODE = 10, + SKNodeType_DOCUMENT_FRAGMENT_NODE = 11, + SKNodeType_NOTATION_NODE = 12 +} SKNodeType; + +@interface Node : NSObject + +@property(nonatomic,retain,readonly) NSString* nodeName; +@property(nonatomic,retain,readonly) NSString* nodeValue; + +@property(nonatomic,readonly) SKNodeType nodeType; +@property(nonatomic,retain,readonly) Node* parentNode; +@property(nonatomic,retain,readonly) NodeList* childNodes; +@property(nonatomic,retain,readonly) Node* firstChild; +@property(nonatomic,retain,readonly) Node* lastChild; +@property(nonatomic,retain,readonly) Node* previousSibling; +@property(nonatomic,retain,readonly) Node* nextSibling; +@property(nonatomic,retain,readonly) NamedNodeMap* attributes; /*< NB: according to DOM Spec, this is null if the Node is NOT subclassed as an Element */ + +// Modified in DOM Level 2: +@property(nonatomic,retain,readonly) Document* ownerDocument; + +-(Node*) insertBefore:(Node*) newChild refChild:(Node*) refChild; + +-(Node*) replaceChild:(Node*) newChild oldChild:(Node*) oldChild; +-(Node*) removeChild:(Node*) oldChild; +-(Node*) appendChild:(Node*) newChild; + +@property(nonatomic) BOOL hasChildNodes; + +-(Node*) cloneNode:(BOOL) deep; + +// Modified in DOM Level 2: +-(void) normalize; + +// Introduced in DOM Level 2: +-(BOOL) isSupportedFeature:(NSString*) feature version:(NSString*) version; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readonly) NSString* namespaceURI; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readonly) NSString* prefix; + +// Introduced in DOM Level 2: +@property(nonatomic,retain,readonly) NSString* localName; + +// Introduced in DOM Level 2: +@property(nonatomic) BOOL hasAttributes; + +#pragma mark - Objective-C init methods (not in SVG Spec - you're supposed to use SVGDocument's createXXX methods instead) +/** Designated initializers - 2 pairs (one for DOM 1, no namespace, the other for DOM 2, with namespace) of 2 methods (one for nodes that REQUIRE a value, the other for nodes that MUST NOT have a value) */ +- (id)initType:(SKNodeType) nt name:(NSString*) n; +- (id)initType:(SKNodeType) nt name:(NSString*) n value:(NSString*) v; +- (id)initType:(SKNodeType) nt name:(NSString*) n inNamespace:(NSString*) nsURI; +- (id)initType:(SKNodeType) nt name:(NSString*) n value:(NSString*) v inNamespace:(NSString*) nsURI; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Node.m b/Source/Core/DOM classes/Core DOM/Node.m new file mode 100644 index 000000000..9a963048f --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Node.m @@ -0,0 +1,319 @@ +// +// Node.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "Node.h" +#import "Node+Mutable.h" + +#import "NodeList+Mutable.h" +#import "NamedNodeMap.h" + +@implementation Node + +@synthesize nodeName; +@synthesize nodeValue; + +@synthesize nodeType; +@synthesize parentNode; +@synthesize childNodes; +@synthesize firstChild; +@synthesize lastChild; +@synthesize previousSibling; +@synthesize nextSibling; +@synthesize attributes; + +// Modified in DOM Level 2: +@synthesize ownerDocument; + +@synthesize hasAttributes, hasChildNodes; + +@synthesize localName; + +- (id)init +{ + NSAssert( FALSE, @"This class has no init method - it MUST NOT be init'd via init - you MUST use one of the multi-argument constructors instead" ); + + return nil; +} + +- (id)initType:(SKNodeType) nt name:(NSString*) n value:(NSString*) v +{ + self = [super init]; + if (self) { + self.nodeType = nt; + switch( nt ) + { + + case SKNodeType_ATTRIBUTE_NODE: + case SKNodeType_CDATA_SECTION_NODE: + case SKNodeType_COMMENT_NODE: + case SKNodeType_PROCESSING_INSTRUCTION_NODE: + case SKNodeType_TEXT_NODE: + { + self.nodeName = n; + self.nodeValue = v; + }break; + + + case SKNodeType_DOCUMENT_NODE: + case SKNodeType_DOCUMENT_TYPE_NODE: + case SKNodeType_DOCUMENT_FRAGMENT_NODE: + case SKNodeType_ENTITY_REFERENCE_NODE: + case SKNodeType_ENTITY_NODE: + case SKNodeType_NOTATION_NODE: + case SKNodeType_ELEMENT_NODE: + { + NSAssert( FALSE, @"NodeType = %i cannot be init'd with a value; nodes of that type have no value in the DOM spec", nt); + + self = nil; + }break; + } + + self.childNodes = [[[NodeList alloc] init] autorelease]; + } + return self; +} + +- (id)initType:(SKNodeType) nt name:(NSString*) n +{ + self = [super init]; + if (self) { + self.nodeType = nt; + switch( nt ) + { + + case SKNodeType_ATTRIBUTE_NODE: + case SKNodeType_CDATA_SECTION_NODE: + case SKNodeType_COMMENT_NODE: + case SKNodeType_PROCESSING_INSTRUCTION_NODE: + case SKNodeType_TEXT_NODE: + { + NSAssert( FALSE, @"NodeType = %i cannot be init'd without a value; nodes of that type MUST have a value in the DOM spec", nt); + + self = nil; + }break; + + + case SKNodeType_DOCUMENT_NODE: + case SKNodeType_DOCUMENT_TYPE_NODE: + case SKNodeType_DOCUMENT_FRAGMENT_NODE: + case SKNodeType_ENTITY_REFERENCE_NODE: + case SKNodeType_ENTITY_NODE: + case SKNodeType_NOTATION_NODE: + { + self.nodeName = n; + }break; + + case SKNodeType_ELEMENT_NODE: + { + + self.nodeName = n; + + self.attributes = [[[NamedNodeMap alloc] init] autorelease]; + }break; + } + + self.childNodes = [[[NodeList alloc] init] autorelease]; + } + return self; +} + + +#pragma mark - Objective-C init methods DOM LEVEL 2 (preferred init - safer/better!) +-(void) postInitNamespaceHandling:(NSString*) nsURI +{ + NSArray* nameSpaceParts = [self.nodeName componentsSeparatedByString:@":"]; + self.localName = [nameSpaceParts lastObject]; + if( [nameSpaceParts count] > 1 ) + self.prefix = [nameSpaceParts objectAtIndex:0]; + + self.namespaceURI = nsURI; +} + +- (id)initType:(SKNodeType) nt name:(NSString*) n inNamespace:(NSString*) nsURI +{ + self = [self initType:nt name:n]; + + if( self ) + { + [self postInitNamespaceHandling:nsURI]; + } + + return self; +} + +- (id)initType:(SKNodeType) nt name:(NSString*) n value:(NSString*) v inNamespace:(NSString*) nsURI +{ + self = [self initType:nt name:n value:v]; + + if( self ) + { + [self postInitNamespaceHandling:nsURI]; + } + + return self; +} + +#pragma mark - Official DOM method implementations + +-(Node*) insertBefore:(Node*) newChild refChild:(Node*) refChild +{ + if( refChild == nil ) + { + [self.childNodes.internalArray addObject:newChild]; + newChild.parentNode = self; + } + else + { + [self.childNodes.internalArray insertObject:newChild atIndex:[self.childNodes.internalArray indexOfObject:refChild]]; + } + + return newChild; +} + +-(Node*) replaceChild:(Node*) newChild oldChild:(Node*) oldChild +{ + if( newChild.nodeType == SKNodeType_DOCUMENT_FRAGMENT_NODE ) + { + /** Spec: + + "If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed." + */ + + int oldIndex = [self.childNodes.internalArray indexOfObject:oldChild]; + + NSAssert( FALSE, @"We should be recursing down the tree to find 'newChild' at any location, and removing it - required by spec - but we have no convenience method for that search, yet" ); + + for( Node* child in newChild.childNodes.internalArray ) + { + [self.childNodes.internalArray insertObject:child atIndex:oldIndex++]; + } + + newChild.parentNode = self; + oldChild.parentNode = nil; + + return oldChild; + } + else + { + [self.childNodes.internalArray replaceObjectAtIndex:[self.childNodes.internalArray indexOfObject:oldChild] withObject:newChild]; + + newChild.parentNode = self; + oldChild.parentNode = nil; + + return oldChild; + } +} +-(Node*) removeChild:(Node*) oldChild +{ + [self.childNodes.internalArray removeObject:oldChild]; + + oldChild.parentNode = nil; + + return oldChild; +} + +-(Node*) appendChild:(Node*) newChild +{ + [self.childNodes.internalArray removeObject:newChild]; // required by spec + [self.childNodes.internalArray addObject:newChild]; + + newChild.parentNode = self; + + return newChild; +} + +-(BOOL)hasChildNodes +{ + return (self.childNodes.length > 0); +} + +-(Node*) cloneNode:(BOOL) deep +{ + NSAssert( FALSE, @"Not implemented yet - read the spec. Sounds tricky. I'm too tired, and would probably screw it up right now" ); + return nil; +} + +// Modified in DOM Level 2: +-(void) normalize +{ + NSAssert( FALSE, @"Not implemented yet - read the spec. Sounds tricky. I'm too tired, and would probably screw it up right now" ); +} + +// Introduced in DOM Level 2: +-(BOOL) isSupportedFeature:(NSString*) feature version:(NSString*) version +{ + NSAssert( FALSE, @"Not implemented yet - read the spec. I have literally no idea what this is supposed to do." ); + return FALSE; +} + +// Introduced in DOM Level 2: +@synthesize namespaceURI; + +// Introduced in DOM Level 2: +@synthesize prefix; + +// Introduced in DOM Level 2: +-(BOOL)hasAttributes +{ + if( self.attributes == nil ) + return FALSE; + + return (self.attributes.length > 0 ); +} + +#pragma mark - ADDITIONAL to SVG Spec: useful debug / output / description methods + +-(NSString *)description +{ + NSString* nodeTypeName; + switch( self.nodeType ) + { + case SKNodeType_ELEMENT_NODE: + nodeTypeName = @"ELEMENT"; + break; + case SKNodeType_TEXT_NODE: + nodeTypeName = @"TEXT"; + break; + case SKNodeType_ENTITY_NODE: + nodeTypeName = @"ENTITY"; + break; + case SKNodeType_COMMENT_NODE: + nodeTypeName = @"COMMENT"; + break; + case SKNodeType_DOCUMENT_NODE: + nodeTypeName = @"DOCUMENT"; + break; + case SKNodeType_NOTATION_NODE: + nodeTypeName = @"NOTATION"; + break; + case SKNodeType_ATTRIBUTE_NODE: + nodeTypeName = @"ATTRIBUTE"; + break; + case SKNodeType_CDATA_SECTION_NODE: + nodeTypeName = @"CDATA"; + break; + case SKNodeType_DOCUMENT_TYPE_NODE: + nodeTypeName = @"DOC TYPE"; + break; + case SKNodeType_ENTITY_REFERENCE_NODE: + nodeTypeName = @"ENTITY REF"; + break; + case SKNodeType_DOCUMENT_FRAGMENT_NODE: + nodeTypeName = @"DOC FRAGMENT"; + break; + case SKNodeType_PROCESSING_INSTRUCTION_NODE: + nodeTypeName = @"PROCESSING INSTRUCTION"; + break; + + default: + nodeTypeName = @"N/A (DATA IS MISSING FROM NODE INSTANCE)"; + } + return [NSString stringWithFormat:@"Node: %@ (%@) value:[%@] @@%ld attributes + %ld x children", self.nodeName, nodeTypeName, [self.nodeValue length]<11 ? self.nodeValue : [NSString stringWithFormat:@"%@...",[self.nodeValue substringToIndex:10]], self.attributes.length, self.childNodes.length]; +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/NodeList+Mutable.h b/Source/Core/DOM classes/Core DOM/NodeList+Mutable.h new file mode 100644 index 000000000..fba819742 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/NodeList+Mutable.h @@ -0,0 +1,11 @@ +/** + Makes the writable properties all package-private, effectively + */ + +#import "NodeList.h" + +@interface NodeList() + +@property(nonatomic,retain) NSMutableArray* internalArray; + +@end diff --git a/Source/Core/DOM classes/Core DOM/NodeList.h b/Source/Core/DOM classes/Core DOM/NodeList.h new file mode 100644 index 000000000..501de1ca5 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/NodeList.h @@ -0,0 +1,28 @@ +/* + Implemented internally via an NSArray + + NB: contains a slight "upgrade" from the SVG Spec to make it support Objective-C's + Fast Enumeration feature + + From SVG DOM, via CoreDOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-536297177 + + interface NodeList { + Node item(in unsigned long index); + readonly attribute unsigned long length; + }; + + */ +#import + +@class Node; +#import "Node.h" + +@interface NodeList : NSObject + +@property(readonly) long length; + +-(Node*) item:(int) index; + +@end diff --git a/Source/Core/DOM classes/Core DOM/NodeList.m b/Source/Core/DOM classes/Core DOM/NodeList.m new file mode 100644 index 000000000..a83e54e7c --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/NodeList.m @@ -0,0 +1,46 @@ +#import "NodeList.h" +#import "NodeList+Mutable.h" + +@implementation NodeList + +@synthesize internalArray; + +- (id)init { + self = [super init]; + + if (self) { + self.internalArray = [NSMutableArray array]; + } + return self; +} + +- (void)dealloc { + self.internalArray = nil; + [super dealloc]; +} + +-(Node*) item:(int) index +{ + return [self.internalArray objectAtIndex:index]; +} + +-(long)length +{ + return [self.internalArray count]; +} + +#pragma mark - ADDITIONAL to SVG Spec: Objective-C support for fast-iteration ("for * in ..." syntax) + +-(NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id [])buffer count:(NSUInteger)len +{ + return [self.internalArray countByEnumeratingWithState:state objects:buffer count:len]; +} + +#pragma mark - ADDITIONAL to SVG Spec: useful debug / output / description methods + +-(NSString *)description +{ + return [NSString stringWithFormat:@"NodeList: array(%@)", self.internalArray]; +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/ProcessingInstruction.h b/Source/Core/DOM classes/Core DOM/ProcessingInstruction.h new file mode 100644 index 000000000..74fbea8d5 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/ProcessingInstruction.h @@ -0,0 +1,25 @@ +/* + SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1004215813 + + interface ProcessingInstruction : Node { + readonly attribute DOMString target; + attribute DOMString data; + // raises(DOMException) on setting + + }; +*/ + +#import + +/** objc won't allow this: @class Node;*/ +#import "Node.h" + +@interface ProcessingInstruction : Node +@property(nonatomic,retain,readonly) NSString* target; +@property(nonatomic,retain,readonly) NSString* data; + +-(id) initProcessingInstruction:(NSString*) target value:(NSString*) data; + +@end diff --git a/Source/Core/DOM classes/Core DOM/ProcessingInstruction.m b/Source/Core/DOM classes/Core DOM/ProcessingInstruction.m new file mode 100644 index 000000000..b234548e7 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/ProcessingInstruction.m @@ -0,0 +1,31 @@ +// +// ProcessingInstruction.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "ProcessingInstruction.h" + +@interface ProcessingInstruction() +@property(nonatomic,retain,readwrite) NSString* target; +@property(nonatomic,retain,readwrite) NSString* data; +@end + +@implementation ProcessingInstruction + +@synthesize target; +@synthesize data; + +-(id) initProcessingInstruction:(NSString*) t value:(NSString*) d +{ + self = [super initType:SKNodeType_PROCESSING_INSTRUCTION_NODE name:t value:d]; + if (self) { + self.target = t; + self.data = d; + } + return self; +} + +@end diff --git a/Source/Core/DOM classes/Core DOM/Text.h b/Source/Core/DOM classes/Core DOM/Text.h new file mode 100644 index 000000000..00e7b00c7 --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Text.h @@ -0,0 +1,23 @@ +/* + SVG-DOM, via Core DOM: + + http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1312295772 + + interface Text : CharacterData { + Text splitText(in unsigned long offset) + raises(DOMException); + }; +*/ + +#import + +@class CharacterData; +#import "CharacterData.h" + +@interface Text : CharacterData + +- (id)initWithValue:(NSString*) v; + +-(Text*) splitText:(unsigned long) offset; + +@end diff --git a/Source/Core/DOM classes/Core DOM/Text.m b/Source/Core/DOM classes/Core DOM/Text.m new file mode 100644 index 000000000..b6fe00f6d --- /dev/null +++ b/Source/Core/DOM classes/Core DOM/Text.m @@ -0,0 +1,27 @@ +// +// Text.m +// SVGKit +// +// Created by adam on 22/05/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "Text.h" + +@implementation Text + +- (id)initWithValue:(NSString*) v +{ + self = [super initType:SKNodeType_TEXT_NODE name:@"#text" value:v]; + if (self) { + + } + return self; +} +-(Text*) splitText:(unsigned long) offset; +{ + NSAssert( FALSE, @"Not implemented yet" ); + return nil; +} + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGAngle.h b/Source/Core/DOM classes/SVG-DOM/SVGAngle.h new file mode 100644 index 000000000..d0b8da714 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGAngle.h @@ -0,0 +1,42 @@ +/*! + SVGAngle + + http://www.w3.org/TR/SVG/types.html#InterfaceSVGAngle + + // Angle Unit Types + const unsigned short SVG_ANGLETYPE_UNKNOWN = 0; + const unsigned short SVG_ANGLETYPE_UNSPECIFIED = 1; + const unsigned short SVG_ANGLETYPE_DEG = 2; + const unsigned short SVG_ANGLETYPE_RAD = 3; + const unsigned short SVG_ANGLETYPE_GRAD = 4; + + readonly attribute unsigned short unitType; + attribute float value setraises(DOMException); + attribute float valueInSpecifiedUnits setraises(DOMException); + attribute DOMString valueAsString setraises(DOMException); + + void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits) raises(DOMException); + void convertToSpecifiedUnits(in unsigned short unitType) raises(DOMException); + */ +#import + +@interface SVGAngle : NSObject + +/*! Angle Unit Types */ +typedef enum SVGKAngleType +{ + SVG_ANGLETYPE_UNKNOWN = 0, + SVG_ANGLETYPE_UNSPECIFIED = 1, + SVG_ANGLETYPE_DEG = 2, + SVG_ANGLETYPE_RAD = 3, + SVG_ANGLETYPE_GRAD = 4 +} SVGKAngleType; + +@property(nonatomic, readonly) SVGKAngleType unitType; +@property(nonatomic) float value; +@property(nonatomic) float valueInSpecifiedUnits; +@property(nonatomic,retain) NSString* valueAsString; + +-(void) newValueSpecifiedUnits:(SVGKAngleType) unitType valueInSpecifiedUnits:(float) valueInSpecifiedUnits; +-(void) convertToSpecifiedUnits:(SVGKAngleType) unitType; +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGAngle.m b/Source/Core/DOM classes/SVG-DOM/SVGAngle.m new file mode 100644 index 000000000..56eb2bd69 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGAngle.m @@ -0,0 +1,13 @@ +#import "SVGAngle.h" + +@implementation SVGAngle + +@synthesize unitType; +@synthesize value; +@synthesize valueInSpecifiedUnits; +@synthesize valueAsString; + +-(void) newValueSpecifiedUnits:(SVGKAngleType) unitType valueInSpecifiedUnits:(float) valueInSpecifiedUnits { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) convertToSpecifiedUnits:(SVGKAngleType) unitType { NSAssert( FALSE, @"Not implemented yet" ); } + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGDefsElement.h b/Source/Core/DOM classes/SVG-DOM/SVGDefsElement.h new file mode 100644 index 000000000..c47fca9b5 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGDefsElement.h @@ -0,0 +1,9 @@ +/* + http://www.w3.org/TR/SVG/struct.html#InterfaceSVGDefsElement + + */ +#import "SVGElement.h" + +@interface SVGDefsElement : SVGElement { } + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGDefsElement.m b/Source/Core/DOM classes/SVG-DOM/SVGDefsElement.m new file mode 100644 index 000000000..02ea0542d --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGDefsElement.m @@ -0,0 +1,5 @@ +#import "SVGDefsElement.h" + +@implementation SVGDefsElement + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGDocument.h b/Source/Core/DOM classes/SVG-DOM/SVGDocument.h new file mode 100644 index 000000000..cc4ad1eaf --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGDocument.h @@ -0,0 +1,33 @@ +/* + SVG DOM, cf: + + http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGDocument + + interface SVGDocument : Document, + DocumentEvent { + readonly attribute DOMString title; + readonly attribute DOMString referrer; + readonly attribute DOMString domain; + readonly attribute DOMString URL; + readonly attribute SVGSVGElement rootElement; + }; + */ + +#import + +#import "Document.h" +#import "SVGSVGElement.h" + +@interface SVGDocument : Document + +@property (nonatomic, retain, readonly) NSString* title; +@property (nonatomic, retain, readonly) NSString* referrer; +@property (nonatomic, retain, readonly) NSString* domain; +@property (nonatomic, retain, readonly) NSString* URL; +@property (nonatomic, retain, readonly) SVGSVGElement* rootElement; + +#pragma mark - Objective-C init methods (not part of DOM spec, but necessary!) + +- (id)init; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGDocument.m b/Source/Core/DOM classes/SVG-DOM/SVGDocument.m new file mode 100644 index 000000000..161602983 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGDocument.m @@ -0,0 +1,61 @@ +/** + SVGDocument + + SVG spec defines this as part of the DOM version of SVG: + + http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGDocument + */ + +#import "Document+Mutable.h" + +#import "SVGDocument.h" +#import "SVGDocument_Mutable.h" + +@implementation SVGDocument + + +@synthesize title; +@synthesize referrer; +@synthesize domain; +@synthesize URL; +@synthesize rootElement=_rootElement; + + +- (id)init +{ + self = [super initType:SKNodeType_DOCUMENT_NODE name:@"#document"]; + if (self) { + + } + return self; +} + +-(void)setRootElement:(SVGSVGElement *)rootElement +{ + [_rootElement release]; + _rootElement = rootElement; + [_rootElement retain]; + + /*! SVG spec has two variables with same name, because DOM was written to support + weak programming languages that don't provide full OOP polymorphism. + + So, we'd better keep the two variables in sync! + */ + super.documentElement = rootElement; +} + +-(void)setDocumentElement:(Element *)newDocumentElement +{ + NSAssert( [newDocumentElement isKindOfClass:[SVGSVGElement class]], @"Cannot set the documentElement property on an SVG doc unless it's of type SVGSVGDocument" ); + + super.documentElement = newDocumentElement; + + /*! SVG spec has two variables with same name, because DOM was written to support + weak programming languages that don't provide full OOP polymorphism. + + So, we'd better keep the two variables in sync! + */ + self.rootElement = (SVGSVGElement*) self.documentElement; +} + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGDocument_Mutable.h b/Source/Core/DOM classes/SVG-DOM/SVGDocument_Mutable.h new file mode 100644 index 000000000..7b62f9a4b --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGDocument_Mutable.h @@ -0,0 +1,13 @@ +/** + Makes the writable properties all package-private, effectively + */ + +#import "SVGDocument.h" + +@interface SVGDocument () +@property (nonatomic, retain, readwrite) NSString* title; +@property (nonatomic, retain, readwrite) NSString* referrer; +@property (nonatomic, retain, readwrite) NSString* domain; +@property (nonatomic, retain, readwrite) NSString* URL; +@property (nonatomic, retain, readwrite) SVGSVGElement* rootElement; +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGElementInstance.h b/Source/Core/DOM classes/SVG-DOM/SVGElementInstance.h new file mode 100644 index 000000000..854cf853c --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGElementInstance.h @@ -0,0 +1,52 @@ +/* + http://www.w3.org/TR/SVG/struct.html#InterfaceSVGElementInstance + + interface SVGElementInstance : EventTarget { + readonly attribute SVGElement correspondingElement; + readonly attribute SVGUseElement correspondingUseElement; + readonly attribute SVGElementInstance parentNode; + readonly attribute SVGElementInstanceList childNodes; + readonly attribute SVGElementInstance firstChild; + readonly attribute SVGElementInstance lastChild; + readonly attribute SVGElementInstance previousSibling; + readonly attribute SVGElementInstance nextSibling; + */ + +#import "SVGElement.h" +#import "SVGElementInstanceList.h" + +@class SVGUseElement; +#import "SVGUseElement.h" + + +@interface SVGElementInstance : NSObject + + +/*The corresponding element to which this object is an instance. For example, if a ‘use’ element references a ‘rect’ element, then an SVGElementInstance is created, with its correspondingElement being the SVGRectElement object for the ‘rect’ element. */ +@property(nonatomic,retain, readonly) SVGElement* correspondingElement; + + +/* The corresponding ‘use’ element to which this SVGElementInstance object belongs. When ‘use’ elements are nested (e.g., a ‘use’ references another ‘use’ which references a graphics element such as a ‘rect’), then the correspondingUseElement is the outermost ‘use’ (i.e., the one which indirectly references the ‘rect’, not the one with the direct reference). */ +@property(nonatomic,retain, readonly) SVGUseElement* correspondingUseElement; + +/* The parent of this SVGElementInstance within the instance tree. All SVGElementInstance objects have a parent except the SVGElementInstance which corresponds to the element which was directly referenced by the ‘use’ element, in which case parentNode is null. */ +@property(nonatomic,retain, readonly) SVGElementInstance* parentNode; + +/* An SVGElementInstanceList that contains all children of this SVGElementInstance within the instance tree. If there are no children, this is an SVGElementInstanceList containing no entries (i.e., an empty list). +firstChild (readonly SVGElementInstance) */ +@property(nonatomic,retain, readonly) SVGElementInstanceList* childNodes; + + +/* The first child of this SVGElementInstance within the instance tree. If there is no such SVGElementInstance, this returns null. */ +@property(nonatomic,retain, readonly) SVGElementInstance* firstChild; + +/* The last child of this SVGElementInstance within the instance tree. If there is no such SVGElementInstance, this returns null. */ +@property(nonatomic,retain, readonly) SVGElementInstance* lastChild; + +/* The SVGElementInstance immediately preceding this SVGElementInstance. If there is no such SVGElementInstance, this returns null. */ +@property(nonatomic,retain, readonly) SVGElementInstance* previousSibling; + +/* The SVGElementInstance immediately following this SVGElementInstance. If there is no such SVGElementInstance, this returns null. */ +@property(nonatomic,retain, readonly) SVGElementInstance* nextSibling; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGElementInstance.m b/Source/Core/DOM classes/SVG-DOM/SVGElementInstance.m new file mode 100644 index 000000000..53f91a33a --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGElementInstance.m @@ -0,0 +1,84 @@ +#import "SVGElementInstance.h" +#import "SVGElementInstance_Mutable.h" + +#import "SVGElementInstanceList_Internal.h" + +@implementation SVGElementInstance + +@synthesize correspondingElement; +@synthesize correspondingUseElement; +@synthesize parentNode; +@synthesize childNodes; + +-(void)setParentNode:(SVGElementInstance *)newParentNode +{ + if( newParentNode != self.parentNode ) + { + if( newParentNode == nil ) + { + /* additionally remove self from parent's childNodes */ + [self.parentNode.childNodes.internalArray removeObject:self]; + + [parentNode release]; + parentNode = newParentNode; + } + else + { + /* additionally ADD self to parent's childNodes */ + parentNode = newParentNode; + [parentNode retain]; + + NSAssert( NSNotFound != [self.parentNode.childNodes.internalArray indexOfObject:self], @"Found that I was already a child of the node that I was being added to - should be impossible!" ); + + [self.parentNode.childNodes.internalArray addObject:self]; + } + } +} + +-(SVGElementInstance *)firstChild +{ + if( [self.childNodes length] < 1 ) + return nil; + else + return [self.childNodes item:0]; +} + +-(SVGElementInstance *)lastChild +{ + if( [self.childNodes length] < 1 ) + return nil; + else + return [self.childNodes item: [self.childNodes length] - 1]; +} + +-(SVGElementInstance *)previousSibling +{ + if( self.parentNode == nil ) + return nil; + else + { + int indexInParent = [self.parentNode.childNodes.internalArray indexOfObject:self]; + + if( indexInParent < 1 ) + return nil; + else + return [self.parentNode.childNodes item:indexInParent-1]; + } +} + +-(SVGElementInstance *)nextSibling +{ + if( self.parentNode == nil ) + return nil; + else + { + int indexInParent = [self.parentNode.childNodes.internalArray indexOfObject:self]; + + if( indexInParent >= [self.parentNode.childNodes length] ) + return nil; + else + return [self.parentNode.childNodes item:indexInParent + 1]; + } +} + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList.h b/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList.h new file mode 100644 index 000000000..9043b5d00 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList.h @@ -0,0 +1,21 @@ +/* + http://www.w3.org/TR/SVG/struct.html#InterfaceSVGElementInstanceList + + interface SVGElementInstanceList { + + readonly attribute unsigned long length; + + SVGElementInstance item(in unsigned long index); +*/ + +#import "SVGElement.h" + +@class SVGElementInstance; + +@interface SVGElementInstanceList : SVGElement + +@property(nonatomic, readonly) unsigned long length; + +-(SVGElementInstance*) item:(unsigned long) index; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList.m b/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList.m new file mode 100644 index 000000000..db8eaf2e3 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList.m @@ -0,0 +1,28 @@ +#import "SVGElementInstanceList.h" +#import "SVGElementInstanceList_Internal.h" + +@implementation SVGElementInstanceList + +- (id)init +{ + self = [super init]; + if (self) { + self.internalArray = [NSMutableArray array]; + } + return self; +} + +-(unsigned long)length +{ + return [self.internalArray count]; +} + +-(SVGElementInstance*) item:(unsigned long) index +{ + if( index >= [self.internalArray count] ) + return nil; + + return [self.internalArray objectAtIndex:index]; +} + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList_Internal.h b/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList_Internal.h new file mode 100644 index 000000000..ee88221e9 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGElementInstanceList_Internal.h @@ -0,0 +1,15 @@ +// +// SVGElementInstanceList_Internal.h +// SVGKit-iOS +// +// Created by adam on 29/09/2012. +// Copyright (c) 2012 na. All rights reserved. +// + +#import "SVGElementInstanceList.h" + +@interface SVGElementInstanceList () + +@property(nonatomic,retain) NSMutableArray* internalArray; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGElementInstance_Mutable.h b/Source/Core/DOM classes/SVG-DOM/SVGElementInstance_Mutable.h new file mode 100644 index 000000000..05ef3ea59 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGElementInstance_Mutable.h @@ -0,0 +1,8 @@ +#import "SVGElementInstance.h" + +@interface SVGElementInstance () +@property(nonatomic,retain, readwrite) SVGElement* correspondingElement; +@property(nonatomic,retain, readwrite) SVGUseElement* correspondingUseElement; +@property(nonatomic,retain, readwrite) SVGElementInstance* parentNode; +@property(nonatomic,retain, readwrite) SVGElementInstanceList* childNodes; +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGLength.h b/Source/Core/DOM classes/SVG-DOM/SVGLength.h new file mode 100644 index 000000000..753b62d69 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGLength.h @@ -0,0 +1,65 @@ +/*! + SVGLength.h + + http://www.w3.org/TR/SVG/types.html#InterfaceSVGLength + + // Length Unit Types + const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0; + const unsigned short SVG_LENGTHTYPE_NUMBER = 1; + const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2; + const unsigned short SVG_LENGTHTYPE_EMS = 3; + const unsigned short SVG_LENGTHTYPE_EXS = 4; + const unsigned short SVG_LENGTHTYPE_PX = 5; + const unsigned short SVG_LENGTHTYPE_CM = 6; + const unsigned short SVG_LENGTHTYPE_MM = 7; + const unsigned short SVG_LENGTHTYPE_IN = 8; + const unsigned short SVG_LENGTHTYPE_PT = 9; + const unsigned short SVG_LENGTHTYPE_PC = 10; + + readonly attribute unsigned short unitType; + attribute float value setraises(DOMException); + attribute float valueInSpecifiedUnits setraises(DOMException); + attribute DOMString valueAsString setraises(DOMException); + + void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits) raises(DOMException); + void convertToSpecifiedUnits(in unsigned short unitType) raises(DOMException); + }; + */ +#import + +typedef enum SVG_LENGTH_TYPE +{ + SVG_LENGTHTYPE_UNKNOWN = 0, + SVG_LENGTHTYPE_NUMBER = 1, + SVG_LENGTHTYPE_PERCENTAGE = 2, + SVG_LENGTHTYPE_EMS = 3, + SVG_LENGTHTYPE_EXS = 4, + SVG_LENGTHTYPE_PX = 5, + SVG_LENGTHTYPE_CM = 6, + SVG_LENGTHTYPE_MM = 7, + SVG_LENGTHTYPE_IN = 8, + SVG_LENGTHTYPE_PT = 9, + SVG_LENGTHTYPE_PC = 10 +} SVG_LENGTH_TYPE; + + +@interface SVGLength : NSObject + +@property(nonatomic,readonly) SVG_LENGTH_TYPE unitType; +@property(nonatomic) float value; +@property(nonatomic) float valueInSpecifiedUnits; +@property(nonatomic,retain) NSString* valueAsString; + +-(void) newValueSpecifiedUnits:(SVG_LENGTH_TYPE) unitType valueInSpecifiedUnits:(float) valueInSpecifiedUnits; +-(void) convertToSpecifiedUnits:(SVG_LENGTH_TYPE) unitType; + +#pragma mark - things outside the spec but needed to make it usable in Objective C + ++(SVGLength*) svgLengthZero; ++(SVGLength*) svgLengthFromNSString:(NSString*) s; + +/** returns this SVGLength as if it had been converted to pixels, using [self convertToSpecifiedUnits:SVG_LENGTHTYPE_PX] + */ +-(float) pixelsValue; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGLength.m b/Source/Core/DOM classes/SVG-DOM/SVGLength.m new file mode 100644 index 000000000..d95d61302 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGLength.m @@ -0,0 +1,42 @@ +#import "SVGLength.h" + +@implementation SVGLength + +@synthesize unitType; +@synthesize value; +@synthesize valueInSpecifiedUnits; +@synthesize valueAsString; + +-(void) newValueSpecifiedUnits:(SVG_LENGTH_TYPE) unitType valueInSpecifiedUnits:(float) valueInSpecifiedUnits +{ + +} + +-(void) convertToSpecifiedUnits:(SVG_LENGTH_TYPE) unitType +{ + +} + ++(SVGLength*) svgLengthZero +{ + SVGLength* result = [[SVGLength new] autorelease]; + result.value = 0.0f; + + return result; +} + ++(SVGLength*) svgLengthFromNSString:(NSString*) s +{ + SVGLength* result = [[SVGLength new] autorelease]; + + result.value = [s floatValue]; + + return result; +} + +-(float) pixelsValue +{ + return value; +} + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGMatrix.h b/Source/Core/DOM classes/SVG-DOM/SVGMatrix.h new file mode 100644 index 000000000..d53124ca3 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGMatrix.h @@ -0,0 +1,51 @@ +/*! + + http://www.w3.org/TR/SVG/coords.html#InterfaceSVGMatrix + + interface SVGMatrix { + + attribute float a setraises(DOMException); + attribute float b setraises(DOMException); + attribute float c setraises(DOMException); + attribute float d setraises(DOMException); + attribute float e setraises(DOMException); + attribute float f setraises(DOMException); + + SVGMatrix multiply(in SVGMatrix secondMatrix); + SVGMatrix inverse() raises(SVGException); + SVGMatrix translate(in float x, in float y); + SVGMatrix scale(in float scaleFactor); + SVGMatrix scaleNonUniform(in float scaleFactorX, in float scaleFactorY); + SVGMatrix rotate(in float angle); + SVGMatrix rotateFromVector(in float x, in float y) raises(SVGException); + SVGMatrix flipX(); + SVGMatrix flipY(); + SVGMatrix skewX(in float angle); + SVGMatrix skewY(in float angle); + }; + */ + +#import + +@interface SVGMatrix : NSObject + +@property(nonatomic) float a; +@property(nonatomic) float b; +@property(nonatomic) float c; +@property(nonatomic) float d; +@property(nonatomic) float e; +@property(nonatomic) float f; + +-(SVGMatrix*) multiply:(SVGMatrix*) secondMatrix; +-(SVGMatrix*) inverse; +-(SVGMatrix*) translate:(float) x y:(float) y; +-(SVGMatrix*) scale:(float) scaleFactor; +-(SVGMatrix*) scaleNonUniform:(float) scaleFactorX scaleFactorY:(float) scaleFactorY; +-(SVGMatrix*) rotate:(float) angle; +-(SVGMatrix*) rotateFromVector:(float) x y:(float) y; +-(SVGMatrix*) flipX; +-(SVGMatrix*) flipY; +-(SVGMatrix*) skewX:(float) angle; +-(SVGMatrix*) skewY:(float) angle; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGMatrix.m b/Source/Core/DOM classes/SVG-DOM/SVGMatrix.m new file mode 100644 index 000000000..9b26de9f3 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGMatrix.m @@ -0,0 +1,20 @@ + +#import "SVGMatrix.h" + +@implementation SVGMatrix + +@synthesize a,b,c,d,e,f; + +-(SVGMatrix*) multiply:(SVGMatrix*) secondMatrix { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) inverse { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) translate:(float) x y:(float) y { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) scale:(float) scaleFactor { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) scaleNonUniform:(float) scaleFactorX scaleFactorY:(float) scaleFactorY { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) rotate:(float) angle { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) rotateFromVector:(float) x y:(float) y { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) flipX { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) flipY { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) skewX:(float) angle { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) skewY:(float) angle { NSAssert( FALSE, @"Not implemented yet" ); return nil; } + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGNumber.h b/Source/Core/DOM classes/SVG-DOM/SVGNumber.h new file mode 100644 index 000000000..dde75b96a --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGNumber.h @@ -0,0 +1,12 @@ +/*! + + http://www.w3.org/TR/SVG/types.html#InterfaceSVGNumber + + interface SVGNumber { + attribute float value setraises(DOMException); + }; + */ +typedef struct +{ + float value; +} SVGNumber; \ No newline at end of file diff --git a/Source/Core/DOM classes/SVG-DOM/SVGPoint.h b/Source/Core/DOM classes/SVG-DOM/SVGPoint.h new file mode 100644 index 000000000..04ed0f592 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGPoint.h @@ -0,0 +1,22 @@ +/*! + http://www.w3.org/TR/SVG/coords.html#InterfaceSVGPoint + + interface SVGPoint { + + attribute float x setraises(DOMException); + attribute float y setraises(DOMException); + + SVGPoint matrixTransform(in SVGMatrix matrix); + }; + */ +#import + +#import "SVGMatrix.h" + +@interface SVGPoint : NSObject + +@property(nonatomic,readonly) float x, y; + +-(SVGPoint*) matrixTransform:(SVGMatrix*) matrix; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGPoint.m b/Source/Core/DOM classes/SVG-DOM/SVGPoint.m new file mode 100644 index 000000000..87e1a4837 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGPoint.m @@ -0,0 +1,15 @@ + +#import "SVGPoint.h" + +@implementation SVGPoint + +@synthesize x, y; + +-(SVGPoint*) matrixTransform:(SVGMatrix*) matrix +{ + NSAssert( FALSE, @"Not implemented yet" ); + + return nil; +} + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGRect.h b/Source/Core/DOM classes/SVG-DOM/SVGRect.h new file mode 100644 index 000000000..6db6f648b --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGRect.h @@ -0,0 +1,19 @@ +/* + http://www.w3.org/TR/SVG/types.html#InterfaceSVGRect + + interface SVGRect { + attribute float x setraises(DOMException); + attribute float y setraises(DOMException); + attribute float width setraises(DOMException); + attribute float height setraises(DOMException); + }; + */ +#import + +typedef struct +{ + float x; + float y; + float width; + float height; +} SVGRect; \ No newline at end of file diff --git a/Source/Core/DOM classes/SVG-DOM/SVGSVGElement_Mutable.h b/Source/Core/DOM classes/SVG-DOM/SVGSVGElement_Mutable.h new file mode 100644 index 000000000..17b1e9ac5 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGSVGElement_Mutable.h @@ -0,0 +1,21 @@ +#import "SVGSVGElement.h" + +@interface SVGSVGElement () + +@property (nonatomic, retain, readwrite) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* x; +@property (nonatomic, retain, readwrite) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* y; +@property (nonatomic, retain, readwrite) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* width; +@property (nonatomic, retain, readwrite) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* height; +@property (nonatomic, retain, readwrite) NSString* contentScriptType; +@property (nonatomic, retain, readwrite) NSString* contentStyleType; +@property (nonatomic, readwrite) SVGRect viewport; +@property (nonatomic, readwrite) float pixelUnitToMillimeterX; +@property (nonatomic, readwrite) float pixelUnitToMillimeterY; +@property (nonatomic, readwrite) float screenPixelToMillimeterX; +@property (nonatomic, readwrite) float screenPixelToMillimeterY; +@property (nonatomic, readwrite) BOOL useCurrentView; +@property (nonatomic, retain, readwrite) SVGViewSpec* currentView; +@property (nonatomic, readwrite) float currentScale; +@property (nonatomic, retain, readwrite) SVGPoint* currentTranslate; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGTransform.h b/Source/Core/DOM classes/SVG-DOM/SVGTransform.h new file mode 100644 index 000000000..0a2d54e44 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGTransform.h @@ -0,0 +1,54 @@ +/*! + http://www.w3.org/TR/SVG/coords.html#InterfaceSVGTransform + + // Transform Types + const unsigned short SVG_TRANSFORM_UNKNOWN = 0; + const unsigned short SVG_TRANSFORM_MATRIX = 1; + const unsigned short SVG_TRANSFORM_TRANSLATE = 2; + const unsigned short SVG_TRANSFORM_SCALE = 3; + const unsigned short SVG_TRANSFORM_ROTATE = 4; + const unsigned short SVG_TRANSFORM_SKEWX = 5; + const unsigned short SVG_TRANSFORM_SKEWY = 6; + + readonly attribute unsigned short type; + readonly attribute SVGMatrix matrix; + readonly attribute float angle; + + void setMatrix(in SVGMatrix matrix) raises(DOMException); + void setTranslate(in float tx, in float ty) raises(DOMException); + void setScale(in float sx, in float sy) raises(DOMException); + void setRotate(in float angle, in float cx, in float cy) raises(DOMException); + void setSkewX(in float angle) raises(DOMException); + void setSkewY(in float angle) raises(DOMException); +*/ + +#import + +#import "SVGMatrix.h" + +@interface SVGTransform : NSObject + +/*! Transform Types */ +typedef enum SVGKTransformType +{ + SVG_TRANSFORM_UNKNOWN = 0, + SVG_TRANSFORM_MATRIX = 1, + SVG_TRANSFORM_TRANSLATE = 2, + SVG_TRANSFORM_SCALE = 3, + SVG_TRANSFORM_ROTATE = 4, + SVG_TRANSFORM_SKEWX = 5, + SVG_TRANSFORM_SKEWY = 6 +} SVGKTransformType; + +@property(nonatomic) SVGKTransformType type; +@property(nonatomic,retain) SVGMatrix* matrix; +@property(nonatomic,readonly) float angle; + +-(void) setMatrix:(SVGMatrix*) matrix; +-(void) setTranslate:(float) tx ty:(float) ty; +-(void) setScale:(float) sx sy:(float) sy; +-(void) setRotate:(float) angle cx:(float) cx cy:(float) cy; +-(void) setSkewX:(float) angle; +-(void) setSkewY:(float) angle; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGTransform.m b/Source/Core/DOM classes/SVG-DOM/SVGTransform.m new file mode 100644 index 000000000..d047050ea --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGTransform.m @@ -0,0 +1,16 @@ +#import "SVGTransform.h" + +@implementation SVGTransform + +@synthesize type; +@synthesize matrix; +@synthesize angle; + +-(void) setMatrix:(SVGMatrix*) matrix { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) setTranslate:(float) tx ty:(float) ty { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) setScale:(float) sx sy:(float) sy { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) setRotate:(float) angle cx:(float) cx cy:(float) cy { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) setSkewX:(float) angle { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) setSkewY:(float) angle { NSAssert( FALSE, @"Not implemented yet" ); } + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGUseElement.h b/Source/Core/DOM classes/SVG-DOM/SVGUseElement.h new file mode 100644 index 000000000..e783129c1 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGUseElement.h @@ -0,0 +1,37 @@ +/* + http://www.w3.org/TR/SVG/struct.html#InterfaceSVGUseElement + + interface SVGUseElement : SVGElement, + SVGURIReference, + SVGTests, + SVGLangSpace, + SVGExternalResourcesRequired, + SVGStylable, + SVGTransformable { + readonly attribute SVGAnimatedLength x; + readonly attribute SVGAnimatedLength y; + readonly attribute SVGAnimatedLength width; + readonly attribute SVGAnimatedLength height; + readonly attribute SVGElementInstance instanceRoot; + readonly attribute SVGElementInstance animatedInstanceRoot; + }; + + */ +#import "SVGLength.h" +#import "SVGElement.h" + +@class SVGElementInstance; +#import "SVGElementInstance.h" + +#import "SVGLayeredElement.h" + +@interface SVGUseElement : SVGElement + +@property(nonatomic, retain, readonly) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* x; +@property(nonatomic, retain, readonly) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* y; +@property(nonatomic, retain, readonly) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* width; +@property(nonatomic, retain, readonly) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* height; +@property(nonatomic, retain, readonly) SVGElementInstance* instanceRoot; +@property(nonatomic, retain, readonly) SVGElementInstance* animatedInstanceRoot; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGUseElement.m b/Source/Core/DOM classes/SVG-DOM/SVGUseElement.m new file mode 100644 index 000000000..5f8aa9daa --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGUseElement.m @@ -0,0 +1,39 @@ +#import "SVGUseElement.h" +#import "SVGUseElement_Mutable.h" + +@implementation SVGUseElement + +@synthesize x; +@synthesize y; +@synthesize width; +@synthesize height; +@synthesize instanceRoot; +@synthesize animatedInstanceRoot; + +-(CALayer *)newLayer +{ + if( [instanceRoot.correspondingElement respondsToSelector:@selector(newLayer)]) + { + CALayer* initialLayer = [((SVGElement*)instanceRoot.correspondingElement) newLayer]; + + if( CGRectIsEmpty( initialLayer.frame ) ) // Avoid Apple's UIKit getting upset by infinitely large/small areas due to floating point inaccuracy + return initialLayer; + + //For Xcode's broken debugger: CGAffineTransform i = initialLayer.affineTransform; + //For Xcode's broken debugger: CGAffineTransform mine = self.transformRelative; + + initialLayer.affineTransform = CGAffineTransformConcat( self.transformRelative, initialLayer.affineTransform ); + + return initialLayer; + } + else + return nil; +} + +-(void)layoutLayer:(CALayer *)layer +{ + if( [instanceRoot.correspondingElement respondsToSelector:@selector(layoutLayer:)]) + [((SVGElement*)instanceRoot.correspondingElement) layoutLayer:layer]; +} + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGUseElement_Mutable.h b/Source/Core/DOM classes/SVG-DOM/SVGUseElement_Mutable.h new file mode 100644 index 000000000..bd9ea8cb2 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGUseElement_Mutable.h @@ -0,0 +1,11 @@ +#import "SVGUseElement.h" + +@interface SVGUseElement () +@property(nonatomic, retain, readwrite) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* x; +@property(nonatomic, retain, readwrite) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* y; +@property(nonatomic, retain, readwrite) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* width; +@property(nonatomic, retain, readwrite) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* height; +@property(nonatomic, retain, readwrite) SVGElementInstance* instanceRoot; +@property(nonatomic, retain, readwrite) SVGElementInstance* animatedInstanceRoot; + +@end diff --git a/Source/Core/DOM classes/SVG-DOM/SVGViewSpec.h b/Source/Core/DOM classes/SVG-DOM/SVGViewSpec.h new file mode 100644 index 000000000..4e81af3e8 --- /dev/null +++ b/Source/Core/DOM classes/SVG-DOM/SVGViewSpec.h @@ -0,0 +1,28 @@ +/*! + SVGViewSpec + + interface SVGViewSpec : SVGZoomAndPan, + SVGFitToViewBox { + readonly attribute SVGTransformList transform; + readonly attribute SVGElement viewTarget; + readonly attribute DOMString viewBoxString; + readonly attribute DOMString preserveAspectRatioString; + readonly attribute DOMString transformString; + readonly attribute DOMString viewTargetString; + }; + */ +#import + +@class SVGElement; +#import "SVGElement.h" + +@interface SVGViewSpec : NSObject + +/* FIXME: SVGTransformList not implemented yet: @property(nonatomic,readonly) SVGTransformList transform; */ +@property(nonatomic,readonly) SVGElement* viewTarget; +@property(nonatomic,readonly) NSString* viewBoxString; +@property(nonatomic,readonly) NSString* preserveAspectRatioString; +@property(nonatomic,readonly) NSString* transformString; +@property(nonatomic,readonly) NSString* viewTargetString; + +@end diff --git a/Core/SVGCircleElement.h b/Source/Core/DOM classes/SVGCircleElement.h similarity index 100% rename from Core/SVGCircleElement.h rename to Source/Core/DOM classes/SVGCircleElement.h diff --git a/Core/SVGCircleElement.m b/Source/Core/DOM classes/SVGCircleElement.m similarity index 100% rename from Core/SVGCircleElement.m rename to Source/Core/DOM classes/SVGCircleElement.m diff --git a/Core/SVGDescriptionElement.h b/Source/Core/DOM classes/SVGDescriptionElement.h similarity index 100% rename from Core/SVGDescriptionElement.h rename to Source/Core/DOM classes/SVGDescriptionElement.h diff --git a/Core/SVGDescriptionElement.m b/Source/Core/DOM classes/SVGDescriptionElement.m similarity index 100% rename from Core/SVGDescriptionElement.m rename to Source/Core/DOM classes/SVGDescriptionElement.m diff --git a/Source/Core/DOM classes/SVGElement.h b/Source/Core/DOM classes/SVGElement.h new file mode 100644 index 000000000..959f899fb --- /dev/null +++ b/Source/Core/DOM classes/SVGElement.h @@ -0,0 +1,64 @@ +/** + SVGElement + + http://www.w3.org/TR/SVG/types.html#InterfaceSVGElement + + NB: "id" is illegal in Objective-C language, so we use "identifier" instead + + + + NON STANDARD: "transformRelative": identity OR the transform to apply BEFORE rendering this element (and its children) + + */ +#import + +#import "Element.h" +#import "Node+Mutable.h" + +@class SVGSVGElement; +//obj-c's compiler sucks, and doesn't allow this line: #import "SVGSVGElement.h" + +@interface SVGElement : Element + +@property (nonatomic, readwrite, retain) NSString *identifier; // 'id' is reserved in Obj-C, so we have to break SVG Spec here, slightly +@property (nonatomic, retain) NSString* xmlbase; +/*! + + http://www.w3.org/TR/SVG/intro.html#TermSVGDocumentFragment + + SVG document fragment + The XML document sub-tree which starts with an ‘svg’ element. An SVG document fragment can consist of a stand-alone SVG document, or a fragment of a parent XML document enclosed by an ‘svg’ element. When an ‘svg’ element is a descendant of another ‘svg’ element, there are two SVG document fragments, one for each ‘svg’ element. (One SVG document fragment is contained within another SVG document fragment.) + */ +@property (nonatomic, retain) SVGSVGElement* rootOfCurrentDocumentFragment; + +/*! The viewport is set / re-set whenever an SVG node specifies a "width" (and optionally: a "height") attribute, + assuming that SVG node is one of: svg, symbol, image, foreignobject + + The spec isn't clear what happens if this element redefines the viewport itself, but IMHO it implies that the + viewportElement becomes a reference to "self" */ +@property (nonatomic, retain) SVGElement* viewportElement; + + +#pragma mark - NON-STANDARD features of class (these are things that are NOT in the SVG spec, and should NOT be in SVGKit's implementation - they should be moved to a different class, although WE DO STILL NEED THESE in order to implement the spec, and to provide SVGKit features!) + +/*! This is used when generating CALayer objects, to store the id of the SVGElement that created the CALayer */ +#define kSVGElementIdentifier @"SVGElementIdentifier" + +@property (nonatomic, readonly, copy) NSString *stringValue; + +/*! Transform to be applied to this node and all sub-nodes; does NOT take account of any transforms applied by parent / ancestor nodes + + FIXME: this method could be removed by some careful refactoring of the code in SVGKImage and its CALayer generation + code. You need to also refactor / merge the method "transformAbsolute" in the .m file of this class. + */ +@property (nonatomic) CGAffineTransform transformRelative; + +- (void)parseContent:(NSString *)content; + +#pragma mark - SVG-spec supporting methods that aren't in the Spec itself + +- (id)initWithLocalName:(NSString*) n attributes:(NSMutableDictionary*) attributes; +- (id)initWithQualifiedName:(NSString*) n inNameSpaceURI:(NSString*) nsURI attributes:(NSMutableDictionary*) attributes; + +-(void) reCalculateAndSetViewportElementReferenceUsingFirstSVGAncestor:(SVGElement*) firstAncestor; + +@end \ No newline at end of file diff --git a/Source/Core/DOM classes/SVGElement.m b/Source/Core/DOM classes/SVGElement.m new file mode 100644 index 000000000..af9912fdb --- /dev/null +++ b/Source/Core/DOM classes/SVGElement.m @@ -0,0 +1,392 @@ +// +// SVGElement.m +// SVGKit +// +// Copyright Matt Rajca 2010-2011. All rights reserved. +// + +#import "SVGElement.h" + +#import "SVGElement_ForParser.h" //.h" // to solve insane Xcode circular dependencies + +@interface SVGElement () + +@property (nonatomic, copy) NSString *stringValue; + +@end + +/*! main class implementation for the base SVGElement: NOTE: in practice, most of the interesting + stuff happens in subclasses, e.g.: + + SVGShapeElement + SVGGroupElement + SVGKImageElement + SVGLineElement + SVGPathElement + ...etc + */ +@implementation SVGElement + +@synthesize identifier = _identifier; +@synthesize xmlbase; +@synthesize rootOfCurrentDocumentFragment; +@synthesize viewportElement; + +@synthesize stringValue = _stringValue; + +@synthesize transformRelative = _transformRelative; + + + ++ (BOOL)shouldStoreContent { + return NO; +} + +/*! As per the SVG Spec, the local reference to "viewportElement" depends on the values of the + attributes of the node - does it have a "width" attribute? + + NB: by definition, tags MAY NOT have a width, but they are still viewports */ +-(void) reCalculateAndSetViewportElementReferenceUsingFirstSVGAncestor:(SVGElement*) firstAncestor +{ + // NB the root svg element IS a viewport, but SVG Spec defines it as NOT a viewport, and so we will overwrite this later + BOOL isTagAllowedToBeAViewport = [self.tagName isEqualToString:@"svg"] || [self.tagName isEqualToString:@"image"] || [self.tagName isEqualToString:@"foreignObject"]; + + BOOL isTagDefiningAViewport = [self.attributes getNamedItem:@"width"] != nil || [self.attributes getNamedItem:@"height"] != nil; + + if( isTagAllowedToBeAViewport && isTagDefiningAViewport ) + { + NSLog(@"[%@] WARNING: setting self (tag = %@) to be a viewport", [self class], self.tagName ); + self.viewportElement = self; + } + else + { + SVGElement* ancestorsViewport = firstAncestor.viewportElement; + + if( ancestorsViewport == nil ) + { + /** + Because of the poorly-designed SVG Spec on Viewports, all the children of the root + SVG node will find that their ancestor has a nil viewport! (this is defined in the spec) + + So, in that special case, we INSTEAD guess that the ancestor itself was the viewport... + */ + self.viewportElement = firstAncestor; + } + else + self.viewportElement = ancestorsViewport; + } +} + +/*! Override so that we can automatically set / unset the ownerSVGElement and viewportElement properties, + as required by SVG Spec */ +-(void)setParentNode:(Node *)newParent +{ + [super setParentNode:newParent]; + + /** SVG Spec: if "outermost SVG tag" then both element refs should be nil */ + if( [self isKindOfClass:[SVGSVGElement class]] + && (self.parentNode == nil || ! [self.parentNode isKindOfClass:[SVGElement class]]) ) + { + self.rootOfCurrentDocumentFragment = nil; + self.viewportElement = nil; + } + else + { + /** + SVG Spec: we have to set a reference to the "root SVG tag of this part of the tree". + + If the tree is purely SVGElement nodes / subclasses, that's easy. + + But if there are custom nodes in there (any other DOM node, for instance), it gets + more tricky. We have to recurse up the tree until we find an SVGElement we can latch + onto + */ + + if( [self isKindOfClass:[SVGSVGElement class]] ) + { + self.rootOfCurrentDocumentFragment = (SVGSVGElement*) self; + self.viewportElement = self; + } + else + { + Node* currentAncestor = newParent; + SVGElement* firstAncestorThatIsAnyKindOfSVGElement = nil; + while( firstAncestorThatIsAnyKindOfSVGElement == nil + && currentAncestor != nil ) // if we run out of tree! This would be an error (see below) + { + if( [currentAncestor isKindOfClass:[SVGElement class]] ) + firstAncestorThatIsAnyKindOfSVGElement = (SVGElement*) currentAncestor; + else + currentAncestor = currentAncestor.parentNode; + } + + NSAssert( firstAncestorThatIsAnyKindOfSVGElement != nil, @"This node has no valid SVG tags as ancestor, but it's not an tag, so this is an impossible SVG file" ); + + + self.rootOfCurrentDocumentFragment = firstAncestorThatIsAnyKindOfSVGElement.rootOfCurrentDocumentFragment; + [self reCalculateAndSetViewportElementReferenceUsingFirstSVGAncestor:firstAncestorThatIsAnyKindOfSVGElement]; + + NSLog(@"viewport Element = %@ ... for node/element = %@", self.viewportElement, self.tagName); + } + } +} + +- (void)dealloc { + [_stringValue release]; + [_identifier release]; + + [super dealloc]; +} + +- (void)loadDefaults { + // to be overriden by subclasses +} + +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + // to be overriden by subclasses + // make sure super implementation is called + + if( [[self getAttribute:@"id"] length] > 0 ) + self.identifier = [self getAttribute:@"id"]; + + + /** + http://www.w3.org/TR/SVG/coords.html#TransformAttribute + + The available types of transform definitions include: + + * matrix( ), which specifies a transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f]. + + * translate( []), which specifies a translation by tx and ty. If is not provided, it is assumed to be zero. + + * scale( []), which specifies a scale operation by sx and sy. If is not provided, it is assumed to be equal to . + + * rotate( [ ]), which specifies a rotation by degrees about a given point. + If optional parameters and are not supplied, the rotate is about the origin of the current user coordinate system. The operation corresponds to the matrix [cos(a) sin(a) -sin(a) cos(a) 0 0]. + If optional parameters and are supplied, the rotate is about the point (cx, cy). The operation represents the equivalent of the following specification: translate(, ) rotate() translate(-, -). + + * skewX(), which specifies a skew transformation along the x-axis. + + * skewY(), which specifies a skew transformation along the y-axis. + */ + if( [[self getAttribute:@"transform"] length] > 0 ) + { + /** + http://www.w3.org/TR/SVG/coords.html#TransformAttribute + + The individual transform definitions are separated by whitespace and/or a comma. + */ + NSString* value = [self getAttribute:@"transform"]; + +#if !(TARGET_OS_IPHONE) && ( !defined( __MAC_10_7 ) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6_7 ) + NSLog(@"[%@] WARNING: the transform attribute requires OS X 10.7 or above (we need Regular Expressions! Apple was slow to add them :( ). Ignoring TRANSFORMs in SVG!", [self class] ); +#else + NSError* error = nil; + NSRegularExpression* regexpTransformListItem = [NSRegularExpression regularExpressionWithPattern:@"[^\\(,]*\\([^\\)]*\\)" options:0 error:&error]; + + [regexpTransformListItem enumerateMatchesInString:value options:0 range:NSMakeRange(0, [value length]) usingBlock: + ^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) + { + NSString* transformString = [value substringWithRange:[result range]]; + + NSRange loc = [transformString rangeOfString:@"("]; + if( loc.length == 0 ) + { + NSLog(@"[%@] ERROR: input file is illegal, has an item in the SVG transform attribute which has no open-bracket. Item = %@, transform attribute value = %@", [self class], transformString, value ); + return; + } + NSString* command = [transformString substringToIndex:loc.location]; + NSArray* parameterStrings = [[transformString substringFromIndex:loc.location+1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]]; + + command = [command stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" "]]; + + if( [command isEqualToString:@"translate"] ) + { + CGFloat xtrans = [(NSString*)[parameterStrings objectAtIndex:0] floatValue]; + CGFloat ytrans = [parameterStrings count] > 1 ? [(NSString*)[parameterStrings objectAtIndex:1] floatValue] : 0.0; + + CGAffineTransform nt = CGAffineTransformMakeTranslation(xtrans, ytrans); + self.transformRelative = CGAffineTransformConcat( self.transformRelative, nt ); + + } + else if( [command isEqualToString:@"scale"] ) + { + NSArray *scaleStrings = [[parameterStrings objectAtIndex:0] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + + CGFloat xScale = [(NSString*)[scaleStrings objectAtIndex:0] floatValue]; + CGFloat yScale = [scaleStrings count] > 1 ? [(NSString*)[scaleStrings objectAtIndex:1] floatValue] : xScale; + + CGAffineTransform nt = CGAffineTransformMakeScale(xScale, yScale); + self.transformRelative = CGAffineTransformConcat( self.transformRelative, nt ); + } + else if( [command isEqualToString:@"matrix"] ) + { + CGFloat a = [(NSString*)[parameterStrings objectAtIndex:0] floatValue]; + CGFloat b = [(NSString*)[parameterStrings objectAtIndex:1] floatValue]; + CGFloat c = [(NSString*)[parameterStrings objectAtIndex:2] floatValue]; + CGFloat d = [(NSString*)[parameterStrings objectAtIndex:3] floatValue]; + CGFloat tx = [(NSString*)[parameterStrings objectAtIndex:4] floatValue]; + CGFloat ty = [(NSString*)[parameterStrings objectAtIndex:5] floatValue]; + + CGAffineTransform nt = CGAffineTransformMake(a, b, c, d, tx, ty ); + self.transformRelative = CGAffineTransformConcat( self.transformRelative, nt ); + + } + else if( [command isEqualToString:@"rotate"] ) + { + /** + This section merged from warpflyght's commit: + + https://github.com/warpflyght/SVGKit/commit/c1bd9b3d0607635dda14ec03579793fc682763d9 + + */ + NSArray *rotateStrings = [[parameterStrings objectAtIndex:0] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + if( [rotateStrings count] == 1) + { + CGFloat degrees = [[rotateStrings objectAtIndex:0] floatValue]; + CGFloat radians = degrees * M_PI / 180.0; + + CGAffineTransform nt = CGAffineTransformMakeRotation(radians); + self.transformRelative = CGAffineTransformConcat( self.transformRelative, nt ); + } + else if( [rotateStrings count] == 3) + { + CGFloat degrees = [[rotateStrings objectAtIndex:0] floatValue]; + CGFloat radians = degrees * M_PI / 180.0; + CGFloat centerX = [[rotateStrings objectAtIndex:1] floatValue]; + CGFloat centerY = [[rotateStrings objectAtIndex:2] floatValue]; + CGAffineTransform nt = CGAffineTransformIdentity; + nt = CGAffineTransformConcat( nt, CGAffineTransformMakeTranslation(centerX, centerY) ); + nt = CGAffineTransformConcat( nt, CGAffineTransformMakeRotation(radians) ); + nt = CGAffineTransformConcat( nt, CGAffineTransformMakeTranslation(-1.0 * centerX, -1.0 * centerY) ); + self.transformRelative = CGAffineTransformConcat( self.transformRelative, nt ); + } else + { + NSLog(@"[%@] ERROR: input file is illegal, has an SVG matrix transform attribute without the required 1 or 3 parameters. Item = %@, transform attribute value = %@", [self class], transformString, value ); + return; + } + } + else if( [command isEqualToString:@"skewX"] ) + { + NSLog(@"[%@] ERROR: skew is unsupported: %@", [self class], command ); + + [parseResult addParseErrorRecoverable: [NSError errorWithDomain:@"SVGKit" code:15184 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: + @"transform=skewX is unsupported", NSLocalizedDescriptionKey, + nil] + ]]; + } + else if( [command isEqualToString:@"skewY"] ) + { + NSLog(@"[%@] ERROR: skew is unsupported: %@", [self class], command ); + [parseResult addParseErrorRecoverable: [NSError errorWithDomain:@"SVGKit" code:15184 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: + @"transform=skewY is unsupported", NSLocalizedDescriptionKey, + nil] + ]]; + } + else + { + NSAssert( FALSE, @"Not implemented yet: transform = %@ %@", command, transformString ); + } + }]; + + NSLog(@"[%@] Set local / relative transform = (%2.2f, %2.2f // %2.2f, %2.2f) + (%2.2f, %2.2f translate)", [self class], self.transformRelative.a, self.transformRelative.b, self.transformRelative.c, self.transformRelative.d, self.transformRelative.tx, self.transformRelative.ty ); +#endif + } + +} + +/*! ADAM: SVG Official spec is EXTREMELY BADLY WRITTEN for this aspect (transforms + viewports + viewboxes) - almost all the documentation + is "missing" and what's there is mumbo-jumbo appallingly bad English. I've had to do lots of "intelligent guessing" and "trial and error" + to work out what the heck the authors were TRYING to say, but failing badly at actually saying. + */ +-(CGAffineTransform) transformAbsolute +{ + /** + + Each time you hit a viewPortElement in the DOM Tree, you + have to insert an ADDITIONAL transform into the flow of: + + parent-transform -> child-transform + + has to become: + + parent-transform -> VIEWPORT-TRANSFORM -> child-transform + */ + + CGAffineTransform parentAbsoluteTransform; + CGAffineTransform selfRelativeTransform; + CGAffineTransform optionalViewportTransform; + + NSAssert( self.parentNode == nil || [self.parentNode isKindOfClass:[SVGElement class]], @"I don't know what to do when parent node is NOT an SVG element of some kind; presumably, this is when SVG root node gets embedded inside something else? The Spec IS VERY BADLY WRITTEN and doesn't clearly define ANYTHING here, and provides very few examples" ); + + /** PARENT absolute */ + SVGElement* parentSVGElement = (SVGElement*) self.parentNode; + if( self.parentNode == nil) + parentAbsoluteTransform = CGAffineTransformIdentity; + else + parentAbsoluteTransform = [parentSVGElement transformAbsolute]; + + /** SELF relative */ + selfRelativeTransform = self.transformRelative; + + /** VIEWPORT relative */ + if( self.viewportElement != nil // if it's nil, it means THE OPPOSITE of what you'd expect - it means that it IS the viewport element - SVG Spec REQUIRES this + && self.viewportElement != self // if it's some-other-object, then: we simply don't need to worry about it + ) + optionalViewportTransform = CGAffineTransformIdentity; + else + { + NSAssert( [self isKindOfClass:[SVGSVGElement class]], @"I don't know how to handle a VIEWPORT element that is NOT an tag. The SVG Spec is appallingly badly written, provides zero guidance, and zero examples. Someone will need to investigate as soon as we have an example!"); + + SVGSVGElement* selfAsSVGTag = (SVGSVGElement*) self; + CGRect frameViewBox = selfAsSVGTag.viewBoxFrame; + CGRect frameViewport = CGRectMake(0,0, [selfAsSVGTag.width pixelsValue], [selfAsSVGTag.height pixelsValue] ); + + if( ! CGRectIsEmpty( frameViewBox ) ) + optionalViewportTransform = CGAffineTransformMakeScale( frameViewport.size.width / frameViewBox.size.width, frameViewport.size.height / frameViewBox.size.height); + else + optionalViewportTransform = CGAffineTransformIdentity; + } + + + /** SELF absolute */ + CGAffineTransform result = CGAffineTransformConcat( selfRelativeTransform, CGAffineTransformConcat( optionalViewportTransform, parentAbsoluteTransform)); + + NSLog( @"[%@] self.transformAbsolute: returning: affine( (%2.1f %2.1f %2.1f %2.1f), (%2.1f %2.1f)", [self class], result.a, result.b, result.c, result.d, result.tx, result.ty); + + return result; +} + +- (void)parseContent:(NSString *)content { + self.stringValue = content; +} + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@ %p | id=%@ | prefix:localName=%@:%@ | tagName=%@ | stringValue=%@ | children=%ld>", + [self class], self, _identifier, self.prefix, self.localName, self.tagName, _stringValue, self.childNodes.length]; +} + +#pragma mark - Objective-C init methods (not in SVG Spec - the official spec has no explicit way to create nodes, which is clearly a bug in the Spec. Until they fix the spec, we have to do something or else SVG would be unusable) + +- (id)initWithLocalName:(NSString*) n attributes:(NSMutableDictionary*) attributes +{ + self = [super initWithLocalName:n attributes:attributes]; + if( self ) + { + [self loadDefaults]; + self.transformRelative = CGAffineTransformIdentity; + } + return self; +} +- (id)initWithQualifiedName:(NSString*) n inNameSpaceURI:(NSString*) nsURI attributes:(NSMutableDictionary*) attributes +{ + self = [super initWithQualifiedName:n inNameSpaceURI:nsURI attributes:attributes]; + if( self ) + { + [self loadDefaults]; + self.transformRelative = CGAffineTransformIdentity; + } + return self; +} + +@end diff --git a/Source/Core/DOM classes/SVGElement_ForParser.h b/Source/Core/DOM classes/SVGElement_ForParser.h new file mode 100644 index 000000000..17029c140 --- /dev/null +++ b/Source/Core/DOM classes/SVGElement_ForParser.h @@ -0,0 +1,21 @@ +#import "SVGElement.h" + +#import "SVGKParseResult.h" + +@interface SVGElement () + + ++ (BOOL)shouldStoreContent; // to optimize parser, default is NO + +- (void)loadDefaults; // should be overriden to set element defaults + +/*! Overridden by sub-classes. Be sure to call [super postProcessAttributesAddingErrorsTo:attributes]; + Returns nil, or an error if something failed trying to parse attributes (usually: + unsupported SVG feature that's not implemented yet) + */ +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult; + +/*! Re-calculates the absolute transform on-demand by querying parent's absolute transform and appending self's relative transform */ +-(CGAffineTransform) transformAbsolute; + +@end diff --git a/Core/SVGEllipseElement.h b/Source/Core/DOM classes/SVGEllipseElement.h similarity index 100% rename from Core/SVGEllipseElement.h rename to Source/Core/DOM classes/SVGEllipseElement.h diff --git a/Source/Core/DOM classes/SVGEllipseElement.m b/Source/Core/DOM classes/SVGEllipseElement.m new file mode 100644 index 000000000..5a2cdb51a --- /dev/null +++ b/Source/Core/DOM classes/SVGEllipseElement.m @@ -0,0 +1,52 @@ +// +// SVGEllipseElement.m +// SVGKit +// +// Copyright Matt Rajca 2010-2011. All rights reserved. +// + +#import "SVGEllipseElement.h" + +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) + +@interface SVGEllipseElement() +@property (nonatomic, readwrite) CGFloat cx; +@property (nonatomic, readwrite) CGFloat cy; +@property (nonatomic, readwrite) CGFloat rx; +@property (nonatomic, readwrite) CGFloat ry; +@end + +@implementation SVGEllipseElement + +@synthesize cx = _cx; +@synthesize cy = _cy; +@synthesize rx = _rx; +@synthesize ry = _ry; + +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + [super postProcessAttributesAddingErrorsTo:parseResult]; + + if( [[self getAttribute:@"cx"] length] > 0 ) + self.cx = [[self getAttribute:@"cx"] floatValue]; + + if( [[self getAttribute:@"cy"] length] > 0 ) + self.cy = [[self getAttribute:@"cy"] floatValue]; + + if( [[self getAttribute:@"rx"] length] > 0 ) + self.rx = [[self getAttribute:@"rx"] floatValue]; + + if( [[self getAttribute:@"ry"] length] > 0 ) + self.ry = [[self getAttribute:@"ry"] floatValue]; + + if( [[self getAttribute:@"r"] length] > 0 ) { // circle + self.ry = self.rx = [[self getAttribute:@"r"] floatValue]; + } + + CGMutablePathRef path = CGPathCreateMutable(); + CGPathAddEllipseInRect(path, NULL, CGRectMake(_cx - _rx, _cy - _ry, _rx * 2, _ry * 2)); + + [self setPathByCopyingPathFromLocalSpace:path]; + CGPathRelease(path); +} + +@end diff --git a/Core/SVGGroupElement.h b/Source/Core/DOM classes/SVGGroupElement.h similarity index 89% rename from Core/SVGGroupElement.h rename to Source/Core/DOM classes/SVGGroupElement.h index 2e128fc40..5c1a24c5e 100644 --- a/Core/SVGGroupElement.h +++ b/Source/Core/DOM classes/SVGGroupElement.h @@ -6,6 +6,7 @@ // #import "SVGElement.h" +#import "SVGLayeredElement.h" @interface SVGGroupElement : SVGElement < SVGLayeredElement > { } diff --git a/Source/Core/DOM classes/SVGGroupElement.m b/Source/Core/DOM classes/SVGGroupElement.m new file mode 100644 index 000000000..7664365a4 --- /dev/null +++ b/Source/Core/DOM classes/SVGGroupElement.m @@ -0,0 +1,87 @@ +/** + SVGGroupElement.m + + In SVG, every single element can contain children. + + However, the SVG spec defines a special (optional) "group" element, that is never rendered, + but allows additional nesting (e.g. for programmatic / organizational purposes). + + This is the "G" tag. + + To make sure we don't lose this info when loading an SVG, we store a special element for it. + */ +#import "SVGGroupElement.h" + +#import "CALayerWithChildHitTest.h" + +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) + +@implementation SVGGroupElement + +@synthesize opacity = _opacity; + +- (void)dealloc { + + [super dealloc]; +} + +- (void)loadDefaults { + _opacity = 1.0f; +} + +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + [super postProcessAttributesAddingErrorsTo:parseResult]; + + if( [[self getAttribute:@"opacity"] length] > 0 ) + _opacity = [[self getAttribute:@"opacity"] floatValue]; +} + +- (CALayer *) newLayer +{ + + CALayer* _layer = [[CALayerWithChildHitTest layer] retain]; + + _layer.name = self.identifier; + [_layer setValue:self.identifier forKey:kSVGElementIdentifier]; + _layer.opacity = _opacity; + + if ([_layer respondsToSelector:@selector(setShouldRasterize:)]) { + [_layer performSelector:@selector(setShouldRasterize:) + withObject:[NSNumber numberWithBool:YES]]; + } + + return _layer; +} + +- (void)layoutLayer:(CALayer *)layer { + CGRect mainRect = CGRectZero; + + /** Adam: make a frame thats the UNION of all sublayers frames */ + for ( CALayer *currentLayer in [layer sublayers] ) + { + CGRect subLayerFrame = currentLayer.frame; + mainRect = CGRectUnion(mainRect, subLayerFrame); + } + + layer.frame = mainRect; + + /** Adam:(dont know why this is here): set each sublayer to have a frame the same size as the parent frame, but with 0 offset. + + Adam: if I understand this correctly, the person who wrote it should have just written: + + "currentLayer.bounds = layer.frame" + + i.e. make every layer have the same size as the parent layer. + + But whoever wrote this didn't document their bad code, so I have no idea if thats correct or not + */ + for (CALayer *currentLayer in [layer sublayers]) { + CGRect frame = currentLayer.frame; + frame.origin.x -= mainRect.origin.x; + frame.origin.y -= mainRect.origin.y; + + currentLayer.frame = frame; + } +} + +@end diff --git a/Core/SVGImageElement.h b/Source/Core/DOM classes/SVGImageElement.h similarity index 62% rename from Core/SVGImageElement.h rename to Source/Core/DOM classes/SVGImageElement.h index e3173d15d..07186795a 100644 --- a/Core/SVGImageElement.h +++ b/Source/Core/DOM classes/SVGImageElement.h @@ -10,6 +10,8 @@ #import "SVGElement.h" +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) + @interface SVGImageElement : SVGElement @property (nonatomic, readonly) CGFloat x; @@ -17,6 +19,6 @@ @property (nonatomic, readonly) CGFloat width; @property (nonatomic, readonly) CGFloat height; -@property (nonatomic, readonly) NSString *href; +@property (nonatomic, retain, readonly) NSString *href; @end diff --git a/Core/SVGImageElement.m b/Source/Core/DOM classes/SVGImageElement.m similarity index 59% rename from Core/SVGImageElement.m rename to Source/Core/DOM classes/SVGImageElement.m index 22a68f08e..d18899a43 100644 --- a/Core/SVGImageElement.m +++ b/Source/Core/DOM classes/SVGImageElement.m @@ -1,5 +1,5 @@ // -// SVGImageElement.m +// SVGKImageElement.m // SvgLoader // // Created by Joshua May on 24/06/11. @@ -33,6 +33,9 @@ CGImageRef SVGImageCGImage(SVGImageRef img) #endif } +@interface SVGImageElement() +@property (nonatomic, retain, readwrite) NSString *href; +@end @implementation SVGImageElement @@ -49,45 +52,37 @@ - (void)dealloc { [super dealloc]; } -- (id)init { - self = [super init]; - if (self) { - // Initialization code here. - } - - return self; -} +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + [super postProcessAttributesAddingErrorsTo:parseResult]; -- (void)parseAttributes:(NSDictionary *)attributes { - id value = nil; + if( [[self getAttribute:@"x"] length] > 0 ) + _x = [[self getAttribute:@"x"] floatValue]; - if ((value = [attributes objectForKey:@"x"])) { - _x = [value floatValue]; - } + if( [[self getAttribute:@"y"] length] > 0 ) + _y = [[self getAttribute:@"y"] floatValue]; - if ((value = [attributes objectForKey:@"y"])) { - _y = [value floatValue]; - } + if( [[self getAttribute:@"width"] length] > 0 ) + _width = [[self getAttribute:@"width"] floatValue]; - if ((value = [attributes objectForKey:@"width"])) { - _width = [value floatValue]; - } + if( [[self getAttribute:@"height"] length] > 0 ) + _height = [[self getAttribute:@"height"] floatValue]; - if ((value = [attributes objectForKey:@"height"])) { - _height = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"href"])) { - _href = [value retain]; - } + if( [[self getAttribute:@"href"] length] > 0 ) + self.href = [self getAttribute:@"href"]; } -- (CALayer *)newLayer { - __block CALayer *layer = [CALayer layer]; +- (CALayer *) newLayer +{ + NSAssert( FALSE, @"NOT SUPPORTED: SVG Image Element . newLayer -- must be upgraded using the algorithm in SVGShapeElement.newLayer"); + + __block CALayer *layer = [[CALayer layer] retain]; layer.name = self.identifier; [layer setValue:self.identifier forKey:kSVGElementIdentifier]; - layer.frame = CGRectMake(_x, _y, _width, _height); + + CGRect frame = CGRectMake(_x, _y, _width, _height); + frame = CGRectApplyAffineTransform(frame, [self transformAbsolute]); + layer.frame = frame; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:_href]]; diff --git a/Source/Core/DOM classes/SVGLayeredElement.h b/Source/Core/DOM classes/SVGLayeredElement.h new file mode 100644 index 000000000..94dc569d1 --- /dev/null +++ b/Source/Core/DOM classes/SVGLayeredElement.h @@ -0,0 +1,15 @@ +#import +#import + +@protocol SVGLayeredElement < NSObject > + +/*! + NB: the returned layer has - as its "name" property - the "identifier" property of the SVGElement that created it; + but that can be overwritten by applications (for valid reasons), so we ADDITIONALLY store the identifier into a + custom key - kSVGElementIdentifier - on the CALayer. Because it's a custom key, it's (almost) guaranteed not to be + overwritten / altered by other application code + */ +- (CALayer *) newLayer; +- (void)layoutLayer:(CALayer *)layer; + +@end diff --git a/Core/SVGLineElement.h b/Source/Core/DOM classes/SVGLineElement.h similarity index 100% rename from Core/SVGLineElement.h rename to Source/Core/DOM classes/SVGLineElement.h diff --git a/Source/Core/DOM classes/SVGLineElement.m b/Source/Core/DOM classes/SVGLineElement.m new file mode 100644 index 000000000..2dabc15f4 --- /dev/null +++ b/Source/Core/DOM classes/SVGLineElement.m @@ -0,0 +1,42 @@ +// +// SVGLineElement.m +// SVGKit +// +// Copyright Matt Rajca 2010-2011. All rights reserved. +// + +#import "SVGLineElement.h" + +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) + +@implementation SVGLineElement + +@synthesize x1 = _x1; +@synthesize y1 = _y1; +@synthesize x2 = _x2; +@synthesize y2 = _y2; + +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + [super postProcessAttributesAddingErrorsTo:parseResult]; + + if( [[self getAttribute:@"x1"] length] > 0 ) + _x1 = [[self getAttribute:@"x1"] floatValue]; + + if( [[self getAttribute:@"y1"] length] > 0 ) + _y1 = [[self getAttribute:@"y1"] floatValue]; + + if( [[self getAttribute:@"x2"] length] > 0 ) + _x2 = [[self getAttribute:@"x2"] floatValue]; + + if( [[self getAttribute:@"y2"] length] > 0 ) + _y2 = [[self getAttribute:@"y2"] floatValue]; + + CGMutablePathRef path = CGPathCreateMutable(); + CGPathMoveToPoint(path, NULL, _x1, _y1); + CGPathAddLineToPoint(path, NULL, _x2, _y2); + + [self setPathByCopyingPathFromLocalSpace:path]; + CGPathRelease(path); +} + +@end diff --git a/Core/SVGPathElement.h b/Source/Core/DOM classes/SVGPathElement.h similarity index 100% rename from Core/SVGPathElement.h rename to Source/Core/DOM classes/SVGPathElement.h diff --git a/Core/SVGPathElement.m b/Source/Core/DOM classes/SVGPathElement.m similarity index 60% rename from Core/SVGPathElement.m rename to Source/Core/DOM classes/SVGPathElement.m index 2337af160..4c4158650 100644 --- a/Core/SVGPathElement.m +++ b/Source/Core/DOM classes/SVGPathElement.m @@ -7,29 +7,24 @@ #import "SVGPathElement.h" -#import "SVGElement+Private.h" -#import "SVGShapeElement+Private.h" #import "SVGUtils.h" -#import "SVGPointsAndPathsParser.h" +#import "SVGKPointsAndPathsParser.h" + +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) @interface SVGPathElement () - (void) parseData:(NSString *)data; -- (void) parseAttributes:(NSDictionary *)attributes; @end @implementation SVGPathElement -- (void)parseAttributes:(NSDictionary *)attributes +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { - [super parseAttributes:attributes]; - - id value = nil; + [super postProcessAttributesAddingErrorsTo:parseResult]; - if ((value = [attributes objectForKey:@"d"])) { - [self parseData:value]; - } + [self parseData:[self getAttribute:@"d"]]; } - (void)parseData:(NSString *)data @@ -40,14 +35,24 @@ - (void)parseData:(NSString *)data SVGCurve lastCurve = SVGCurveZero; BOOL foundCmd; + NSCharacterSet *knownCommands = [NSCharacterSet characterSetWithCharactersInString:@"MmLlCcVvHhAaSsQqTtZz"]; + NSString* command; + do { - NSCharacterSet* knownCommands = [NSCharacterSet characterSetWithCharactersInString:@"MmLlCcVvHhAaSsQqTtZz"]; - NSString* command = nil; + + command = nil; foundCmd = [dataScanner scanCharactersFromSet:knownCommands intoString:&command]; + if (command.length > 1) { + // Take only one char (it can happen that multiple commands are consecutive, as "ZM" - so we only want to get the "Z") + const int tooManyChars = command.length-1; + command = [command substringToIndex:1]; + [dataScanner setScanLocation:([dataScanner scanLocation] - tooManyChars)]; + } + if (foundCmd) { if ([@"z" isEqualToString:command] || [@"Z" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readCloseCommand:[NSScanner scannerWithString:command] + lastCoordinate = [SVGKPointsAndPathsParser readCloseCommand:[NSScanner scannerWithString:command] path:path relativeTo:lastCoordinate]; } else { @@ -60,73 +65,85 @@ - (void)parseData:(NSString *)data NSScanner* commandScanner = [NSScanner scannerWithString:commandWithParameters]; if ([@"m" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readMovetoDrawtoCommandGroups:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readMovetoDrawtoCommandGroups:commandScanner path:path relativeTo:lastCoordinate isRelative:TRUE]; lastCurve = SVGCurveZero; } else if ([@"M" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readMovetoDrawtoCommandGroups:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readMovetoDrawtoCommandGroups:commandScanner path:path relativeTo:CGPointZero isRelative:FALSE]; lastCurve = SVGCurveZero; } else if ([@"l" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readLinetoCommand:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readLinetoCommand:commandScanner path:path relativeTo:lastCoordinate isRelative:TRUE]; lastCurve = SVGCurveZero; } else if ([@"L" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readLinetoCommand:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readLinetoCommand:commandScanner path:path relativeTo:CGPointZero isRelative:FALSE]; lastCurve = SVGCurveZero; } else if ([@"v" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readVerticalLinetoCommand:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readVerticalLinetoCommand:commandScanner path:path relativeTo:lastCoordinate]; lastCurve = SVGCurveZero; } else if ([@"V" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readVerticalLinetoCommand:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readVerticalLinetoCommand:commandScanner path:path relativeTo:CGPointZero]; lastCurve = SVGCurveZero; } else if ([@"h" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readHorizontalLinetoCommand:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readHorizontalLinetoCommand:commandScanner path:path relativeTo:lastCoordinate]; lastCurve = SVGCurveZero; } else if ([@"H" isEqualToString:command]) { - lastCoordinate = [SVGPointsAndPathsParser readHorizontalLinetoCommand:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readHorizontalLinetoCommand:commandScanner path:path relativeTo:CGPointZero]; lastCurve = SVGCurveZero; } else if ([@"c" isEqualToString:command]) { - lastCurve = [SVGPointsAndPathsParser readCurvetoCommand:commandScanner + lastCurve = [SVGKPointsAndPathsParser readCurvetoCommand:commandScanner path:path relativeTo:lastCoordinate isRelative:TRUE]; lastCoordinate = lastCurve.p; } else if ([@"C" isEqualToString:command]) { - lastCurve = [SVGPointsAndPathsParser readCurvetoCommand:commandScanner + lastCurve = [SVGKPointsAndPathsParser readCurvetoCommand:commandScanner path:path relativeTo:CGPointZero isRelative:FALSE]; lastCoordinate = lastCurve.p; } else if ([@"s" isEqualToString:command]) { - lastCurve = [SVGPointsAndPathsParser readSmoothCurvetoCommand:commandScanner + lastCurve = [SVGKPointsAndPathsParser readSmoothCurvetoCommand:commandScanner path:path relativeTo:lastCoordinate withPrevCurve:lastCurve]; lastCoordinate = lastCurve.p; } else if ([@"S" isEqualToString:command]) { - lastCurve = [SVGPointsAndPathsParser readSmoothCurvetoCommand:commandScanner + lastCurve = [SVGKPointsAndPathsParser readSmoothCurvetoCommand:commandScanner path:path relativeTo:CGPointZero withPrevCurve:lastCurve]; lastCoordinate = lastCurve.p; + } else if ([@"q" isEqualToString:command]) { + lastCurve = [SVGKPointsAndPathsParser readQuadraticCurvetoCommand:commandScanner + path:path + relativeTo:lastCoordinate + isRelative:TRUE]; + lastCoordinate = lastCurve.p; + } else if ([@"Q" isEqualToString:command]) { + lastCurve = [SVGKPointsAndPathsParser readQuadraticCurvetoCommand:commandScanner + path:path + relativeTo:CGPointZero + isRelative:FALSE]; + lastCoordinate = lastCurve.p; } else { NSLog(@"unsupported command %@", command); } @@ -137,7 +154,7 @@ - (void)parseData:(NSString *)data } while (foundCmd); - [self loadPath:path]; + [self setPathByCopyingPathFromLocalSpace:path]; CGPathRelease(path); } diff --git a/Core/SVGPolygonElement.h b/Source/Core/DOM classes/SVGPolygonElement.h similarity index 100% rename from Core/SVGPolygonElement.h rename to Source/Core/DOM classes/SVGPolygonElement.h diff --git a/Core/SVGPolygonElement.m b/Source/Core/DOM classes/SVGPolygonElement.m similarity index 77% rename from Core/SVGPolygonElement.m rename to Source/Core/DOM classes/SVGPolygonElement.m index 0359ba38b..2d1afd348 100644 --- a/Core/SVGPolygonElement.m +++ b/Source/Core/DOM classes/SVGPolygonElement.m @@ -7,10 +7,9 @@ #import "SVGPolygonElement.h" -#import "SVGElement+Private.h" -#import "SVGShapeElement+Private.h" +#import "SVGKPointsAndPathsParser.h" -#import "SVGPointsAndPathsParser.h" +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) @interface SVGPolygonElement() @@ -20,14 +19,10 @@ - (void) parseData:(NSString *)data; @implementation SVGPolygonElement -- (void)parseAttributes:(NSDictionary *)attributes { - [super parseAttributes:attributes]; +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + [super postProcessAttributesAddingErrorsTo:parseResult]; - id value = nil; - - if ((value = [attributes objectForKey:@"points"])) { - [self parseData:value]; - } + [self parseData:[self getAttribute:@"points"]]; } /*! According to SVG spec, a 'polygon' is EXACTYLY IDENTICAL to a 'path', if you prepend the letter "M", and @@ -52,17 +47,17 @@ - (void)parseData:(NSString *)data NSScanner* commandScanner = [NSScanner scannerWithString:commandWithParameters]; - lastCoordinate = [SVGPointsAndPathsParser readMovetoDrawtoCommandGroups:commandScanner + lastCoordinate = [SVGKPointsAndPathsParser readMovetoDrawtoCommandGroups:commandScanner path:path relativeTo:CGPointZero isRelative:FALSE]; - lastCoordinate = [SVGPointsAndPathsParser readCloseCommand:[NSScanner scannerWithString:@"z"] + [SVGKPointsAndPathsParser readCloseCommand:[NSScanner scannerWithString:@"z"] path:path relativeTo:lastCoordinate]; - [self loadPath:path]; + [self setPathByCopyingPathFromLocalSpace:path]; CGPathRelease(path); } diff --git a/Core/SVGPolylineElement.h b/Source/Core/DOM classes/SVGPolylineElement.h similarity index 100% rename from Core/SVGPolylineElement.h rename to Source/Core/DOM classes/SVGPolylineElement.h diff --git a/Source/Core/DOM classes/SVGPolylineElement.m b/Source/Core/DOM classes/SVGPolylineElement.m new file mode 100644 index 000000000..77655d62f --- /dev/null +++ b/Source/Core/DOM classes/SVGPolylineElement.m @@ -0,0 +1,29 @@ +// +// SVGPolylineElement.m +// SVGKit +// +// Copyright Matt Rajca 2011. All rights reserved. +// + +#import "SVGPolylineElement.h" + +#import "SVGUtils.h" + +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) + + +@implementation SVGPolylineElement + +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + [super postProcessAttributesAddingErrorsTo:parseResult]; + + if( [[self getAttribute:@"points"] length] > 0 ) + { + CGMutablePathRef path = createPathFromPointsInString([[self getAttribute:@"points"] UTF8String], NO); + + [self setPathByCopyingPathFromLocalSpace:path]; + CGPathRelease(path); + } +} + +@end diff --git a/Core/SVGRectElement.h b/Source/Core/DOM classes/SVGRectElement.h similarity index 100% rename from Core/SVGRectElement.h rename to Source/Core/DOM classes/SVGRectElement.h diff --git a/Core/SVGRectElement.m b/Source/Core/DOM classes/SVGRectElement.m similarity index 67% rename from Core/SVGRectElement.m rename to Source/Core/DOM classes/SVGRectElement.m index 068660359..d0b900eb5 100644 --- a/Core/SVGRectElement.m +++ b/Source/Core/DOM classes/SVGRectElement.m @@ -7,8 +7,7 @@ #import "SVGRectElement.h" -#import "SVGElement+Private.h" -#import "SVGShapeElement+Private.h" +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) @interface SVGRectElement () @@ -56,34 +55,26 @@ void CGPathAddRoundedRect (CGMutablePathRef path, CGRect rect, CGFloat radius) { CGPathCloseSubpath(path); } -- (void)parseAttributes:(NSDictionary *)attributes { - [super parseAttributes:attributes]; +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + [super postProcessAttributesAddingErrorsTo:parseResult]; - id value = nil; + if( [[self getAttribute:@"x"] length] > 0 ) + _x = [[self getAttribute:@"x"] floatValue]; - if ((value = [attributes objectForKey:@"x"])) { - _x = [value floatValue]; - } + if( [[self getAttribute:@"y"] length] > 0 ) + _y = [[self getAttribute:@"y"] floatValue]; - if ((value = [attributes objectForKey:@"y"])) { - _y = [value floatValue]; - } + if( [[self getAttribute:@"width"] length] > 0 ) + _width = [[self getAttribute:@"width"] floatValue]; - if ((value = [attributes objectForKey:@"width"])) { - _width = [value floatValue]; - } + if( [[self getAttribute:@"height"] length] > 0 ) + _height = [[self getAttribute:@"height"] floatValue]; - if ((value = [attributes objectForKey:@"height"])) { - _height = [value floatValue]; - } + if( [[self getAttribute:@"rx"] length] > 0 ) + _rx = [[self getAttribute:@"rx"] floatValue]; - if ((value = [attributes objectForKey:@"rx"])) { - _rx = [value floatValue]; - } - - if ((value = [attributes objectForKey:@"ry"])) { - _ry = [value floatValue]; - } + if( [[self getAttribute:@"ry"] length] > 0 ) + _ry = [[self getAttribute:@"ry"] floatValue]; CGMutablePathRef path = CGPathCreateMutable(); CGRect rect = CGRectMake(_x, _y, _width, _height); @@ -98,7 +89,7 @@ - (void)parseAttributes:(NSDictionary *)attributes { NSLog(@"Unsupported corner-radius configuration: rx differs from ry"); } - [self loadPath:path]; + [self setPathByCopyingPathFromLocalSpace:path]; CGPathRelease(path); } diff --git a/Source/Core/DOM classes/SVGSVGElement.h b/Source/Core/DOM classes/SVGSVGElement.h new file mode 100644 index 000000000..4edd2d7b9 --- /dev/null +++ b/Source/Core/DOM classes/SVGSVGElement.h @@ -0,0 +1,116 @@ +/** + SVGSVGElement.m + + Represents the "" tag in an SVG file + + http://www.w3.org/TR/SVG/struct.html#InterfaceSVGSVGElement + + readonly attribute SVGAnimatedLength x; + readonly attribute SVGAnimatedLength y; + readonly attribute SVGAnimatedLength width; + readonly attribute SVGAnimatedLength height; + attribute DOMString contentScriptType setraises(DOMException); + attribute DOMString contentStyleType setraises(DOMException); + readonly attribute SVGRect viewport; + readonly attribute float pixelUnitToMillimeterX; + readonly attribute float pixelUnitToMillimeterY; + readonly attribute float screenPixelToMillimeterX; + readonly attribute float screenPixelToMillimeterY; + readonly attribute boolean useCurrentView; + readonly attribute SVGViewSpec currentView; + attribute float currentScale; + readonly attribute SVGPoint currentTranslate; + + unsigned long suspendRedraw(in unsigned long maxWaitMilliseconds); + void unsuspendRedraw(in unsigned long suspendHandleID); + void unsuspendRedrawAll(); + void forceRedraw(); + void pauseAnimations(); + void unpauseAnimations(); + boolean animationsPaused(); + float getCurrentTime(); + void setCurrentTime(in float seconds); + NodeList getIntersectionList(in SVGRect rect, in SVGElement referenceElement); + NodeList getEnclosureList(in SVGRect rect, in SVGElement referenceElement); + boolean checkIntersection(in SVGElement element, in SVGRect rect); + boolean checkEnclosure(in SVGElement element, in SVGRect rect); + void deselectAll(); + SVGNumber createSVGNumber(); + SVGLength createSVGLength(); + SVGAngle createSVGAngle(); + SVGPoint createSVGPoint(); + SVGMatrix createSVGMatrix(); + SVGRect createSVGRect(); + SVGTransform createSVGTransform(); + SVGTransform createSVGTransformFromMatrix(in SVGMatrix matrix); + Element getElementById(in DOMString elementId); + */ + +#import "SVGElement.h" +#import "SVGViewSpec.h" + +#pragma mark - the SVG* types (SVGLength, SVGNumber, etc) +#import "SVGAngle.h" +#import "SVGLength.h" +#import "SVGNumber.h" +#import "SVGPoint.h" +#import "SVGRect.h" +#import "SVGTransform.h" + +#pragma mark - a few raw DOM imports are required for SVG DOM, but not many +#import "Element.h" +#import "NodeList.h" + +#import "SVGLayeredElement.h" + +@interface SVGSVGElement : SVGElement < SVGLayeredElement > + + + +@property (nonatomic, retain, readonly) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* x; +@property (nonatomic, retain, readonly) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* y; +@property (nonatomic, retain, readonly) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* width; +@property (nonatomic, retain, readonly) /*FIXME: should be SVGAnimatedLength instead*/ SVGLength* height; +@property (nonatomic, retain, readonly) NSString* contentScriptType; +@property (nonatomic, retain, readonly) NSString* contentStyleType; +@property (nonatomic, readonly) SVGRect viewport; +@property (nonatomic, readonly) float pixelUnitToMillimeterX; +@property (nonatomic, readonly) float pixelUnitToMillimeterY; +@property (nonatomic, readonly) float screenPixelToMillimeterX; +@property (nonatomic, readonly) float screenPixelToMillimeterY; +@property (nonatomic, readonly) BOOL useCurrentView; +@property (nonatomic, retain, readonly) SVGViewSpec* currentView; +@property (nonatomic, readonly) float currentScale; +@property (nonatomic, retain, readonly) SVGPoint* currentTranslate; + +-(long) suspendRedraw:(long) maxWaitMilliseconds; +-(void) unsuspendRedraw:(long) suspendHandleID; +-(void) unsuspendRedrawAll; +-(void) forceRedraw; +-(void) pauseAnimations; +-(void) unpauseAnimations; +-(BOOL) animationsPaused; +-(float) getCurrentTime; +-(void) setCurrentTime:(float) seconds; +-(NodeList*) getIntersectionList:(SVGRect) rect referenceElement:(SVGElement*) referenceElement; +-(NodeList*) getEnclosureList:(SVGRect) rect referenceElement:(SVGElement*) referenceElement; +-(BOOL) checkIntersection:(SVGElement*) element rect:(SVGRect) rect; +-(BOOL) checkEnclosure:(SVGElement*) element rect:(SVGRect) rect; +-(void) deselectAll; +-(SVGNumber) createSVGNumber; +-(SVGLength*) createSVGLength __attribute__((ns_returns_retained)); +-(SVGAngle*) createSVGAngle; +-(SVGPoint*) createSVGPoint; +-(SVGMatrix*) createSVGMatrix; +-(SVGRect) createSVGRect; +-(SVGTransform*) createSVGTransform; +-(SVGTransform*) createSVGTransformFromMatrix:(SVGMatrix*) matrix; +-(Element*) getElementById:(NSString*) elementId; + +#pragma mark - below here VIOLATES THE STANDARD, but needs to be CAREFULLY merged with spec + +@property (nonatomic, readonly) CGRect viewBoxFrame; // FIXME: this has NON TRIVIAL relationship to the viewport property above + +- (SVGElement *)findFirstElementOfClass:(Class)class; /*< temporary convenience method until SVGDocument support is complete */ + +@end diff --git a/Source/Core/DOM classes/SVGSVGElement.m b/Source/Core/DOM classes/SVGSVGElement.m new file mode 100644 index 000000000..f5c91c4f1 --- /dev/null +++ b/Source/Core/DOM classes/SVGSVGElement.m @@ -0,0 +1,164 @@ +#import "SVGSVGElement.h" + +#import "SVGSVGElement_Mutable.h" +#import "CALayerWithChildHitTest.h" + + +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) + +#if TARGET_OS_IPHONE +#import +#endif + +@interface SVGSVGElement() +@property (nonatomic, readwrite) CGRect viewBoxFrame; +@end + +@implementation SVGSVGElement + +@synthesize x; +@synthesize y; +@synthesize width; +@synthesize height; +@synthesize contentScriptType; +@synthesize contentStyleType; +@synthesize viewport; +@synthesize pixelUnitToMillimeterX; +@synthesize pixelUnitToMillimeterY; +@synthesize screenPixelToMillimeterX; +@synthesize screenPixelToMillimeterY; +@synthesize useCurrentView; +@synthesize currentView; +@synthesize currentScale; +@synthesize currentTranslate; + +#pragma mark - NON SPEC, violating, properties +@synthesize viewBoxFrame = _viewBoxFrame; + +-(void)dealloc +{ + self.viewBoxFrame = CGRectNull; + [super dealloc]; +} + +#pragma mark - SVG Spec methods + +-(long) suspendRedraw:(long) maxWaitMilliseconds { NSAssert( FALSE, @"Not implemented yet" ); return 0; } +-(void) unsuspendRedraw:(long) suspendHandleID { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) unsuspendRedrawAll { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) forceRedraw { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) pauseAnimations { NSAssert( FALSE, @"Not implemented yet" ); } +-(void) unpauseAnimations { NSAssert( FALSE, @"Not implemented yet" ); } +-(BOOL) animationsPaused { NSAssert( FALSE, @"Not implemented yet" ); return TRUE; } +-(float) getCurrentTime { NSAssert( FALSE, @"Not implemented yet" ); return 0.0; } +-(void) setCurrentTime:(float) seconds { NSAssert( FALSE, @"Not implemented yet" ); } +-(NodeList*) getIntersectionList:(SVGRect) rect referenceElement:(SVGElement*) referenceElement { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(NodeList*) getEnclosureList:(SVGRect) rect referenceElement:(SVGElement*) referenceElement { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(BOOL) checkIntersection:(SVGElement*) element rect:(SVGRect) rect { NSAssert( FALSE, @"Not implemented yet" ); return FALSE; } +-(BOOL) checkEnclosure:(SVGElement*) element rect:(SVGRect) rect { NSAssert( FALSE, @"Not implemented yet" ); return FALSE; } +-(void) deselectAll { NSAssert( FALSE, @"Not implemented yet" );} +-(SVGNumber) createSVGNumber +{ + SVGNumber n = { 0 }; + return n; +} +-(SVGLength*) createSVGLength +{ + return [SVGLength new]; +} +-(SVGAngle*) createSVGAngle { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGPoint*) createSVGPoint { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGMatrix*) createSVGMatrix { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGRect) createSVGRect +{ + SVGRect r = { 0.0, 0.0, 0.0, 0.0 }; + return r; +} +-(SVGTransform*) createSVGTransform { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(SVGTransform*) createSVGTransformFromMatrix:(SVGMatrix*) matrix { NSAssert( FALSE, @"Not implemented yet" ); return nil; } +-(Element*) getElementById:(NSString*) elementId { NSAssert( FALSE, @"Not implemented yet" ); return nil; } + + +#pragma mark - Objective C methods needed given our current non-compliant SVG Parser + +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { + [super postProcessAttributesAddingErrorsTo:parseResult]; + + NSAssert( [[self getAttribute:@"width"] length] > 0, @"Not supported yet: tag that is missing an explicit width attribute"); + NSAssert( [[self getAttribute:@"height"] length] > 0, @"Not supported yet: tag that is missing an explicit height attribute"); + + self.width = [SVGLength svgLengthFromNSString:[self getAttribute:@"width"]]; + + self.height = [SVGLength svgLengthFromNSString:[self getAttribute:@"height"]]; + + if( [[self getAttribute:@"viewBox"] length] > 0 ) + { + NSArray* boxElements = [[self getAttribute:@"viewBox"] componentsSeparatedByString:@" "]; + + _viewBoxFrame = CGRectMake([[boxElements objectAtIndex:0] floatValue], [[boxElements objectAtIndex:1] floatValue], [[boxElements objectAtIndex:2] floatValue], [[boxElements objectAtIndex:3] floatValue]); + + //osx logging +#if TARGET_OS_IPHONE + NSLog(@"[%@] DEBUG INFO: set document viewBox = %@", [self class], NSStringFromCGRect(self.viewBoxFrame)); +#else + //mac logging + NSLog(@"[%@] DEBUG INFO: set document viewBox = %@", [self class], NSStringFromRect(self.viewBoxFrame)); +#endif + + } +} + +- (SVGElement *)findFirstElementOfClass:(Class)class { + for (SVGElement *element in self.childNodes) + { + if ([element isKindOfClass:class]) + return element; + } + + return nil; +} + +- (CALayer *) newLayer +{ + + CALayer* _layer = [[CALayerWithChildHitTest layer] retain]; + + _layer.name = self.identifier; + [_layer setValue:self.identifier forKey:kSVGElementIdentifier]; + + if ([_layer respondsToSelector:@selector(setShouldRasterize:)]) { + [_layer performSelector:@selector(setShouldRasterize:) + withObject:[NSNumber numberWithBool:YES]]; + } + + return _layer; +} + +- (void)layoutLayer:(CALayer *)layer { + NSArray *sublayers = [layer sublayers]; + CGRect mainRect = CGRectZero; + + for (NSUInteger n = 0; n < [sublayers count]; n++) { + CALayer *currentLayer = [sublayers objectAtIndex:n]; + + if (n == 0) { + mainRect = currentLayer.frame; + } + else { + mainRect = CGRectUnion(mainRect, currentLayer.frame); + } + } + + layer.frame = mainRect; + + // TODO: this code looks insanely wrong to me. WTF is it doing? Why? WHY? + for (CALayer *currentLayer in sublayers) { + CGRect frame = currentLayer.frame; + frame.origin.x -= mainRect.origin.x; + frame.origin.y -= mainRect.origin.y; + + currentLayer.frame = frame; + } +} + +@end diff --git a/Source/Core/DOM classes/SVGShapeElement.h b/Source/Core/DOM classes/SVGShapeElement.h new file mode 100644 index 000000000..79ca331be --- /dev/null +++ b/Source/Core/DOM classes/SVGShapeElement.h @@ -0,0 +1,59 @@ +/** + SVGShapeElement + + NB: half of this class is stored in the secret header file "SVGShapeElement+Private". Due to bugs in + Apple's Xcode, you may not be able to view that file - or come back to the class file - using the + standard Xcode controls + + The majority of real-world SVG elements are Shapes: arbitrary shapes made out of line segments, curves, etc. + + Co-ordinate system + --- + + Many SVG files have poor internal formatting. We deliberately DO NOT FIX THEM (maybe a future feature). + + We store the EXACT WAY THE SVG SHAPE WAS SPECIFIED. If that means the parent had no transform (even though it + obviously should have done), we leave it that way. + + + Data: + - "pathRelative": the actual path as parsed from the original file. THIS MIGHT NOT BE NORMALISED (maybe a future feature) + + - "opacity", "fillColor", "strokeColor", "strokeWidth", "fillPattern", "fillType": SVG info telling you how to paint the shape + */ + +#import "SVGElement.h" +#import "SVGLayeredElement.h" +#import "SVGUtils.h" + +@class SVGGradientElement; +@class SVGKPattern; + +typedef enum { + SVGFillTypeNone = 0, + SVGFillTypeSolid, +} SVGFillType; + +@interface SVGShapeElement : SVGElement < SVGLayeredElement > { } + +@property (nonatomic, readwrite) CGFloat opacity; + +@property (nonatomic, readwrite) SVGFillType fillType; +@property (nonatomic, readwrite) SVGColor fillColor; +@property (nonatomic, readwrite, retain) SVGKPattern* fillPattern; + +@property (nonatomic, readwrite) CGFloat strokeWidth; +@property (nonatomic, readwrite) SVGColor strokeColor; + +@property (nonatomic, readonly) CGPathRef pathRelative; + +/*! + The provided path will be cloned, and set as the new "pathRelative" + + The provided path MUST already be in the local co-ordinate space, i.e. when rendering, + 0,0 in this path will be transformed by the local transform, and the parent's + transform, and all grandparents in the tree, etc + */ +- (void)setPathByCopyingPathFromLocalSpace:(CGPathRef)aPath; + +@end diff --git a/Source/Core/DOM classes/SVGShapeElement.m b/Source/Core/DOM classes/SVGShapeElement.m new file mode 100644 index 000000000..812647625 --- /dev/null +++ b/Source/Core/DOM classes/SVGShapeElement.m @@ -0,0 +1,183 @@ +// +// SVGShapeElement.m +// SVGKit +// +// Copyright Matt Rajca 2010-2011. All rights reserved. +// + +#import "SVGShapeElement.h" + +#import "CGPathAdditions.h" +#import "SVGDefsElement.h" +#import "SVGKPattern.h" +#import "CAShapeLayerWithHitTest.h" + +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) + +@implementation SVGShapeElement + +#define IDENTIFIER_LEN 256 + +@synthesize opacity = _opacity; + +@synthesize fillType = _fillType; +@synthesize fillColor = _fillColor; +@synthesize fillPattern = _fillPattern; + +@synthesize strokeWidth = _strokeWidth; +@synthesize strokeColor = _strokeColor; + +@synthesize pathRelative = _pathRelative; + +- (void)finalize { + CGPathRelease(_pathRelative); + [super finalize]; +} + +- (void)dealloc { + CGPathRelease(_pathRelative); + self.fillPattern = nil; + + [super dealloc]; +} + +- (void)loadDefaults { + _opacity = 1.0f; + + _fillColor = SVGColorMake(0, 0, 0, 255); + _fillType = SVGFillTypeSolid; +} + +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult +{ + [super postProcessAttributesAddingErrorsTo:parseResult]; + + if( [[self getAttribute:@"opacity"] length] > 0 ) + _opacity = [[self getAttribute:@"opacity"] floatValue]; + + if ([[self getAttribute:@"fill"] length] > 0 ) { + const char *cvalue = [[self getAttribute:@"fill"] UTF8String]; + + if (!strncmp(cvalue, "none", 4)) { + _fillType = SVGFillTypeNone; + } + else if (!strncmp(cvalue, "url", 3)) { + NSLog(@"Gradients are no longer supported"); + _fillType = SVGFillTypeNone; + } + else { + _fillColor = SVGColorFromString(cvalue); + _fillType = SVGFillTypeSolid; + } + } + + if( [[self getAttribute:@"stroke-width"] length] > 0 ) + _strokeWidth = [[self getAttribute:@"stroke-width"] floatValue]; + + if ( [[self getAttribute:@"stroke"] length] > 0 ) { + const char *cvalue = [[self getAttribute:@"stroke"] UTF8String]; + + if (!strncmp(cvalue, "none", 4)) { + _strokeWidth = 0.0f; + } + else { + _strokeColor = SVGColorFromString(cvalue); + + if (!_strokeWidth) + _strokeWidth = 1.0f; + } + } + + if ([[self getAttribute:@"stroke-opacity"] length] > 0 ) { + _strokeColor.a = (uint8_t) ([[self getAttribute:@"stroke-opacity"] floatValue] * 0xFF); + } + + if ([[self getAttribute:@"fill-opacity"] length] > 0 ) { + _fillColor.a = (uint8_t) ([[self getAttribute:@"fill-opacity"] floatValue] * 0xFF); + } +} + +- (void)setPathByCopyingPathFromLocalSpace:(CGPathRef)aPath { + if (_pathRelative) { + CGPathRelease(_pathRelative); + _pathRelative = NULL; + } + + if (aPath) { + _pathRelative = CGPathCreateCopy(aPath); + } +} + +- (CALayer *) newLayer +{ + CAShapeLayer* _shapeLayer = [[CAShapeLayerWithHitTest layer] retain]; + _shapeLayer.name = self.identifier; + [_shapeLayer setValue:self.identifier forKey:kSVGElementIdentifier]; + _shapeLayer.opacity = _opacity; + + /** transform our LOCAL path into ABSOLUTE space */ + CGAffineTransform transformAbsolute = [self transformAbsolute]; + CGMutablePathRef pathToPlaceInLayer = CGPathCreateMutable(); + CGPathAddPath( pathToPlaceInLayer, &transformAbsolute, _pathRelative); + + /** find out the ABSOLUTE BOUNDING BOX of our transformed path */ + //BIZARRE: Apple sometimes gives a different value for this even when transformAbsolute == identity! : CGRect localPathBB = CGPathGetPathBoundingBox( _pathRelative ); + //DEBUG ONLY: CGRect unTransformedPathBB = CGPathGetBoundingBox( _pathRelative ); + CGRect transformedPathBB = CGPathGetBoundingBox( pathToPlaceInLayer ); + + /** NB: when we set the _shapeLayer.frame, it has a *side effect* of moving the path itself - so, in order to prevent that, + because Apple didn't provide a BOOL to disable that "feature", we have to pre-shift the path forwards by the amount it + will be shifted backwards */ + CGPathRef finalPath = CGPathCreateByOffsettingPath( pathToPlaceInLayer, transformedPathBB.origin.x, transformedPathBB.origin.y ); + + /** Can't use this - iOS 5 only! path = CGPathCreateCopyByTransformingPath(path, transformFromSVGUnitsToScreenUnits ); */ + + _shapeLayer.path = finalPath; + CGPathRelease(finalPath); + CGPathRelease(pathToPlaceInLayer); + + /** + NB: this line, by changing the FRAME of the layer, has the side effect of also changing the CGPATH's position in absolute + space! This is why we needed the "CGPathRef finalPath =" line a few lines above... + */ + _shapeLayer.frame = transformedPathBB; + + //DEBUG ONLY: CGRect shapeLayerFrame = _shapeLayer.frame; + + if (_strokeWidth) { + /* + We have to apply any scale-factor part of the affine transform to the stroke itself (this is bizarre and horrible, yes, but that's the spec for you!) + */ + CGSize fakeSize = CGSizeMake( _strokeWidth, 0 ); + fakeSize = CGSizeApplyAffineTransform( fakeSize, transformAbsolute ); + _shapeLayer.lineWidth = fakeSize.width; + _shapeLayer.strokeColor = CGColorWithSVGColor(_strokeColor); + } + else + { + _shapeLayer.strokeColor = nil; // This is how you tell Apple that the stroke is disabled; a strokewidth of 0 will NOT achieve this + _shapeLayer.lineWidth = 0.0f; // MUST set this explicitly, or Apple assumes 1.0 + } + + if (_fillType == SVGFillTypeNone) { + _shapeLayer.fillColor = nil; + } + else if (_fillType == SVGFillTypeSolid) { + _shapeLayer.fillColor = CGColorWithSVGColor(_fillColor); + } + + if (nil != _fillPattern) { + _shapeLayer.fillColor = [_fillPattern CGColor]; + } + + if ([_shapeLayer respondsToSelector:@selector(setShouldRasterize:)]) { + [_shapeLayer performSelector:@selector(setShouldRasterize:) + withObject:[NSNumber numberWithBool:YES]]; + } + + return _shapeLayer; +} + +- (void)layoutLayer:(CALayer *)layer { } + +@end diff --git a/Core/SVGTextElement.h b/Source/Core/DOM classes/SVGTextElement.h similarity index 96% rename from Core/SVGTextElement.h rename to Source/Core/DOM classes/SVGTextElement.h index 82a5c8a2a..1a80b3e4d 100644 --- a/Core/SVGTextElement.h +++ b/Source/Core/DOM classes/SVGTextElement.h @@ -9,6 +9,7 @@ #import #import "SVGElement.h" +#import "SVGLayeredElement.h" /** http://www.w3.org/TR/2011/REC-SVG11-20110816/text.html#TextElement diff --git a/Core/SVGTextElement.m b/Source/Core/DOM classes/SVGTextElement.m similarity index 67% rename from Core/SVGTextElement.m rename to Source/Core/DOM classes/SVGTextElement.m index 7ae612f7c..01b8ea8d0 100644 --- a/Core/SVGTextElement.m +++ b/Source/Core/DOM classes/SVGTextElement.m @@ -12,6 +12,9 @@ #import #endif +#import "SVGElement_ForParser.h" // to resolve Xcode circular dependencies; in long term, parsing SHOULD NOT HAPPEN inside any class whose name starts "SVG" (because those are reserved classes for the SVG Spec) + + @implementation SVGTextElement + (BOOL)shouldStoreContent { @@ -28,19 +31,15 @@ - (void)dealloc { [super dealloc]; } -- (void)parseAttributes:(NSDictionary *)attributes +- (void)postProcessAttributesAddingErrorsTo:(SVGKParseResult *)parseResult { - [super parseAttributes:attributes]; - - id value = nil; + [super postProcessAttributesAddingErrorsTo:parseResult]; - if ((value = [attributes objectForKey:@"x"])) { - _x = [value floatValue]; - } + if( [[self getAttribute:@"x"] length] > 0 ) + _x = [[self getAttribute:@"x"] floatValue]; - if ((value = [attributes objectForKey:@"y"])) { - _y = [value floatValue]; - } + if( [[self getAttribute:@"y"] length] > 0 ) + _y = [[self getAttribute:@"y"] floatValue]; // TODO: class // TODO: style @@ -70,10 +69,12 @@ - (void)parseAttributes:(NSDictionary *)attributes // "text-anchor" = start; // transform = "scale(0.80449853,1.2430103)"; // "writing-mode" = "lr-tb"; - } -- (CALayer *) newLayer { +- (CALayer *) newLayer +{ + NSAssert( FALSE, @"NOT SUPPORTED: SVG Text Element . newLayer -- must be upgraded using the algorithm in SVGShapeElement.newLayer"); + #if TARGET_OS_IPHONE NSString* textToDraw = self.stringValue; @@ -81,11 +82,11 @@ - (CALayer *) newLayer { size:_fontSize]; CGSize sizeOfTextRect = [textToDraw sizeWithFont:fontToDraw]; - CATextLayer *label = [[[CATextLayer alloc] init] autorelease]; + CATextLayer *label = [[CATextLayer alloc] init]; [label setName:self.identifier]; [label setFont:_fontFamily]; [label setFontSize:_fontSize]; - [label setFrame:CGRectMake(_x, _y, sizeOfTextRect.width, sizeOfTextRect.height)]; + [label setFrame:CGRectApplyAffineTransform( CGRectMake(_x, _y, sizeOfTextRect.width, sizeOfTextRect.height), [self transformAbsolute] ) ]; [label setString:textToDraw]; [label setAlignmentMode:kCAAlignmentLeft]; [label setForegroundColor:[[UIColor blackColor] CGColor]]; diff --git a/Core/SVGTitleElement.h b/Source/Core/DOM classes/SVGTitleElement.h similarity index 100% rename from Core/SVGTitleElement.h rename to Source/Core/DOM classes/SVGTitleElement.h diff --git a/Core/SVGTitleElement.m b/Source/Core/DOM classes/SVGTitleElement.m similarity index 100% rename from Core/SVGTitleElement.m rename to Source/Core/DOM classes/SVGTitleElement.m diff --git a/Source/Core/Parsing/SVGKParseResult.h b/Source/Core/Parsing/SVGKParseResult.h new file mode 100644 index 000000000..2d239623b --- /dev/null +++ b/Source/Core/Parsing/SVGKParseResult.h @@ -0,0 +1,36 @@ +/** + Reports detailed information from an attempted run of the SVG Parser + */ +#import + +@class SVGSVGElement, SVGDocument; +#import "SVGSVGElement.h" +#import "SVGDocument.h" + +@protocol SVGKParserExtension; +#import "SVGKParserExtension.h" + +@interface SVGKParseResult : NSObject + +@property(nonatomic, retain) NSMutableArray* warnings, * errorsRecoverable, * errorsFatal; +@property(nonatomic) BOOL libXMLFailed; + +@property(nonatomic,retain) SVGSVGElement* rootOfSVGTree; /*< both are needed, see spec */ +@property(nonatomic,retain) SVGDocument* parsedDocument; /*< both are needed, see spec */ + +@property(nonatomic,retain) NSMutableDictionary* namespacesEncountered; /**< maps "prefix" to "uri" */ + +-(void) addSourceError:(NSError*) fatalError; +-(void) addParseWarning:(NSError*) warning; +-(void) addParseErrorRecoverable:(NSError*) recoverableError; +-(void) addParseErrorFatal:(NSError*) fatalError; +-(void) addSAXError:(NSError*) saxError; + +#if ENABLE_PARSER_EXTENSIONS_CUSTOM_DATA +/*! Each SVGKParserExtension can optionally save extra data here */ +@property(nonatomic,retain) NSMutableDictionary* extensionsData; + +-(NSMutableDictionary*) dictionaryForParserExtension:(NSObject*) extension; +#endif + +@end diff --git a/Source/Core/Parsing/SVGKParseResult.m b/Source/Core/Parsing/SVGKParseResult.m new file mode 100644 index 000000000..5268872db --- /dev/null +++ b/Source/Core/Parsing/SVGKParseResult.m @@ -0,0 +1,73 @@ +#import "SVGKParseResult.h" + +@implementation SVGKParseResult + +@synthesize libXMLFailed; +@synthesize parsedDocument, rootOfSVGTree; +@synthesize warnings, errorsRecoverable, errorsFatal; + +#if ENABLE_PARSER_EXTENSIONS_CUSTOM_DATA +@synthesize extensionsData; +#endif + +- (id)init +{ + self = [super init]; + if (self) { + self.warnings = [NSMutableArray array]; + self.errorsRecoverable = [NSMutableArray array]; + self.errorsFatal = [NSMutableArray array]; + + self.namespacesEncountered = [NSMutableDictionary dictionary]; + + #if ENABLE_PARSER_EXTENSIONS_CUSTOM_DATA + self.extensionsData = [NSMutableDictionary dictionary]; +#endif + } + return self; +} +-(void) addSourceError:(NSError*) fatalError +{ + NSLog(@"[%@] SVG ERROR: %@", [self class], fatalError); + [self.errorsRecoverable addObject:fatalError]; +} + +-(void) addParseWarning:(NSError*) warning +{ + NSLog(@"[%@] SVG WARNING: %@", [self class], warning); + [self.warnings addObject:warning]; +} + +-(void) addParseErrorRecoverable:(NSError*) recoverableError +{ + NSLog(@"[%@] SVG WARNING (recoverable): %@", [self class], recoverableError); + [self.errorsRecoverable addObject:recoverableError]; +} + +-(void) addParseErrorFatal:(NSError*) fatalError +{ + NSLog(@"[%@] SVG ERROR: %@", [self class], fatalError); + [self.errorsFatal addObject:fatalError]; +} + +-(void) addSAXError:(NSError*) saxError +{ + NSLog(@"[%@] SVG ERROR: %@", [self class], [saxError localizedDescription]); + [self.errorsFatal addObject:saxError]; +} + +#if ENABLE_PARSER_EXTENSIONS_CUSTOM_DATA +-(NSMutableDictionary*) dictionaryForParserExtension:(NSObject*) extension +{ + NSMutableDictionary* d = [self.extensionsData objectForKey:[extension class]]; + if( d == nil ) + { + d = [NSMutableDictionary dictionary]; + [self.extensionsData setObject:d forKey:[extension class]]; + } + + return d; +} +#endif + +@end diff --git a/Source/Core/Parsing/SVGKParserDOM.h b/Source/Core/Parsing/SVGKParserDOM.h new file mode 100644 index 000000000..9b5cec181 --- /dev/null +++ b/Source/Core/Parsing/SVGKParserDOM.h @@ -0,0 +1,13 @@ +/** + According to the DOM spec, all nodes in an XML document must be parsed; if we lack specific information for them, + i.e. if we have no other, more specific, parser - then we must parse them as the most basic objects, i.e. Node, + Element, etc + + This is a special, magical parser that matches "no namespace" - i.e. matches what happens when no namspace was declared\ + */ +#import +#import "SVGKParserExtension.h" + +@interface SVGKParserDOM : NSObject + +@end diff --git a/Source/Core/Parsing/SVGKParserDOM.m b/Source/Core/Parsing/SVGKParserDOM.m new file mode 100644 index 000000000..bcd9b5719 --- /dev/null +++ b/Source/Core/Parsing/SVGKParserDOM.m @@ -0,0 +1,92 @@ +#import "SVGKParserDOM.h" + +#import "Node+Mutable.h" + +@implementation SVGKParserDOM + +/** + This is a special, magical parser that matches "no namespace" - i.e. matches what happens when no namespace was declared\ + */ +-(NSArray*) supportedNamespaces +{ + return [NSArray array]; +} + +/** + This is a special, magical parser that matches "all tags" + */ +-(NSArray*) supportedTags +{ + return [NSMutableArray array]; +} + +- (Node*) handleStartElement:(NSString *)name document:(SVGKSource*) SVGKSource namePrefix:(NSString*)prefix namespaceURI:(NSString*) XMLNSURI attributes:(NSMutableDictionary *)attributeObjects parseResult:(SVGKParseResult *)parseResult parentNode:(Node*) parentNode +{ + if( [[self supportedNamespaces] count] == 0 + || [[self supportedNamespaces] containsObject:XMLNSURI] ) // unnecesary here, but allows safe updates to this parser's matching later + { + NSString* qualifiedName = (prefix == nil) ? name : [NSString stringWithFormat:@"%@:%@", prefix, name]; + + /** NB: must supply a NON-qualified name if we have no specific prefix here ! */ + // FIXME: we always return an empty Element here; for DOM spec, should we be detecting things like "comment" nodes? I dont know how libxml handles those and sends them to us. I've never seen one in action... + Element *blankElement = [[[Element alloc] initWithQualifiedName:qualifiedName inNameSpaceURI:XMLNSURI attributes:attributeObjects] autorelease]; + + return blankElement; + } + + return nil; +} + +-(BOOL) createdNodeShouldStoreContent:(Node*) item +{ + switch( item.nodeType ) + { + case SKNodeType_ATTRIBUTE_NODE: + case SKNodeType_DOCUMENT_FRAGMENT_NODE: + case SKNodeType_DOCUMENT_NODE: + case SKNodeType_DOCUMENT_TYPE_NODE: + case SKNodeType_ELEMENT_NODE: + case SKNodeType_ENTITY_NODE: + case SKNodeType_ENTITY_REFERENCE_NODE: + case SKNodeType_NOTATION_NODE: + { + return FALSE; // do nothing, according to the table in : http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 + } break; + + case SKNodeType_CDATA_SECTION_NODE: + case SKNodeType_COMMENT_NODE: + case SKNodeType_PROCESSING_INSTRUCTION_NODE: + case SKNodeType_TEXT_NODE: + { + return TRUE; + } break; + } +} + +-(void) handleStringContent:(NSMutableString*) content forNode:(Node*) node +{ + switch( node.nodeType ) + { + case SKNodeType_ATTRIBUTE_NODE: + case SKNodeType_DOCUMENT_FRAGMENT_NODE: + case SKNodeType_DOCUMENT_NODE: + case SKNodeType_DOCUMENT_TYPE_NODE: + case SKNodeType_ELEMENT_NODE: + case SKNodeType_ENTITY_NODE: + case SKNodeType_ENTITY_REFERENCE_NODE: + case SKNodeType_NOTATION_NODE: + { + // do nothing, according to the table in : http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 + } break; + + case SKNodeType_CDATA_SECTION_NODE: + case SKNodeType_COMMENT_NODE: + case SKNodeType_PROCESSING_INSTRUCTION_NODE: + case SKNodeType_TEXT_NODE: + { + node.nodeValue = content; + } break; + } +} + +@end diff --git a/Source/Core/Parsing/SVGKParserDefsAndUse.h b/Source/Core/Parsing/SVGKParserDefsAndUse.h new file mode 100644 index 000000000..fad28bbe6 --- /dev/null +++ b/Source/Core/Parsing/SVGKParserDefsAndUse.h @@ -0,0 +1,11 @@ +/** + Parses the "" and "" tags in SVG files. + + NB: relies upon other parsers to parse the actual CONTENTS of a "defs" or "use" tag + */ +#import +#import "SVGKParserExtension.h" + +@interface SVGKParserDefsAndUse : NSObject + +@end diff --git a/Source/Core/Parsing/SVGKParserDefsAndUse.m b/Source/Core/Parsing/SVGKParserDefsAndUse.m new file mode 100644 index 000000000..b72b25a99 --- /dev/null +++ b/Source/Core/Parsing/SVGKParserDefsAndUse.m @@ -0,0 +1,119 @@ +#import "SVGKParserDefsAndUse.h" + +#import "Node.h" +#import "SVGKSource.h" +#import "SVGKParseResult.h" + +#import "SVGDefsElement.h" +#import "SVGUseElement.h" +#import "SVGUseElement_Mutable.h" +#import "SVGElementInstance.h" +#import "SVGElementInstance_Mutable.h" +#import "SVGElementInstanceList.h" +#import "SVGElement_ForParser.h" + +@implementation SVGKParserDefsAndUse + +-(NSArray*) supportedNamespaces +{ + return [NSArray arrayWithObjects: + @"http://www.w3.org/2000/svg", + nil]; +} + +/** "tags supported" is exactly the set of all SVGElement subclasses that already exist */ +-(NSArray*) supportedTags +{ + return [NSMutableArray arrayWithObjects: @"defs", @"use", nil]; +} + +-(SVGElementInstance*) convertSVGElementToElementInstanceTree:(SVGElement*) original outermostUseElement:(SVGUseElement*) outermostUseElement +{ + SVGElementInstance* instance = [[[SVGElementInstance alloc] init] autorelease]; + instance.correspondingElement = original; + instance.correspondingUseElement = outermostUseElement; + + for( Node* subNode in original.childNodes ) + { + if( [subNode isKindOfClass:[SVGElement class]]) + { + SVGElement* subElement = (SVGElement*) subNode; + + SVGElementInstance *newSubInstance = [self convertSVGElementToElementInstanceTree:subElement outermostUseElement:outermostUseElement]; + + newSubInstance.parentNode = instance; // side-effect: automatically adds sub as child + } + } + + return instance; +} + +- (Node*) handleStartElement:(NSString *)name document:(SVGKSource*) SVGKSource namePrefix:(NSString*)prefix namespaceURI:(NSString*) XMLNSURI attributes:(NSMutableDictionary *)attributes parseResult:(SVGKParseResult *)parseResult parentNode:(Node*) parentNode +{ + if( [[self supportedNamespaces] containsObject:XMLNSURI] ) + { + NSString* qualifiedName = (prefix == nil) ? name : [NSString stringWithFormat:@"%@:%@", prefix, name]; + + if( [name isEqualToString:@"defs"]) + { + /** NB: must supply a NON-qualified name if we have no specific prefix here ! */ + SVGDefsElement *element = [[[SVGDefsElement alloc] initWithQualifiedName:qualifiedName inNameSpaceURI:XMLNSURI attributes:attributes] autorelease]; + + return element; + } + else if( [name isEqualToString:@"use"]) + { + /** NB: must supply a NON-qualified name if we have no specific prefix here ! */ + SVGUseElement *useElement = [[[SVGUseElement alloc] initWithQualifiedName:qualifiedName inNameSpaceURI:XMLNSURI attributes:attributes] autorelease]; + + [useElement postProcessAttributesAddingErrorsTo:parseResult]; // handles "transform" and "style" + + if( [attributes valueForKey:@"x"] != nil ) + useElement.x = [SVGLength svgLengthFromNSString:[((Attr*)[attributes valueForKey:@"x"]) value]]; + if( [attributes valueForKey:@"y"] != nil ) + useElement.x = [SVGLength svgLengthFromNSString:[((Attr*)[attributes valueForKey:@"y"]) value]]; + if( [attributes valueForKey:@"width"] != nil ) + useElement.x = [SVGLength svgLengthFromNSString:[((Attr*)[attributes valueForKey:@"width"]) value]]; + if( [attributes valueForKey:@"height"] != nil ) + useElement.x = [SVGLength svgLengthFromNSString:[((Attr*)[attributes valueForKey:@"height"]) value]]; + + NSString* hrefAttribute = [useElement getAttributeNS:@"http://www.w3.org/1999/xlink" localName:@"href"]; + + NSAssert( [hrefAttribute length] > 0, @"Found an SVG tag that has no 'xlink:href' attribute. File is invalid / don't know how to parse this" ); + if( [hrefAttribute length] > 0 ) + { + NSString* linkHref = [((Attr*)[attributes valueForKey:@"xlink:href"]) value]; + + NSAssert( [linkHref hasPrefix:@"#"], @"Not supported: tags that declare an href to something that DOESN'T begin with #. Href supplied = %@", linkHref ); + + linkHref = [linkHref substringFromIndex:1]; + + /** have to find the node in the DOM tree with id = xlink:href's value */ + SVGElement* linkedElement = (SVGElement*) [parseResult.parsedDocument getElementById:linkHref]; + + NSAssert( linkedElement != nil, @"Found an SVG tag that points to a non-existent element. Missing element: id = ", linkHref ); + + + useElement.instanceRoot = [self convertSVGElementToElementInstanceTree:linkedElement outermostUseElement:useElement]; + } + + return useElement; + } + } + + return nil; +} + +-(BOOL) createdNodeShouldStoreContent:(Node*) item +{ + return false; +} + +-(void) handleStringContent:(NSMutableString*) content forNode:(Node*) node +{ + SVGElement* element = (SVGElement*) node; + + [element parseContent:content]; +} + +@end diff --git a/Source/Core/Parsing/SVGKParserExtension.h b/Source/Core/Parsing/SVGKParserExtension.h new file mode 100644 index 000000000..32ee87afb --- /dev/null +++ b/Source/Core/Parsing/SVGKParserExtension.h @@ -0,0 +1,49 @@ +/** + SVGParserExtension.h + + A protocol that lets us split "parsing an SVG" into lots of smaller parsing classes + + PARSING + --- + Actual parsing of an SVG is split into three places: + + 1. High level, XML parsing: SVGParser + 2. ALL THE REST, this class: parsing the structure of a document, and special XML tags: any class that extends "SVGParserExtension" + + */ + +#import + +#import "SVGKSource.h" + +@class SVGKParseResult; +#import "SVGKParseResult.h" + +#import "Node.h" + +/*! Experimental: allow SVGKit parser-extensions to insert custom data into an SVGKParseResult */ +#define ENABLE_PARSER_EXTENSIONS_CUSTOM_DATA 0 + +@protocol SVGKParserExtension + +/*! Array of URI's as NSString's, one string for each XMLnamespace that this parser-extension can parse + * + * e.g. the main parser returns "[NSArray arrayWithObjects:@"http://www.w3.org/2000/svg", nil];" + */ +-(NSArray*) supportedNamespaces; + +/*! Array of NSString's, one string for each XML tag (within a supported namespace!) that this parser-extension can parse + * + * e.g. the main parser returns "[NSArray arrayWithObjects:@"svg", @"title", @"defs", @"path", @"line", @"circle", ...etc... , nil];" + */ +-(NSArray*) supportedTags; + +/*! + Because SVG-DOM uses DOM, custom parsers can return any object they like - so long as its some kind of + subclass of DOM's Node class + */ +- (Node*)handleStartElement:(NSString *)name document:(SVGKSource*) document namePrefix:(NSString*)prefix namespaceURI:(NSString*) XMLNSURI attributes:(NSMutableDictionary *)attributes parseResult:(SVGKParseResult*) parseResult parentNode:(Node*) parentNode; +-(void) handleStringContent:(NSMutableString*) content forNode:(Node*) node; +-(BOOL) createdNodeShouldStoreContent:(Node*) node; + +@end diff --git a/Source/Core/Parsing/SVGKParserPatternsAndGradients.h b/Source/Core/Parsing/SVGKParserPatternsAndGradients.h new file mode 100644 index 000000000..7d424ad1d --- /dev/null +++ b/Source/Core/Parsing/SVGKParserPatternsAndGradients.h @@ -0,0 +1,15 @@ +// +// SVGKParserPatternsAndGradients.h +// SVGKit +// +// Created by adam applecansuckmybigtodger on 28/06/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import + +#import "SVGKParser.h" + +@interface SVGKParserPatternsAndGradients : NSObject + +@end diff --git a/Source/Core/Parsing/SVGKParserPatternsAndGradients.m b/Source/Core/Parsing/SVGKParserPatternsAndGradients.m new file mode 100644 index 000000000..b5d8a5ac7 --- /dev/null +++ b/Source/Core/Parsing/SVGKParserPatternsAndGradients.m @@ -0,0 +1,65 @@ +// +// SVGKParserPatternsAndGradients.m +// SVGKit +// +// Created by adam applecansuckmybigtodger on 28/06/2012. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "SVGKParserPatternsAndGradients.h" + +#import "SVGSVGElement.h" +#import "SVGCircleElement.h" +#import "SVGDefsElement.h" +#import "SVGDescriptionElement.h" +//#import "SVGKSource.h" +#import "SVGEllipseElement.h" +#import "SVGGroupElement.h" +#import "SVGImageElement.h" +#import "SVGLineElement.h" +#import "SVGPathElement.h" +#import "SVGPolygonElement.h" +#import "SVGPolylineElement.h" +#import "SVGRectElement.h" +#import "SVGTitleElement.h" + +@implementation SVGKParserPatternsAndGradients + +- (void)dealloc { + + [super dealloc]; +} + +-(NSArray*) supportedNamespaces +{ + return [NSArray arrayWithObjects: + @"http://www.w3.org/2000/svg", + nil]; +} + +/** "tags supported" is exactly the set of all SVGElement subclasses that already exist */ +-(NSArray*) supportedTags +{ + return [NSMutableArray arrayWithObjects:@"pattern", @"gradient", nil]; +} + +- (Node*)handleStartElement:(NSString *)name document:(SVGKSource*) document namePrefix:(NSString*)prefix namespaceURI:(NSString*) XMLNSURI attributes:(NSMutableDictionary *)attributes parseResult:(SVGKParseResult*) parseResult parentNode:(Node*) parentNode +{ + + NSAssert( FALSE, @"Patterns and gradients are not supported by SVGKit yet - no-one has implemented them" ); + + return nil; +} +-(BOOL) createdNodeShouldStoreContent:(Node*) node +{ + NSAssert( FALSE, @"Patterns and gradients are not supported by SVGKit yet - no-one has implemented them" ); + + return false; +} + +-(void) handleStringContent:(NSMutableString*) content forNode:(Node*) node +{ + NSAssert( FALSE, @"Patterns and gradients are not supported by SVGKit yet - no-one has implemented them" ); +} + +@end diff --git a/Source/Core/Parsing/SVGKParserSVG.h b/Source/Core/Parsing/SVGKParserSVG.h new file mode 100644 index 000000000..8ba7e723e --- /dev/null +++ b/Source/Core/Parsing/SVGKParserSVG.h @@ -0,0 +1,8 @@ +#import + +#import "SVGKParser.h" + +@interface SVGKParserSVG : NSObject { +} + +@end diff --git a/Source/Core/Parsing/SVGKParserSVG.m b/Source/Core/Parsing/SVGKParserSVG.m new file mode 100644 index 000000000..e82419794 --- /dev/null +++ b/Source/Core/Parsing/SVGKParserSVG.m @@ -0,0 +1,206 @@ +#import "SVGKParserSVG.h" + +#import "SVGSVGElement.h" +#import "SVGCircleElement.h" +#import "SVGDefsElement.h" +#import "SVGDescriptionElement.h" +//#import "SVGKSource.h" +#import "SVGEllipseElement.h" +#import "SVGGroupElement.h" +#import "SVGImageElement.h" +#import "SVGLineElement.h" +#import "SVGPathElement.h" +#import "SVGPolygonElement.h" +#import "SVGPolylineElement.h" +#import "SVGRectElement.h" +#import "SVGTitleElement.h" + +#import "SVGDocument_Mutable.h" + +@implementation SVGKParserSVG + +static NSDictionary *elementMap; + +- (id)init { + self = [super init]; + if (self) { + + if (!elementMap) { + elementMap = [[NSDictionary dictionaryWithObjectsAndKeys: + [SVGSVGElement class], @"svg", + [SVGCircleElement class], @"circle", + [SVGDescriptionElement class], @"description", + [SVGEllipseElement class], @"ellipse", + [SVGGroupElement class], @"g", + [SVGImageElement class], @"image", + [SVGLineElement class], @"line", + [SVGPathElement class], @"path", + [SVGPolygonElement class], @"polygon", + [SVGPolylineElement class], @"polyline", + [SVGRectElement class], @"rect", + [SVGTitleElement class], @"title", nil] retain]; + } + } + return self; +} + +- (void)dealloc { + + [super dealloc]; +} + +-(NSArray*) supportedNamespaces +{ + return [NSArray arrayWithObjects: + @"http://www.w3.org/2000/svg", + nil]; +} + +/** "tags supported" is exactly the set of all SVGElement subclasses that already exist */ +-(NSArray*) supportedTags +{ + return [NSMutableArray arrayWithArray:[elementMap allKeys]]; +} + +- (Node*) handleStartElement:(NSString *)name document:(SVGKSource*) SVGKSource namePrefix:(NSString*)prefix namespaceURI:(NSString*) XMLNSURI attributes:(NSMutableDictionary *)attributes parseResult:(SVGKParseResult *)parseResult parentNode:(Node*) parentNode +{ + if( [[self supportedNamespaces] containsObject:XMLNSURI] ) + { + Class elementClass = [elementMap objectForKey:name]; + + if (!elementClass) { + elementClass = [SVGElement class]; + NSLog(@"Support for '%@' element has not been implemented", name); + } + + Attr* style = nil; + + if ((style = [attributes objectForKey:@"style"])) { + [attributes removeObjectForKey:@"style"]; + [attributes addEntriesFromDictionary:[SVGKParser NSDictionaryFromCSSAttributes:style]]; + } + + /** + NB: following the SVG Spec, it's critical that we ONLY use the DOM methods for creating + basic 'Element' nodes. + + Our SVGElement root class has an implementation of init that delegates to the same + private methods that the DOM methods use, so it's safe... + + FIXME: ...but in reality we ought to be using the DOMDocument createElement/NS methods, although "good luck" trying to find a DOMDocument if your SVG is embedded inside a larger XML document :( + */ + + + NSString* qualifiedName = (prefix == nil) ? name : [NSString stringWithFormat:@"%@:%@", prefix, name]; + /** NB: must supply a NON-qualified name if we have no specific prefix here ! */ + SVGElement *element = [[[elementClass alloc] initWithQualifiedName:qualifiedName inNameSpaceURI:XMLNSURI attributes:attributes] autorelease]; + [element postProcessAttributesAddingErrorsTo:parseResult]; + + /** special case: */ + if( [@"svg" isEqualToString:name] ) + { + NSString* svgVersion = nil; + if ((svgVersion = [attributes objectForKey:@"version"])) { + SVGKSource.svgLanguageVersion = svgVersion; + } + + /** According to spec, if the first XML node is an SVG node, then it + becomes TWO THINGS: + + - An SVGSVGElement + *and* + - An SVGDocument + - ...and that becomes "the root SVGDocument" + + If it's NOT the first XML node, but it's the first SVG node, then it ONLY becomes: + + - An SVGSVGElement + + If it's NOT the first SVG node, then it becomes: + + - An SVGSVGElement + *and* + - An SVGDocument + + Yes. It's Very confusing! Go read the SVG Spec! + */ + + BOOL generateAnSVGDocument = FALSE; + BOOL overwriteRootSVGDocument = FALSE; + BOOL overwriteRootOfTree = FALSE; + + if( parentNode == nil ) + { + /** This start element is the first item in the document + PS: xcode has a new bug for Lion: it can't format single-line comments with two asterisks. This line added because Xcode sucks. + */ + generateAnSVGDocument = overwriteRootSVGDocument = overwriteRootOfTree = TRUE; + + } + else if( parseResult.rootOfSVGTree == nil ) + { + /** It's not the first XML, but it's the first SVG node */ + overwriteRootOfTree = TRUE; + } + else + { + /** It's not the first SVG node */ + generateAnSVGDocument = TRUE; + } + + /** + Handle the complex stuff above about SVGDocument and SVG node + */ + if( overwriteRootOfTree ) + { + parseResult.rootOfSVGTree = (SVGSVGElement*) element; + } + if( generateAnSVGDocument ) + { + NSAssert( [element isKindOfClass:[SVGSVGElement class]], @"Trying to create a new internal SVGDocument from a Node that is NOT of type SVGSVGElement (tag: svg). Node was of type: %@", NSStringFromClass([element class])); + + SVGDocument* newDocument = [[[SVGDocument alloc] init] autorelease]; + newDocument.rootElement = (SVGSVGElement*) element; + + if( overwriteRootSVGDocument ) + { + parseResult.parsedDocument = newDocument; + } + else + { + NSAssert( FALSE, @"Currently not supported: multiple SVG nodes (ie secondary Document reference) inside one file" ); + } + } + + } + + + return element; + } + + return nil; +} + +-(BOOL) createdNodeShouldStoreContent:(Node*) item +{ + if( [item isKindOfClass:[SVGElement class]] ) + { + if ([[item class] shouldStoreContent]) { + return TRUE; + } + else { + return FALSE; + } + } + else + return false; +} + +-(void) handleStringContent:(NSMutableString*) content forNode:(Node*) node +{ + SVGElement* element = (SVGElement*) node; + + [element parseContent:content]; +} + +@end diff --git a/Core/SVGPointsAndPathsParser.h b/Source/Core/Parsing/SVGKPointsAndPathsParser.h similarity index 78% rename from Core/SVGPointsAndPathsParser.h rename to Source/Core/Parsing/SVGKPointsAndPathsParser.h index 702b1ce8d..40de87640 100644 --- a/Core/SVGPointsAndPathsParser.h +++ b/Source/Core/Parsing/SVGKPointsAndPathsParser.h @@ -1,11 +1,17 @@ -// -// SVGPointsAndPathsParser.h -// SVGPad -// -// Created by adam on 18/12/2011. -// Copyright (c) 2011 __MyCompanyName__. All rights reserved. -// +/*! +// SVGKPointsAndPathsParser.h + This class really needs to be "upgraded" by wrapping it in a class named + + SVGPathElement + + and naming methods in that new class so that they adhere to the method names used in the official SVG standard's SVGPathElement spec: + + http://www.w3.org/TR/SVG11/paths.html#InterfaceSVGPathElement + + ... + + */ #import #if TARGET_OS_IPHONE @@ -26,7 +32,7 @@ BOOL SVGCurveEqualToCurve(SVGCurve curve1, SVGCurve curve2); #define SVGCurveZero SVGCurveMake(0.,0.,0.,0.,0.,0.) -@interface SVGPointsAndPathsParser : NSObject +@interface SVGKPointsAndPathsParser : NSObject + (void) readWhitespace:(NSScanner*)scanner; + (void) readCommaAndWhitespace:(NSScanner*)scanner; @@ -47,6 +53,10 @@ BOOL SVGCurveEqualToCurve(SVGCurve curve1, SVGCurve curve2); + (CGPoint) readHorizontalLinetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin; + (CGPoint) readHorizontalLinetoCommand:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin; ++ (SVGCurve) readQuadraticCurvetoCommand:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative; ++ (SVGCurve) readQuadraticCurvetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative; ++ (SVGCurve) readQuadraticCurvetoArgument:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin; + + (SVGCurve) readCurvetoCommand:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative; + (SVGCurve) readCurvetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative; + (SVGCurve) readCurvetoArgument:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin; diff --git a/Core/SVGPointsAndPathsParser.m b/Source/Core/Parsing/SVGKPointsAndPathsParser.m similarity index 68% rename from Core/SVGPointsAndPathsParser.m rename to Source/Core/Parsing/SVGKPointsAndPathsParser.m index ab98a9885..d77ea0b06 100644 --- a/Core/SVGPointsAndPathsParser.m +++ b/Source/Core/Parsing/SVGKPointsAndPathsParser.m @@ -1,12 +1,4 @@ -// -// SVGPointsAndPathsParser.m -// SVGPad -// -// Created by adam on 18/12/2011. -// Copyright (c) 2011 __MyCompanyName__. All rights reserved. -// - -#import "SVGPointsAndPathsParser.h" +#import "SVGKPointsAndPathsParser.h" // TODO: support quadratic-bezier-curveto // TODO: support smooth-quadratic-bezier-curveto @@ -38,7 +30,7 @@ inline BOOL SVGCurveEqualToCurve(SVGCurve curve1, SVGCurve curve2) ); } -@implementation SVGPointsAndPathsParser +@implementation SVGKPointsAndPathsParser /* references @@ -217,10 +209,10 @@ + (void) readWhitespace:(NSScanner*)scanner + (void) readCommaAndWhitespace:(NSScanner*)scanner { - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; static NSString* comma = @","; [scanner scanString:comma intoString:NULL]; - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; } /** @@ -230,7 +222,7 @@ + (void) readCommaAndWhitespace:(NSScanner*)scanner */ + (CGPoint) readMovetoDrawtoCommandGroups:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative { - CGPoint lastCoord = [SVGPointsAndPathsParser readMovetoDrawtoCommandGroup:scanner path:path relativeTo:origin isRelative:isRelative]; + CGPoint lastCoord = [SVGKPointsAndPathsParser readMovetoDrawtoCommandGroup:scanner path:path relativeTo:origin isRelative:isRelative]; return lastCoord; } @@ -240,12 +232,12 @@ + (CGPoint) readMovetoDrawtoCommandGroups:(NSScanner*)scanner path:(CGMutablePat */ + (CGPoint) readMovetoDrawtoCommandGroup:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative { - CGPoint lastCoord = [SVGPointsAndPathsParser readMovetoDrawto:scanner path:path relativeTo:origin isRelative:isRelative]; - [SVGPointsAndPathsParser readWhitespace:scanner]; + CGPoint lastCoord = [SVGKPointsAndPathsParser readMovetoDrawto:scanner path:path relativeTo:origin isRelative:isRelative]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; if (![scanner isAtEnd]) { - [SVGPointsAndPathsParser readWhitespace:scanner]; - lastCoord = [SVGPointsAndPathsParser readMovetoDrawtoCommandGroup:scanner path:path relativeTo:origin isRelative:isRelative]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; + lastCoord = [SVGKPointsAndPathsParser readMovetoDrawtoCommandGroup:scanner path:path relativeTo:origin isRelative:isRelative]; } return lastCoord; @@ -256,8 +248,8 @@ + (CGPoint) readMovetoDrawtoCommandGroup:(NSScanner*)scanner path:(CGMutablePath */ + (CGPoint) readMovetoDrawto:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative { - CGPoint lastMove = [SVGPointsAndPathsParser readMoveto:scanner path:path relativeTo:origin isRelative:isRelative]; - [SVGPointsAndPathsParser readWhitespace:scanner]; + CGPoint lastMove = [SVGKPointsAndPathsParser readMoveto:scanner path:path relativeTo:origin isRelative:isRelative]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; return lastMove; } @@ -274,9 +266,9 @@ + (CGPoint) readMoveto:(NSScanner*)scanner path:(CGMutablePathRef)path relativeT NSAssert(ok, @"failed to scan move to command"); if (!ok) return origin; - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; - CGPoint lastCoordinate = [SVGPointsAndPathsParser readMovetoArgumentSequence:scanner path:path relativeTo:origin isRelative:isRelative]; + CGPoint lastCoordinate = [SVGKPointsAndPathsParser readMovetoArgumentSequence:scanner path:path relativeTo:origin isRelative:isRelative]; return lastCoordinate; } @@ -286,17 +278,17 @@ + (CGPoint) readMoveto:(NSScanner*)scanner path:(CGMutablePathRef)path relativeT */ + (CGPoint) readMovetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative { - CGPoint p = [SVGPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint p = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; CGPoint coord = CGPointMake(p.x+origin.x, p.y+origin.y); CGPathMoveToPoint(path, NULL, coord.x, coord.y); #if DEBUG_PATH_CREATION - NSLog(@"[%@] PATH: MOVED to %2.2f, %2.2f", [SVGPointsAndPathsParser class], coord.x, coord.y ); + NSLog(@"[%@] PATH: MOVED to %2.2f, %2.2f", [SVGKPointsAndPathsParser class], coord.x, coord.y ); #endif - [SVGPointsAndPathsParser readCommaAndWhitespace:scanner]; + [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner]; if (![scanner isAtEnd]) { - coord = [SVGPointsAndPathsParser readLinetoArgumentSequence:scanner path:path relativeTo:(isRelative)?coord:origin isRelative:isRelative]; + coord = [SVGKPointsAndPathsParser readLinetoArgumentSequence:scanner path:path relativeTo:(isRelative)?coord:origin isRelative:isRelative]; } return coord; @@ -309,9 +301,9 @@ + (CGPoint) readMovetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRe + (CGPoint) readCoordinatePair:(NSScanner*)scanner { - CGFloat x = [SVGPointsAndPathsParser readCoordinate:scanner]; - [SVGPointsAndPathsParser readCommaAndWhitespace:scanner]; - CGFloat y = [SVGPointsAndPathsParser readCoordinate:scanner]; + CGFloat x = [SVGKPointsAndPathsParser readCoordinate:scanner]; + [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner]; + CGFloat y = [SVGKPointsAndPathsParser readCoordinate:scanner]; CGPoint p = CGPointMake(x, y); return p; @@ -339,9 +331,9 @@ + (CGPoint) readLinetoCommand:(NSScanner*)scanner path:(CGMutablePathRef)path re NSAssert(ok, @"failed to scan line to command"); if (!ok) return origin; - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; - CGPoint lastCoordinate = [SVGPointsAndPathsParser readLinetoArgumentSequence:scanner path:path relativeTo:origin isRelative:isRelative]; + CGPoint lastCoordinate = [SVGKPointsAndPathsParser readLinetoArgumentSequence:scanner path:path relativeTo:origin isRelative:isRelative]; return lastCoordinate; } @@ -352,21 +344,77 @@ + (CGPoint) readLinetoCommand:(NSScanner*)scanner path:(CGMutablePathRef)path re */ + (CGPoint) readLinetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative { - CGPoint p = [SVGPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint p = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; CGPoint coord = CGPointMake(p.x+origin.x, p.y+origin.y); CGPathAddLineToPoint(path, NULL, coord.x, coord.y); #if DEBUG_PATH_CREATION - NSLog(@"[%@] PATH: LINE to %2.2f, %2.2f", [SVGPointsAndPathsParser class], coord.x, coord.y ); + NSLog(@"[%@] PATH: LINE to %2.2f, %2.2f", [SVGKPointsAndPathsParser class], coord.x, coord.y ); #endif - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; if (![scanner isAtEnd]) { - coord = [SVGPointsAndPathsParser readLinetoArgumentSequence:scanner path:path relativeTo:(isRelative)?coord:origin isRelative:isRelative]; + coord = [SVGKPointsAndPathsParser readLinetoArgumentSequence:scanner path:path relativeTo:(isRelative)?coord:origin isRelative:isRelative]; } return coord; } +/** + quadratic-bezier-curveto: + ( "Q" | "q" ) wsp* quadratic-bezier-curveto-argument-sequence +*/ ++ (SVGCurve) readQuadraticCurvetoCommand:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative +{ + NSString* cmd = nil; + NSCharacterSet* cmdFormat = [NSCharacterSet characterSetWithCharactersInString:@"Qq"]; + BOOL ok = [scanner scanCharactersFromSet:cmdFormat intoString:&cmd]; + + NSAssert(ok, @"failed to scan quadratic curve to command"); + if (!ok) return SVGCurveZero; + + [SVGKPointsAndPathsParser readWhitespace:scanner]; + + SVGCurve lastCurve = [SVGKPointsAndPathsParser readQuadraticCurvetoArgumentSequence:scanner path:path relativeTo:origin isRelative:isRelative]; + return lastCurve; +} +/** + quadratic-bezier-curveto-argument-sequence: + quadratic-bezier-curveto-argument + | quadratic-bezier-curveto-argument comma-wsp? quadratic-bezier-curveto-argument-sequence +*/ ++ (SVGCurve) readQuadraticCurvetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative +{ + SVGCurve curve = [SVGKPointsAndPathsParser readQuadraticCurvetoArgument:scanner path:path relativeTo:origin]; + + if (![scanner isAtEnd]) { + curve = [SVGKPointsAndPathsParser readQuadraticCurvetoArgumentSequence:scanner path:path relativeTo:(isRelative ? curve.p : origin) isRelative:isRelative]; + } + + return curve; +} + +/** + quadratic-bezier-curveto-argument: + coordinate-pair comma-wsp? coordinate-pair + */ ++ (SVGCurve) readQuadraticCurvetoArgument:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin +{ + CGPoint p1 = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint coord1 = CGPointMake(p1.x+origin.x, p1.y+origin.y); + [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner]; + + CGPoint p2 = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint coord2 = CGPointMake(p2.x+origin.x, p2.y+origin.y); + [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner]; + + CGPathAddQuadCurveToPoint(path, NULL, coord1.x, coord1.y, coord2.x, coord2.y); +#if DEBUG_PATH_CREATION + NSLog(@"[%@] PATH: QUADRATIC CURVE to (%2.2f, %2.2f)..(%2.2f, %2.2f)", [SVGKPointsAndPathsParser class], coord1.x, coord1.y, coord2.x, coord2.y ); +#endif + + return SVGCurveMake(coord1.x, coord1.y, 0.0f, 0.0f, coord2.x, coord2.y); +} + /** curveto: ( "C" | "c" ) wsp* curveto-argument-sequence @@ -380,9 +428,9 @@ + (SVGCurve) readCurvetoCommand:(NSScanner*)scanner path:(CGMutablePathRef)path NSAssert(ok, @"failed to scan curve to command"); if (!ok) return SVGCurveZero; - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; - SVGCurve lastCurve = [SVGPointsAndPathsParser readCurvetoArgumentSequence:scanner path:path relativeTo:origin isRelative:isRelative]; + SVGCurve lastCurve = [SVGKPointsAndPathsParser readCurvetoArgumentSequence:scanner path:path relativeTo:origin isRelative:isRelative]; return lastCurve; } @@ -393,10 +441,10 @@ + (SVGCurve) readCurvetoCommand:(NSScanner*)scanner path:(CGMutablePathRef)path */ + (SVGCurve) readCurvetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin isRelative:(BOOL) isRelative { - SVGCurve curve = [SVGPointsAndPathsParser readCurvetoArgument:scanner path:path relativeTo:origin]; + SVGCurve curve = [SVGKPointsAndPathsParser readCurvetoArgument:scanner path:path relativeTo:origin]; if (![scanner isAtEnd]) { - curve = [SVGPointsAndPathsParser readCurvetoArgumentSequence:scanner path:path relativeTo:(isRelative ? curve.p : origin) isRelative:isRelative]; + curve = [SVGKPointsAndPathsParser readCurvetoArgumentSequence:scanner path:path relativeTo:(isRelative ? curve.p : origin) isRelative:isRelative]; } return curve; @@ -407,21 +455,21 @@ + (SVGCurve) readCurvetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePath */ + (SVGCurve) readCurvetoArgument:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin { - CGPoint p1 = [SVGPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint p1 = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; CGPoint coord1 = CGPointMake(p1.x+origin.x, p1.y+origin.y); - [SVGPointsAndPathsParser readCommaAndWhitespace:scanner]; + [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner]; - CGPoint p2 = [SVGPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint p2 = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; CGPoint coord2 = CGPointMake(p2.x+origin.x, p2.y+origin.y); - [SVGPointsAndPathsParser readCommaAndWhitespace:scanner]; + [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner]; - CGPoint p3 = [SVGPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint p3 = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; CGPoint coord3 = CGPointMake(p3.x+origin.x, p3.y+origin.y); - [SVGPointsAndPathsParser readCommaAndWhitespace:scanner]; + [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner]; CGPathAddCurveToPoint(path, NULL, coord1.x, coord1.y, coord2.x, coord2.y, coord3.x, coord3.y); #if DEBUG_PATH_CREATION - NSLog(@"[%@] PATH: CURVE to (%2.2f, %2.2f)..(%2.2f, %2.2f)..(%2.2f, %2.2f)", [SVGPointsAndPathsParser class], coord1.x, coord1.y, coord2.x, coord2.y, coord3.x, coord3.y ); + NSLog(@"[%@] PATH: CURVE to (%2.2f, %2.2f)..(%2.2f, %2.2f)..(%2.2f, %2.2f)", [SVGKPointsAndPathsParser class], coord1.x, coord1.y, coord2.x, coord2.y, coord3.x, coord3.y ); #endif return SVGCurveMake(coord1.x, coord1.y, coord2.x, coord2.y, coord3.x, coord3.y); @@ -440,9 +488,9 @@ + (SVGCurve) readSmoothCurvetoCommand:(NSScanner*)scanner path:(CGMutablePathRef NSAssert(ok, @"failed to scan smooth curve to command"); if (!ok) return SVGCurveZero; - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; - SVGCurve lastCurve = [SVGPointsAndPathsParser readSmoothCurvetoArgumentSequence:scanner path:path relativeTo:origin withPrevCurve:prevCurve]; + SVGCurve lastCurve = [SVGKPointsAndPathsParser readSmoothCurvetoArgumentSequence:scanner path:path relativeTo:origin withPrevCurve:prevCurve]; return lastCurve; } @@ -453,10 +501,10 @@ + (SVGCurve) readSmoothCurvetoCommand:(NSScanner*)scanner path:(CGMutablePathRef */ + (SVGCurve) readSmoothCurvetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin withPrevCurve:(SVGCurve)prevCurve { - SVGCurve curve = [SVGPointsAndPathsParser readSmoothCurvetoArgument:scanner path:path relativeTo:origin withPrevCurve:prevCurve]; + SVGCurve curve = [SVGKPointsAndPathsParser readSmoothCurvetoArgument:scanner path:path relativeTo:origin withPrevCurve:prevCurve]; if (![scanner isAtEnd]) { - curve = [SVGPointsAndPathsParser readSmoothCurvetoArgumentSequence:scanner path:path relativeTo:origin withPrevCurve:prevCurve]; + curve = [SVGKPointsAndPathsParser readSmoothCurvetoArgumentSequence:scanner path:path relativeTo:origin withPrevCurve:prevCurve]; } return curve; @@ -468,11 +516,11 @@ + (SVGCurve) readSmoothCurvetoArgumentSequence:(NSScanner*)scanner path:(CGMutab */ + (SVGCurve) readSmoothCurvetoArgument:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin withPrevCurve:(SVGCurve)prevCurve { - CGPoint p1 = [SVGPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint p1 = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; CGPoint coord1 = CGPointMake(p1.x+origin.x, p1.y+origin.y); - [SVGPointsAndPathsParser readCommaAndWhitespace:scanner]; + [SVGKPointsAndPathsParser readCommaAndWhitespace:scanner]; - CGPoint p2 = [SVGPointsAndPathsParser readCoordinatePair:scanner]; + CGPoint p2 = [SVGKPointsAndPathsParser readCoordinatePair:scanner]; CGPoint coord2 = CGPointMake(p2.x+origin.x, p2.y+origin.y); SVGCurve thisCurve; @@ -489,7 +537,7 @@ + (SVGCurve) readSmoothCurvetoArgument:(NSScanner*)scanner path:(CGMutablePathRe CGPathAddCurveToPoint(path, NULL, thisCurve.c1.x, thisCurve.c1.y, thisCurve.c2.x, thisCurve.c2.y, thisCurve.p.x, thisCurve.p.y); #if DEBUG_PATH_CREATION - NSLog(@"[%@] PATH: SMOOTH CURVE to (%2.2f, %2.2f)..(%2.2f, %2.2f)..(%2.2f, %2.2f)", [SVGPointsAndPathsParser class], thisCurve.c1.x, thisCurve.c1.y, thisCurve.c2.x, thisCurve.c2.y, thisCurve.p.x, thisCurve.p.y ); + NSLog(@"[%@] PATH: SMOOTH CURVE to (%2.2f, %2.2f)..(%2.2f, %2.2f)..(%2.2f, %2.2f)", [SVGKPointsAndPathsParser class], thisCurve.c1.x, thisCurve.c1.y, thisCurve.c2.x, thisCurve.c2.y, thisCurve.p.x, thisCurve.p.y ); #endif return thisCurve; @@ -502,13 +550,13 @@ + (SVGCurve) readSmoothCurvetoArgument:(NSScanner*)scanner path:(CGMutablePathRe */ + (CGPoint) readVerticalLinetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin { - CGFloat yValue = [SVGPointsAndPathsParser readCoordinate:scanner]; + CGFloat yValue = [SVGKPointsAndPathsParser readCoordinate:scanner]; CGPoint vertCoord = CGPointMake(origin.x, origin.y+yValue); CGPoint currentPoint = CGPathGetCurrentPoint(path); CGPoint coord = CGPointMake(currentPoint.x, currentPoint.y+(vertCoord.y-currentPoint.y)); CGPathAddLineToPoint(path, NULL, coord.x, coord.y); #if DEBUG_PATH_CREATION - NSLog(@"[%@] PATH: VERTICAL LINE to (%2.2f, %2.2f)", [SVGPointsAndPathsParser class], coord.x, coord.y ); + NSLog(@"[%@] PATH: VERTICAL LINE to (%2.2f, %2.2f)", [SVGKPointsAndPathsParser class], coord.x, coord.y ); #endif return coord; } @@ -526,9 +574,9 @@ + (CGPoint) readVerticalLinetoCommand:(NSScanner*)scanner path:(CGMutablePathRef NSAssert(ok, @"failed to scan vertical line to command"); if (!ok) return origin; - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; - CGPoint lastCoordinate = [SVGPointsAndPathsParser readVerticalLinetoArgumentSequence:scanner path:path relativeTo:origin]; + CGPoint lastCoordinate = [SVGKPointsAndPathsParser readVerticalLinetoArgumentSequence:scanner path:path relativeTo:origin]; return lastCoordinate; } @@ -539,13 +587,13 @@ + (CGPoint) readVerticalLinetoCommand:(NSScanner*)scanner path:(CGMutablePathRef */ + (CGPoint) readHorizontalLinetoArgumentSequence:(NSScanner*)scanner path:(CGMutablePathRef)path relativeTo:(CGPoint)origin { - CGFloat xValue = [SVGPointsAndPathsParser readCoordinate:scanner]; + CGFloat xValue = [SVGKPointsAndPathsParser readCoordinate:scanner]; CGPoint horizCoord = CGPointMake(origin.x+xValue, origin.y); CGPoint currentPoint = CGPathGetCurrentPoint(path); CGPoint coord = CGPointMake(currentPoint.x+(horizCoord.x-currentPoint.x), currentPoint.y); CGPathAddLineToPoint(path, NULL, coord.x, coord.y); #if DEBUG_PATH_CREATION - NSLog(@"[%@] PATH: HORIZONTAL LINE to (%2.2f, %2.2f)", [SVGPointsAndPathsParser class], coord.x, coord.y ); + NSLog(@"[%@] PATH: HORIZONTAL LINE to (%2.2f, %2.2f)", [SVGKPointsAndPathsParser class], coord.x, coord.y ); #endif return coord; } @@ -563,9 +611,9 @@ + (CGPoint) readHorizontalLinetoCommand:(NSScanner*)scanner path:(CGMutablePathR NSAssert(ok, @"failed to scan horizontal line to command"); if (!ok) return origin; - [SVGPointsAndPathsParser readWhitespace:scanner]; + [SVGKPointsAndPathsParser readWhitespace:scanner]; - CGPoint lastCoordinate = [SVGPointsAndPathsParser readHorizontalLinetoArgumentSequence:scanner path:path relativeTo:origin]; + CGPoint lastCoordinate = [SVGKPointsAndPathsParser readHorizontalLinetoArgumentSequence:scanner path:path relativeTo:origin]; return lastCoordinate; } @@ -580,7 +628,7 @@ + (CGPoint) readCloseCommand:(NSScanner*)scanner path:(CGMutablePathRef)path rel CGPathCloseSubpath(path); #if DEBUG_PATH_CREATION - NSLog(@"[%@] PATH: finished path", [SVGPointsAndPathsParser class] ); + NSLog(@"[%@] PATH: finished path", [SVGKPointsAndPathsParser class] ); #endif return origin; diff --git a/Source/Core/SVGKFastImageView.h b/Source/Core/SVGKFastImageView.h new file mode 100644 index 000000000..aac94d4c1 --- /dev/null +++ b/Source/Core/SVGKFastImageView.h @@ -0,0 +1,37 @@ +#import + +#import "SVGKImageView.h" +#import "SVGKit.h" + +/** + * SVGKit's version of UIImageView - with some improvements over Apple's design + + WARNING 1: CAAnimations are NOT supported + - because of the way this class works, any animations you add to the SVGKImage's CALayerTree *will be ignored*. If you need to animate the elements of an SVG file, use SVGKLayer instead (although that class is missing some of the features of this class, and is a little harder to use) + + WARNING 2: UIScrollView requires special-case code + - Apple's implementation of UIScrollView is badly broken for zooming. To workaround this, you MUST disable the auto-redraw on this class BEFORE zooming a UIScrollView. You can re-enable it after the zoom has finished. You MUST ALSO make a manual call to "fix" the transform of the view each time Apple sends you the "didFinishZooming:atScale" method. There is an example of this in the demo project (currently named "iOS-Demo.xcodeproj") showing exactly how to do this. It only requires 2 lines of code, but Apple's documentation makes it clear that this is the only way to work in harmony with UIScrollView's internal hacks. + - to disable auto-redraw-on-resize, set the BOOL: disableAutoRedrawAtHighestResolution to FALSE + + Basic usage: + - as per UIImageView, simpy: + - SVGKImageView *skv = [[SVGKImageView alloc] initWithSVGKImage: [SVGKImage imageNamed:@"image.svg"]]; + - [self.view addSubview: skv]; + + Advanced usage: + - to make the contents shrink to half their actual size, and tile to fill, set self.tileRatio = CGSizeMake( 2.0f, 2.0f ); + NOTE: I'd prefer to do this view UIViewContentMode, but Apple didn't make it extensible + - to disable tiling (by default, it's disabled), set self.tileRatio = CGSizeZero, and all the tiling will be side-stepped + - FOR VERY ADVANCED USAGE: instead of this class, use the lower-level "SVGKLayeredImageView" class, which lets you modify every individual layer + + Performance: + - NOTE: the way this works - calling Apple's renderInContext: method - MAY BE artificially slow, because of Apple's implementation + - NOTE: you MUST NOT call SVGKImage.CALayerTree.transform - that will have unexpected side-effects, because of Apple's implementation + (hence: we currently use renderInContext:, even though we'd prefer not to :( ) + */ +@interface SVGKFastImageView : SVGKImageView + +@property(nonatomic) CGSize tileRatio; +@property(nonatomic) BOOL disableAutoRedrawAtHighestResolution; + +@end diff --git a/Source/Core/SVGKFastImageView.m b/Source/Core/SVGKFastImageView.m new file mode 100644 index 000000000..7c6d05d1f --- /dev/null +++ b/Source/Core/SVGKFastImageView.m @@ -0,0 +1,205 @@ +#import "SVGKFastImageView.h" + +@implementation SVGKFastImageView +{ + NSString* internalContextPointerBecauseApplesDemandsIt; +} + +@synthesize image = _image; +@synthesize tileRatio = _tileRatio; + +- (id)init +{ + NSAssert(false, @"init not supported, use initWithSVGKImage:"); + + return nil; +} + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + return [self initWithSVGKImage:nil]; +} + +- (id)initWithSVGKImage:(SVGKImage*) im +{ + if( im == nil ) + { + NSLog(@"[%@] 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!", [self class]); + } + + self = [super init]; + if (self) + { + internalContextPointerBecauseApplesDemandsIt = @"Apple wrote the addObserver / KVO notification API wrong in the first place and now requires developers to pass around pointers to fake objects to make up for the API deficicineces. You have to have one of these pointers per object, and they have to be internal and private. They serve no real value."; + + self.image = im; + self.frame = CGRectMake( 0,0, im.CALayerTree.frame.size.width, im.CALayerTree.frame.size.height ); // default: 0,0 to width x height of original image + self.tileRatio = CGSizeZero; + self.backgroundColor = [UIColor clearColor]; + + /** redraw-observers */ + if( self.disableAutoRedrawAtHighestResolution ) + ; + else + [self addInternalRedrawOnResizeObservers]; + + /** other obeservers */ + [self addObserver:self forKeyPath:@"image" options:NSKeyValueObservingOptionNew context:internalContextPointerBecauseApplesDemandsIt]; + [self addObserver:self forKeyPath:@"tileRatio" options:NSKeyValueObservingOptionNew context:internalContextPointerBecauseApplesDemandsIt]; + [self addObserver:self forKeyPath:@"showBorder" options:NSKeyValueObservingOptionNew context:internalContextPointerBecauseApplesDemandsIt]; + } + return self; +} + +-(void) addInternalRedrawOnResizeObservers +{ + [self addObserver:self forKeyPath:@"layer" options:NSKeyValueObservingOptionNew context:internalContextPointerBecauseApplesDemandsIt]; + [self.layer addObserver:self forKeyPath:@"transform" options:NSKeyValueObservingOptionNew context:internalContextPointerBecauseApplesDemandsIt]; +} + +-(void) removeInternalRedrawOnResizeObservers +{ + [self removeObserver:self forKeyPath:@"layer" context:internalContextPointerBecauseApplesDemandsIt]; + [self.layer removeObserver:self forKeyPath:@"transform" context:internalContextPointerBecauseApplesDemandsIt]; +} + +-(void)setDisableAutoRedrawAtHighestResolution:(BOOL)newValue +{ + if( newValue == _disableAutoRedrawAtHighestResolution ) + return; + + _disableAutoRedrawAtHighestResolution = newValue; + + if( self.disableAutoRedrawAtHighestResolution ) // disabled, so we have to remove the observers + { + [self removeInternalRedrawOnResizeObservers]; + } + else // newly-enabled ... must add the observers + { + [self addInternalRedrawOnResizeObservers]; + } +} + +- (void)dealloc +{ + if( self.disableAutoRedrawAtHighestResolution ) + ; + else + [self removeInternalRedrawOnResizeObservers]; + + [self removeObserver:self forKeyPath:@"image" context:internalContextPointerBecauseApplesDemandsIt]; + [self removeObserver:self forKeyPath:@"tileRatio" context:internalContextPointerBecauseApplesDemandsIt]; + [self removeObserver:self forKeyPath:@"showBorder" context:internalContextPointerBecauseApplesDemandsIt]; + + self.image = nil; + + [super dealloc]; +} + +/** Trigger a call to re-display (at higher or lower draw-resolution) (get Apple to call drawRect: again) */ +-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if( [keyPath isEqualToString:@"transform"] && CGSizeEqualToSize( CGSizeZero, self.tileRatio ) ) + { + /*NSLog(@"transform changed. Setting layer scale: %2.2f --> %2.2f", self.layer.contentsScale, self.transform.a); + self.layer.contentsScale = self.transform.a;*/ + [self.image.CALayerTree removeFromSuperlayer]; // force apple to redraw? + [self setNeedsDisplay]; + } + else + { + + if( self.disableAutoRedrawAtHighestResolution ) + ; + else + { + [self setNeedsDisplay]; + } + } +} + +/** + NB: this implementation is a bit tricky, because we're extending Apple's concept of a UIView to add "tiling" + and "automatic rescaling" + + */ +-(void)drawRect:(CGRect)rect +{ + /** + view.bounds == width and height of the view + imageBounds == natural width and height of the SVGKImage + */ + CGRect imageBounds = CGRectMake( 0,0, self.image.CALayerTree.frame.size.width, self.image.CALayerTree.frame.size.height ); + + + /** Check if tiling is enabled in either direction + + We have to do this FIRST, because we cannot extend Apple's enum they use for UIViewContentMode + (objective-C is a weak language). + + If we find ANY tiling, we will be forced to skip the UIViewContentMode handling + + TODO: it would be nice to combine the two - e.g. if contentMode=BottomRight, then do the tiling with + the bottom right corners aligned. If = TopLeft, then tile with the top left corners aligned, + etc. + */ + int cols = ceil(self.tileRatio.width); + int rows = ceil(self.tileRatio.height); + + if( cols < 1 ) // It's meaningless to have "fewer than 1" tiles; this lets us ALSO handle special case of "CGSizeZero == disable tiling" + cols = 1; + if( rows < 1 ) // It's meaningless to have "fewer than 1" tiles; this lets us ALSO handle special case of "CGSizeZero == disable tiling" + rows = 1; + + + CGSize scaleConvertImageToView; + CGSize tileSize; + if( cols == 1 && rows == 1 ) // if we are NOT tiling, then obey the UIViewContentMode as best we can! + { +#ifdef USE_SUBLAYERS_INSTEAD_OF_BLIT + if( self.image.CALayerTree.superlayer == self.layer ) + { + [super drawRect:rect]; + return; // TODO: Apple's bugs - they ignore all attempts to force a redraw + } + else + { + [self.layer addSublayer:self.image.CALayerTree]; + return; // we've added the layer - let Apple take care of the rest! + } +#else + scaleConvertImageToView = CGSizeMake( self.bounds.size.width / imageBounds.size.width, self.bounds.size.height / imageBounds.size.height ); + tileSize = self.bounds.size; +#endif + } + else + { + scaleConvertImageToView = CGSizeMake( self.bounds.size.width / (self.tileRatio.width * imageBounds.size.width), self.bounds.size.height / ( self.tileRatio.height * imageBounds.size.height) ); + tileSize = CGSizeMake( self.bounds.size.width / self.tileRatio.width, self.bounds.size.height / self.tileRatio.height ); + } + + NSLog(@"cols, rows: %i, %i ... scaleConvert: %@ ... tilesize: %@", cols, rows, NSStringFromCGSize(scaleConvertImageToView), NSStringFromCGSize(tileSize) ); + /** To support tiling, and to allow internal shrinking, we use renderInContext */ + CGContextRef context = UIGraphicsGetCurrentContext(); + for( int k=0; k * layeredElement); +#endif + +@interface SVGKImage (SVGPathView) + +#if NS_BLOCKS_AVAILABLE + +- (void) applyAggregator:(SVGElementAggregationBlock)aggregator; + +#endif + +@end diff --git a/Source/Core/SVGKImage+SVGPathView.m b/Source/Core/SVGKImage+SVGPathView.m new file mode 100644 index 000000000..0a915f9cf --- /dev/null +++ b/Source/Core/SVGKImage+SVGPathView.m @@ -0,0 +1,35 @@ +#import "SVGKImage+SVGPathView.h" + +@implementation SVGKImage (SVGPathView) + +#if NS_BLOCKS_AVAILABLE + +- (void) applyAggregator:(SVGElementAggregationBlock)aggregator toElement:(SVGElement < SVGLayeredElement > *)element +{ + if ( element.childNodes.length < 1 ) + { + return; + } + + for (SVGElement *child in element.childNodes) + { + if ([child conformsToProtocol:@protocol(SVGLayeredElement)]) { + SVGElement* layeredElement = (SVGElement*)child; + if (layeredElement) { + aggregator(layeredElement); + + [self applyAggregator:aggregator + toElement:layeredElement]; + } + } + } +} + +- (void) applyAggregator:(SVGElementAggregationBlock)aggregator +{ + [self applyAggregator:aggregator toElement:self.DOMTree]; +} + +#endif + +@end diff --git a/Source/Core/SVGKImage.h b/Source/Core/SVGKImage.h new file mode 100644 index 000000000..34ca670af --- /dev/null +++ b/Source/Core/SVGKImage.h @@ -0,0 +1,183 @@ +/* + SVGKImage + + The main class in SVGKit - this is the one you'll normally interact with + + c.f. SVGKit.h for more info on using SVGKit + + What is an SVGKImage? + + An SVGKImage is as close to "the SVG version of a UIImage" as we could possibly get. We cannot + subclass UIImage because Apple has defined UIImage as immutable - and SVG images actually change + (each time you zoom in, we want to re-render the SVG as a higher-resolution set of pixels) + + We use the exact same method names as UIImage, and try to be literally as identical as possible. + + Creating an SVGKImage: + + - PREFERRED: use the "imageNamed:" method + - CUSTOM SVGKSource class: use the "initWithSource:" method + - CUSTOM PARSING: Parse using SVGKParser, then send the parse-result to "initWithParsedSVG:" + + + Data: + - UIImage: not supported yet: will be a cached UIImage that is re-generated on demand. Will enable us to implement an SVGKImageView + that works as a drop-in replacement for UIImageView + + - DOMTree: the SVG DOM spec, the root element of a tree of SVGElement subclasses + - CALayerTree: the root element of a tree of CALayer subclasses + + - size: as per the UIImage.size, returns a size in Apple Points (i.e. 320 == width of iPhone, irrespective of Retina) + - scale: ??? unknown how we'll define this, but could be useful when doing auto-re-render-on-zoom + - svgWidth: the internal SVGLength used to generate the correct .size + - svgHeight: the internal SVGLength used to generate the correct .size + - rootElement: the SVGSVGElement instance that is the root of the parse SVG tree. Use this to access the full SVG document + + */ + +#import + +#import "SVGLength.h" +#import "SVGDocument.h" +#import "SVGElement.h" +#import "SVGSVGElement.h" +#import "SVGGroupElement.h" + +#import "SVGKParser.h" +#import "SVGKSource.h" +#import "SVGKParseResult.h" + +#define ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED 1 // if ENABLED, then ALL instances created with imageNamed: are shared, and are NEVER RELEASED + +@class SVGDefsElement; + +@interface SVGKImage : NSObject // doesn't extend UIImage because Apple made UIImage immutable +{ +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED + BOOL cameFromGlobalCache; +#endif +} + +#if TARGET_OS_IPHONE +@property (nonatomic, readonly) UIImage* UIImage; /** generates an image on the fly */ +#endif + +@property (nonatomic, retain, readonly) SVGLength* svgWidth; +@property (nonatomic, retain, readonly) SVGLength* svgHeight; +@property (nonatomic, retain, readonly) SVGKSource* source; +@property (nonatomic, retain, readonly) SVGKParseResult* parseErrorsAndWarnings; + +@property (nonatomic, retain, readonly) SVGDocument* DOMDocument; +@property (nonatomic, retain, readonly) SVGSVGElement* DOMTree; // needs renaming + (possibly) replacing by DOMDocument +@property (nonatomic, retain, readonly) CALayer* CALayerTree; +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED +@property (nonatomic, retain, readonly) NSString* nameUsedToInstantiate; +#endif + + +#pragma mark - methods to quick load an SVG as an image ++ (SVGKImage *)imageNamed:(NSString *)name; // load from main bundle ++ (SVGKImage *)imageWithContentsOfFile:(NSString *)path; +#if TARGET_OS_IPHONE // doesn't exist on OS X's Image class ++ (SVGKImage *)imageWithData:(NSData *)data; +#endif + +- (id)initWithContentsOfFile:(NSString *)path; +- (id)initWithData:(NSData *)data; + +#pragma mark - UIImage methods cloned and re-implemented as SVG intelligent methods + +/** The natural / preferred size of the SVG (SVG's are infinitely scalable, by definition). This is saved in the original image by the image's author */ +@property(nonatomic,readonly) CGSize size; + +/** + + TODO: From UIImage. Not needed, I think? + + @property(nonatomic,readonly) CIImage *CIImage __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); // returns underlying CIImage or nil if CGImageRef based +*/ + +// the these draw the image 'right side up' in the usual coordinate system with 'point' being the top-left. + +- (void)drawAtPoint:(CGPoint)point; // mode = kCGBlendModeNormal, alpha = 1.0 + +#pragma mark - unsupported / unimplemented UIImage methods (should add as a feature) + +/** This has no meaning for an SVGImage. + + TODO: *possibly* we could make this writeable, and say "when you request a CALayerTree, it gets scaled by this" + */ +@property(nonatomic,readonly) CGFloat scale; + +- (void)drawAtPoint:(CGPoint)point blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; +- (void)drawInRect:(CGRect)rect; // mode = kCGBlendModeNormal, alpha = 1.0 +- (void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; + +- (void)drawAsPatternInRect:(CGRect)rect; // draws the image as a CGPattern + +// animated images. When set as UIImageView.image, animation will play in an infinite loop until removed. Drawing will render the first image +#if TARGET_OS_IPHONE ++ (UIImage *)animatedImageNamed:(NSString *)name duration:(NSTimeInterval)duration ;//__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); read sequnce of files with suffix starting at 0 or 1 ++ (UIImage *)animatedResizableImageNamed:(NSString *)name capInsets:(UIEdgeInsets)capInsets duration:(NSTimeInterval)duration ;//__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); // squence of files ++ (UIImage *)animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration ;//__OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); +#endif +/** + + TODO: From UIImage. Not needed, I think? + +@property(nonatomic,readonly) NSArray *images __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); // default is nil for non-animated images +@property(nonatomic,readonly) NSTimeInterval duration __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); // total duration for all frames. default is 0 for non-animated images + */ +#pragma mark ---------end of unsupported items + ++ (SVGKImage*)imageWithContentsOfURL:(NSURL *)url; + +#pragma mark - core methods for interacting with an SVG image usefully (not from UIImage) + +/*! If you want to provide a custom SVGKSource */ +- (id)initWithSource:(SVGKSource *)source; +/*! If you already have a parsed SVG, and just want to upgrade it to an SVGKImage + + NB: this is frequently used if you have to add custom SVGKParserExtensions to parse an + SVG which contains custom tags + */ +- (id)initWithParsedSVG:(SVGKParseResult *)parseResult; + + +/*! Creates a new instance each time you call it. This should ONLY be used if you specifically need to duplicate + the CALayer's (e.g. because you want to render a temporary clone of the CALayers somewhere else on screen, + and you're going to modify them). + + For all other use-cases, you should probably use the .CALayerTree property, which is automatically cached between + calls - but MUST NOT be altered! + */ +-(CALayer *)newCALayerTree; + +/*! uses the current .CALayerTree property to find the layer, recursing down the tree (or creates a new + CALayerTree on demand, and caches it) + + i.e. this takes advantage of the cached CALayerTree instance, and also correctly uses the SVG.viewBox info + that was used when generating the original CALayerTree + */ +- (CALayer *)layerWithIdentifier:(NSString *)identifier; + +/*! uses the current .CALayerTree property to find the layer, recursing down the tree (or creates a new + CALayerTree on demand, and caches it) + + i.e. this takes advantage of the cached CALayerTree instance, and also correctly uses the SVG.viewBox info + that was used when generating the original CALayerTree + */ +- (CALayer *)layerWithIdentifier:(NSString *)identifier layer:(CALayer *)layer; + +/*! As for layerWithIdentifier: but works out the absolute position of the layer, + effectively pulling it out of the layer-tree (the newly created layer has NO SUPERLAYER, + because it no longer needs one) + + Useful for extracting individual features from an SVG + */ +-(CALayer*) newCopyPositionedAbsoluteLayerWithIdentifier:(NSString *)identifier; + +/*! returns all the individual CALayer's in the full layer tree, indexed by the SVG identifier of the SVG node that created that layer */ +- (NSDictionary*) dictionaryOfLayers; + +@end \ No newline at end of file diff --git a/Source/Core/SVGKImage.m b/Source/Core/SVGKImage.m new file mode 100644 index 000000000..fd903b980 --- /dev/null +++ b/Source/Core/SVGKImage.m @@ -0,0 +1,484 @@ +#import "SVGKImage.h" + +#import "SVGDefsElement.h" +#import "SVGDescriptionElement.h" +#import "SVGKParser.h" +#import "SVGTitleElement.h" +#import "SVGPathElement.h" +#import "SVGUseElement.h" + +#import "SVGKParserSVG.h" + +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED +@interface SVGKImageCacheLine : NSObject +@property(nonatomic) int numberOfInstances; +@property(nonatomic,retain) SVGKImage* mainInstance; +@end +@implementation SVGKImageCacheLine +@synthesize numberOfInstances; +@synthesize mainInstance; +@end +#endif + +@interface SVGKImage () + +@property (nonatomic, retain, readwrite) SVGLength* svgWidth; +@property (nonatomic, retain, readwrite) SVGLength* svgHeight; +@property (nonatomic, retain, readwrite) SVGKParseResult* parseErrorsAndWarnings; + +@property (nonatomic, retain, readwrite) SVGKSource* source; + +@property (nonatomic, retain, readwrite) SVGDocument* DOMDocument; +@property (nonatomic, retain, readwrite) SVGSVGElement* DOMTree; // needs renaming + (possibly) replacing by DOMDocument +@property (nonatomic, retain, readwrite) CALayer* CALayerTree; +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED +@property (nonatomic, retain, readwrite) NSString* nameUsedToInstantiate; +#endif + + +#pragma mark - UIImage methods cloned and re-implemented as SVG intelligent methods +//NOT DEFINED: what is the scale for a SVGKImage? @property(nonatomic,readwrite) CGFloat scale __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0); + +@end + +#pragma mark - main class +@implementation SVGKImage + +@synthesize DOMDocument, DOMTree, CALayerTree; + +@synthesize svgWidth = _width; +@synthesize svgHeight = _height; +@synthesize source; +@synthesize parseErrorsAndWarnings; + +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED +static NSMutableDictionary* globalSVGKImageCache; + +#pragma mark - Respond to low-memory warnings by dumping the global static cache ++(void) initialize +{ + if( self == [SVGKImage class]) // Have to protect against subclasses ADDITIONALLY calling this, as a "[super initialize] line + { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarningNotification:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; + } +} + ++(void) didReceiveMemoryWarningNotification:(NSNotification*) notification +{ + NSLog(@"[%@] Low-mem; purging cache of %i SVGKImage's...", self, [globalSVGKImageCache count] ); + + [globalSVGKImageCache removeAllObjects]; // once they leave the cache, if they are no longer referred to, they should automatically dealloc +} +#endif + +#pragma mark - Convenience initializers ++ (SVGKImage *)imageNamed:(NSString *)name { + NSParameterAssert(name != nil); + +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED + if( globalSVGKImageCache == nil ) + { + globalSVGKImageCache = [NSMutableDictionary new]; + } + + SVGKImageCacheLine* cacheLine = [globalSVGKImageCache valueForKey:name]; + if( cacheLine != nil ) + { + cacheLine.numberOfInstances ++; + return cacheLine.mainInstance; + } +#endif + + NSBundle *bundle = [NSBundle mainBundle]; + + if (!bundle) + return nil; + + NSString *newName = [name stringByDeletingPathExtension]; + NSString *extension = [name pathExtension]; + if ([@"" isEqualToString:extension]) { + extension = @"svg"; + } + + NSString *path = [bundle pathForResource:newName ofType:extension]; + + if (!path) + { + NSLog(@"[%@] MISSING FILE, COULD NOT CREATE DOCUMENT: filename = %@, extension = %@", [self class], newName, extension); + return nil; + } + + SVGKImage* result = [self imageWithContentsOfFile:path]; + +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED + result->cameFromGlobalCache = TRUE; + result.nameUsedToInstantiate = name; + + SVGKImageCacheLine* newCacheLine = [[[SVGKImageCacheLine alloc] init] autorelease]; + newCacheLine.mainInstance = result; + + [globalSVGKImageCache setValue:newCacheLine forKey:name]; +#endif + + return result; +} + ++ (SVGKImage*) imageWithContentsOfURL:(NSURL *)url { + NSParameterAssert(url != nil); + + return [[[[self class] alloc] initWithContentsOfURL:url] autorelease]; +} + ++ (SVGKImage*) imageWithContentsOfFile:(NSString *)aPath { + return [[[[self class] alloc] initWithContentsOfFile:aPath] autorelease]; +} + +/** + Designated Initializer + */ +- (id)initWithParsedSVG:(SVGKParseResult *)parseResult { + self = [super init]; + if (self) { + self.svgWidth = [SVGLength svgLengthZero]; + self.svgHeight = [SVGLength svgLengthZero]; + + self.parseErrorsAndWarnings = parseResult; + + if( parseErrorsAndWarnings.parsedDocument != nil ) + { + self.DOMDocument = parseErrorsAndWarnings.parsedDocument; + self.DOMTree = DOMDocument.rootElement; + } + else + { + self.DOMDocument = nil; + self.DOMTree = nil; + } + + if ( self.DOMDocument == nil ) + { + NSLog(@"[%@] ERROR: failed to init SVGKImage with source = %@, returning nil from init methods", [self class], source ); + self = nil; + } + else + { + self.svgWidth = self.DOMTree.width; + self.svgHeight = self.DOMTree.height; + } + } + return self; +} + +- (id)initWithSource:(SVGKSource *)newSource { + NSAssert( newSource != nil, @"Attempted to init an SVGKImage using a nil SVGKSource"); + + self = [self initWithParsedSVG:[SVGKParser parseSourceUsingDefaultSVGKParser:newSource]]; + if (self) { + self.source = newSource; + } + return self; +} + +- (id)initWithContentsOfFile:(NSString *)aPath { + NSParameterAssert(aPath != nil); + + return [self initWithSource:[SVGKSource sourceFromFilename:aPath]]; +} + +- (id)initWithContentsOfURL:(NSURL *)url { + NSParameterAssert(url != nil); + + return [self initWithSource:[SVGKSource sourceFromURL:url]]; +} + +- (void)dealloc +{ +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED + if( self->cameFromGlobalCache ) + { + SVGKImageCacheLine* cacheLine = [globalSVGKImageCache valueForKey:self.nameUsedToInstantiate]; + cacheLine.numberOfInstances --; + + if( cacheLine.numberOfInstances < 1 ) + { + [globalSVGKImageCache removeObjectForKey:self.nameUsedToInstantiate]; + } + } +#endif + + self.svgWidth = nil; + self.svgHeight = nil; + self.source = nil; + self.parseErrorsAndWarnings = nil; + + self.DOMDocument = nil; + self.DOMTree = nil; + self.CALayerTree = nil; +#ifdef ENABLE_GLOBAL_IMAGE_CACHE_FOR_SVGKIMAGE_IMAGE_NAMED + self.nameUsedToInstantiate = nil; +#endif + + [super dealloc]; +} + +//TODO mac alternatives to UIKit functions + +#if TARGET_OS_IPHONE ++ (UIImage *)imageWithData:(NSData *)data +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); + return nil; +} +#endif + +- (id)initWithData:(NSData *)data +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); + return nil; +} + +#pragma mark - UIImage methods we reproduce to make it act like a UIImage + +-(CGSize)size +{ + return CGSizeMake( [self.svgWidth pixelsValue], [self.svgHeight pixelsValue] ); +} + +-(CGFloat)scale +{ + NSAssert( FALSE, @"image.scale is currently UNDEFINED for an SVGKImage (nothing implemented by SVGKit)" ); + return 0.0; +} + +#if TARGET_OS_IPHONE +-(UIImage *)UIImage +{ + NSAssert( self.DOMTree != nil, @"You cannot request a .UIImage for an SVG that you haven't parsed yet! There's no data to return!"); + + UIGraphicsBeginImageContextWithOptions(self.size, FALSE, [UIScreen mainScreen].scale ); + CGContextRef context = UIGraphicsGetCurrentContext(); + [self.CALayerTree renderInContext:context]; + UIImage* result = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return result; +} +#endif + +// the these draw the image 'right side up' in the usual coordinate system with 'point' being the top-left. + +- (void)drawAtPoint:(CGPoint)point // mode = kCGBlendModeNormal, alpha = 1.0 +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); +} + +#pragma mark - unsupported / unimplemented UIImage methods (should add as a feature) +- (void)drawAtPoint:(CGPoint)point blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha +{ +NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); +} +- (void)drawInRect:(CGRect)rect // mode = kCGBlendModeNormal, alpha = 1.0 +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); +} + - (void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); +} + +- (void)drawAsPatternInRect:(CGRect)rect // draws the image as a CGPattern +// animated images. When set as UIImageView.image, animation will play in an infinite loop until removed. Drawing will render the first image +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); +} + +#if TARGET_OS_IPHONE ++ (UIImage *)animatedImageNamed:(NSString *)name duration:(NSTimeInterval)duration // read sequnce of files with suffix starting at 0 or 1 +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); + return nil; +} ++ (UIImage *)animatedResizableImageNamed:(NSString *)name capInsets:(UIEdgeInsets)capInsets duration:(NSTimeInterval)duration // squence of files +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); + return nil; +} ++ (UIImage *)animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration +{ + NSAssert( FALSE, @"Method unsupported / not yet implemented by SVGKit" ); + return nil; +} +#endif + +#pragma mark - CALayer methods: generate the CALayerTree + +- (CALayer *)layerWithIdentifier:(NSString *)identifier +{ + return [self layerWithIdentifier:identifier layer:self.CALayerTree]; +} + +- (CALayer *)layerWithIdentifier:(NSString *)identifier layer:(CALayer *)layer { + + if ([[layer valueForKey:kSVGElementIdentifier] isEqualToString:identifier]) { + return layer; + } + + for (CALayer *child in layer.sublayers) { + CALayer *resultingLayer = [self layerWithIdentifier:identifier layer:child]; + + if (resultingLayer) + return resultingLayer; + } + + return nil; +} + +-(CALayer*) newCopyPositionedAbsoluteLayerWithIdentifier:(NSString *)identifier +{ + CALayer* originalLayer = [self layerWithIdentifier:identifier]; + CALayer* clonedLayer = [[[originalLayer class] alloc] init]; + + clonedLayer.frame = originalLayer.frame; + if( [originalLayer isKindOfClass:[CAShapeLayer class]] ) + { + ((CAShapeLayer*)clonedLayer).path = ((CAShapeLayer*)originalLayer).path; + ((CAShapeLayer*)clonedLayer).lineCap = ((CAShapeLayer*)originalLayer).lineCap; + ((CAShapeLayer*)clonedLayer).lineWidth = ((CAShapeLayer*)originalLayer).lineWidth; + ((CAShapeLayer*)clonedLayer).strokeColor = ((CAShapeLayer*)originalLayer).strokeColor; + ((CAShapeLayer*)clonedLayer).fillColor = ((CAShapeLayer*)originalLayer).fillColor; + } + + if( clonedLayer == nil ) + return nil; + else + { + CGRect lFrame = clonedLayer.frame; + CGFloat xOffset = 0.0; + CGFloat yOffset = 0.0; + CALayer* currentLayer = originalLayer; + + if( currentLayer.superlayer == nil ) + { + NSLog(@"AWOOGA: layer %@ has no superlayer!", originalLayer ); + } + + while( currentLayer.superlayer != nil ) + { + //NSLog(@"shifting (%2.2f, %2.2f) to accomodate offset of layer = %@ inside superlayer = %@", currentLayer.superlayer.frame.origin.x, currentLayer.superlayer.frame.origin.y, currentLayer, currentLayer.superlayer ); + + currentLayer = currentLayer.superlayer; + xOffset += currentLayer.frame.origin.x; + yOffset += currentLayer.frame.origin.y; + } + + lFrame.origin = CGPointMake( lFrame.origin.x + xOffset, lFrame.origin.y + yOffset ); + clonedLayer.frame = lFrame; + + + return clonedLayer; + } +} + +- (CALayer *)newLayerWithElement:(SVGElement *)element +{ + CALayer *layer = [element newLayer]; + + NSLog(@"[%@] DEBUG: converted SVG element (class:%@) to CALayer (class:%@ frame:%@ pointer:%@) for id = %@", [self class], NSStringFromClass([element class]), NSStringFromClass([layer class]), NSStringFromCGRect( layer.frame ), layer, element.identifier); + + NodeList* childNodes = element.childNodes; + + /** + Special handling for tags - they have to masquerade invisibly as the node they are referring to + */ + if( [element isKindOfClass:[SVGUseElement class]] ) + { + SVGUseElement* useElement = (SVGUseElement*) element; + childNodes = useElement.instanceRoot.correspondingElement.childNodes; + } + + if ( childNodes.length < 1 ) { + return layer; + } + + for (SVGElement *child in childNodes ) + { + if ([child conformsToProtocol:@protocol(SVGLayeredElement)]) { + CALayer *sublayer = [self newLayerWithElement:(id)child]; + + if (!sublayer) { + continue; + } + + [layer addSublayer:sublayer]; + } + } + + [element layoutLayer:layer]; + + [layer setNeedsDisplay]; + + return layer; +} + +-(CALayer *)newCALayerTree +{ + if( self.DOMTree == nil ) + return nil; + else + { + return [self newLayerWithElement:self.DOMTree]; + } +} + +-(CALayer *)CALayerTree +{ + if( CALayerTree == nil ) + { + NSLog(@"[%@] WARNING: no CALayer tree found, creating a new one (will cache it once generated)", [self class] ); + self.CALayerTree = [[self newCALayerTree] autorelease]; + } + + return CALayerTree; +} + + +- (void) addSVGLayerTree:(CALayer*) layer withIdentifier:(NSString*) layerID toDictionary:(NSMutableDictionary*) layersByID +{ + // TODO: consider removing this method: it caches the lookup of individual items in the CALayerTree. It's a performance boost, but is it enough to be worthwhile? + [layersByID setValue:layer forKey:layerID]; + + if ( [layer.sublayers count] < 1 ) + { + return; + } + + for (CALayer *subLayer in layer.sublayers) + { + NSString* subLayerID = [subLayer valueForKey:kSVGElementIdentifier]; + + if( subLayerID != nil ) + { + NSLog(@"[%@] element id: %@ => layer: %@", [self class], subLayerID, subLayer); + + [self addSVGLayerTree:subLayer withIdentifier:subLayerID toDictionary:layersByID]; + + } + } +} + +- (NSDictionary*) dictionaryOfLayers +{ + // TODO: consider removing this method: it caches the lookup of individual items in the CALayerTree. It's a performance boost, but is it enough to be worthwhile? + NSMutableDictionary* layersByElementId = [NSMutableDictionary dictionary]; + + CALayer* rootLayer = self.CALayerTree; + + [self addSVGLayerTree:rootLayer withIdentifier:self.DOMTree.identifier toDictionary:layersByElementId]; + + NSLog(@"[%@] ROOT element id: %@ => layer: %@", [self class], self.DOMTree.identifier, rootLayer); + + return layersByElementId; +} + +@end + diff --git a/Source/Core/SVGKImageView.h b/Source/Core/SVGKImageView.h new file mode 100755 index 000000000..38138eeb5 --- /dev/null +++ b/Source/Core/SVGKImageView.h @@ -0,0 +1,25 @@ +#import + +#import +#import "SVGKImage.h" // cannot import "SVGKit.h" because that would cause ciruclar imports + +/** + * SVGKit's version of UIImageView - with some improvements over Apple's design. There are multiple versions of this class, for different use cases. + + STANDARD USAGE: + - SVGKImageView *myImageView = [[SVGKFastImageView alloc] initWithSVGKImage: [SVGKImage imageNamed:@"image.svg"]]; + - [self.view addSubview: myImageView]; + + NB: the "SVGKFastImageView" is the one you want 9 times in 10. The alternative classes (e.g. SVGKLayeredImageView) are for advanced usage. + + NB: read the class-comment for each subclass carefully before deciding what to use. + + */ +@interface SVGKImageView : UIView + +@property(nonatomic,retain) SVGKImage* image; +@property(nonatomic) BOOL showBorder; /*< mostly for debugging - adds a coloured 1-pixel border around the image */ + +- (id)initWithSVGKImage:(SVGKImage*) im; + +@end diff --git a/Source/Core/SVGKImageView.m b/Source/Core/SVGKImageView.m new file mode 100755 index 000000000..1cd089da7 --- /dev/null +++ b/Source/Core/SVGKImageView.m @@ -0,0 +1,44 @@ +#import "SVGKImageView.h" + +@implementation SVGKImageView + +@synthesize image = _image; +@synthesize showBorder = _showBorder; + +- (id)init +{ + if( [self class] == [SVGKImageView class ]) + { + NSAssert(false, @"You cannot init this class directly. Instead, use a subclass e.g. SVGKFastImageView"); + + return nil; + } + else + return [super init]; +} + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + if( [self class] == [SVGKImageView class ]) + { + NSAssert(false, @"You cannot init this class directly. Instead, use a subclass e.g. SVGKFastImageView"); + + return nil; + } + else + return [super initWithCoder:aDecoder]; +} + +- (id)initWithSVGKImage:(SVGKImage*) im +{ + NSAssert(false, @"Your subclass implementation is broken, it should be calling [super init] not [super initWithSVGKImage:]. Instead, use a subclass e.g. SVGKFastImageView"); + + return nil; +} + +- (void)dealloc +{ + [super dealloc]; +} + +@end diff --git a/Source/Core/SVGKLayer.h b/Source/Core/SVGKLayer.h new file mode 100644 index 000000000..2895f127d --- /dev/null +++ b/Source/Core/SVGKLayer.h @@ -0,0 +1,35 @@ +#import + +#import "SVGKit.h" + +/** + * SVGKLayer: this is the "low level" equivalent of SVGKImageView, and allows you to perform e.g. CoreAnimation on the individual elemetns / layers + within an SVG Image. + + NB: this class is MORE COMPLEX than SVGKImageView, and requires you to DO MORE WORK. It is also LOWER PERFORMANCE for basic usage - it expects + YOU to do the work if you want caching, OpenGL acceration, etc. To give you total access to the rendering, we have to disable all the performance + optimizations coded into SVGKImageView + + Basic usage: + - NOTE: most of the time, you DO NOT WANT this class, you instead want to use SVGKImageView, which does lots more work for you. + - Usage as per CALayer: + - SVGKLayer *skl = [[SVGKLayer alloc] init]; + - skl.SVGImage = [SVGKImage imageNamed:@"image.svg"]; + - [self.view.layer addSublayer: skl]; + + Advanced usage: + - Note that EVERY ELEMENT in the original SVG is rendered as a SEPARATE CALayer - you can access all the layers by name, and animate them + - ...c.f. the demo project (currently "iOS-Demo.xcodeproj" and how we animate the Monkey.svg file, wobbling its head + + Performance: + - NOTE: to give you full control of the layers, I had to delete the "auto-re-rasterize at highest pixel detail". I cannot find a way to make that work with Apple's hierarchy of CALayers (it only works when manually blitting). If anyone can figure this out, we'd all be extermely grateful! + - NOTE: the way this works - adding all layers individually - can have complex effects on performance. Some SVG files will render surprisingly fast, others surpisingly slow. + ... you MUST understand Apple's complete rendering system in detail to undertand what's going on (not recommended for beginners!) + - NOTE: you MUST NOT call SVGKImage.CALayerTree.transform - that will have unexpected side-effects, because of Apple's implementation + */ +@interface SVGKLayer : CALayer + +@property(nonatomic,retain) SVGKImage* SVGImage; +@property(nonatomic) BOOL showBorder; /*< mostly for debugging - adds a coloured 1-pixel border around the image */ + +@end diff --git a/Source/Core/SVGKLayer.m b/Source/Core/SVGKLayer.m new file mode 100644 index 000000000..be900f3e2 --- /dev/null +++ b/Source/Core/SVGKLayer.m @@ -0,0 +1,80 @@ +#import "SVGKLayer.h" + +@implementation SVGKLayer +{ + +} + +@synthesize SVGImage = _SVGImage; + +//self.backgroundColor = [UIColor clearColor]; + +/** Apple requires this to be implemented by CALayer subclasses */ ++(id)layer +{ + SVGKLayer* layer = [[SVGKLayer alloc] init]; + return layer; +} + +- (id)init +{ + self = [super init]; + if (self) + { + self.borderColor = [UIColor blackColor].CGColor; + + [self addObserver:self forKeyPath:@"showBorder" options:NSKeyValueObservingOptionNew context:NULL]; + } + return self; +} +-(void)setSVGImage:(SVGKImage *) newImage +{ + if( newImage == _SVGImage ) + return; + + /** 1: remove old */ + if( _SVGImage != nil ) + { + [_SVGImage.CALayerTree removeFromSuperlayer]; + [_SVGImage release]; + } + + /** 2: update pointer */ + _SVGImage = newImage; + + /** 3: add new */ + if( _SVGImage != nil ) + { + [_SVGImage retain]; + [self addSublayer:_SVGImage.CALayerTree]; + } +} + +- (void)dealloc +{ + //FIXME: Apple crashes on this line, even though BY DEFINITION Apple should not be crashing: [self removeObserver:self forKeyPath:@"showBorder"]; + + self.SVGImage = nil; + + [super dealloc]; +} + +/** Trigger a call to re-display (at higher or lower draw-resolution) (get Apple to call drawRect: again) */ +-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if( [keyPath isEqualToString:@"showBorder"] ) + { + if( self.showBorder ) + { + self.borderWidth = 1.0f; + } + else + { + self.borderWidth = 0.0f; + } + + [self setNeedsDisplay]; + } +} + +@end diff --git a/Source/Core/SVGKLayeredImageView.h b/Source/Core/SVGKLayeredImageView.h new file mode 100644 index 000000000..50fe1e55d --- /dev/null +++ b/Source/Core/SVGKLayeredImageView.h @@ -0,0 +1,27 @@ +#import + +#import "SVGKImageView.h" +#import "SVGKit.h" + +/** + * SVGKit's ADVANCED version of UIImageView - for most cases, you want to use the simple version instead (SVGKImageView) + + This class is similar to SVGKImageView, but it DOES NOT HAVE the performance optimizations, and it WILL NOT AUTO-DRAW AT FULL RESOLUTION. + + However, it DOES SUPPORT CORE ANIMATION (which SVGKImageView cannot do), and in some cases that's more important. + + Basic usage: + - as per SVGKImageView: + - SVGKLayeredImageView *skv = [[SVGKLayeredImageView alloc] initWithSVGKImage: [SVGKImage imageNamed:@"image.svg"]]; + - [self.view addSubview: skv]; + + Advanced usage: + - to access the underlying layers, typecast the .layer property: + - SVGKLayeredImageView *skv = [[SVGKLayeredImageView alloc] initWithSVGKImage: [SVGKImage imageNamed:@"image.svg"]]; + - SVGKLayer* layer = (SVGKLayer*) skv.layer; + + */ + +@interface SVGKLayeredImageView : SVGKImageView + +@end diff --git a/Source/Core/SVGKLayeredImageView.m b/Source/Core/SVGKLayeredImageView.m new file mode 100644 index 000000000..18f88aed8 --- /dev/null +++ b/Source/Core/SVGKLayeredImageView.m @@ -0,0 +1,76 @@ +#import "SVGKLayeredImageView.h" + +#import + +@interface SVGKLayeredImageView() +@property(nonatomic,retain) CAShapeLayer* internalBorderLayer; +@end + +@implementation SVGKLayeredImageView + +/** uses the custom SVGKLayer instead of a default CALayer */ ++(Class)layerClass +{ + return NSClassFromString(@"SVGKLayer"); +} + +- (id)init +{ + NSAssert(false, @"init not supported, use initWithSVGKImage:"); + + return nil; +} + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + return [self initWithSVGKImage:nil]; +} + +- (id)initWithSVGKImage:(SVGKImage*) im +{ + if( im == nil ) + { + NSLog(@"[%@] WARNING: you have initialized an [%@] 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!", [self class], [self class]); + } + + self = [super init]; + if (self) + { + self.frame = CGRectMake( 0,0, im.CALayerTree.frame.size.width, im.CALayerTree.frame.size.height ); // default: 0,0 to width x height of original image + self.backgroundColor = [UIColor clearColor]; + + ((SVGKLayer*) self.layer).SVGImage = im; + + } + return self; +} + +/** Delegate the call to the internal layer that's coded to handle this stuff automatically */ +-(SVGKImage *)image +{ + return ((SVGKLayer*)self.layer).SVGImage; +} +/** Delegate the call to the internal layer that's coded to handle this stuff automatically */ +-(void)setImage:(SVGKImage *)image +{ + ((SVGKLayer*)self.layer).SVGImage = image; +} + +/** Delegate the call to the internal layer that's coded to handle this stuff automatically */ +-(BOOL)showBorder +{ + return ((SVGKLayer*)self.layer).showBorder; +} +/** Delegate the call to the internal layer that's coded to handle this stuff automatically */ +-(void)setShowBorder:(BOOL)showBorder +{ + ((SVGKLayer*)self.layer).showBorder = showBorder; +} + +- (void)dealloc +{ + + [super dealloc]; +} + +@end diff --git a/Source/Core/SVGKParser.h b/Source/Core/SVGKParser.h new file mode 100644 index 000000000..595e34d05 --- /dev/null +++ b/Source/Core/SVGKParser.h @@ -0,0 +1,92 @@ +/** + SVGKParser.h + + The main parser for SVGKit. All the magic starts here. Either use: + + A: +parseSourceUsingDefaultSVGKParser + + ...or use: + + B: 1. -initWithSource: + B: 2. -addDefaultSVGParserExtensions + B: ... + B: 3. (as many times as you need) -addParserExtension: + B: ... + B: 4. -parseSynchronously + + Note that "A" above does ALL the steps in B for you. If you need a custom set of Parser Extensions, you'll need to + do all the steps in B yourself + + + PARSING + --- + Actual parsing of an SVG is split into three places: + + 1. High level, XML parsing: this file (SVGKParser) + 2. Mid level, parsing the structure of a document, and special XML tags: any class that extends "SVGKParserExtension" + 3. Mid level, parsing SVG tags only: SVGKParserSVG (it's an extension that just does base SVG) + 4. Low level, parsing individual tags within a file, and precise co-ordinates: all the "SVG...Element" classes parse themselves + + IDEALLY, we'd like to change that to: + + 1. High level, XML parsing: this file (SVGKParser) + 2. Mid level, parsing the structure of a document, and special XML tags: any class that extends "SVGKParserExtension" + 3. Mid level, parsing SVG tags only, but also handling all the different tags: SVGKParserSVG + 4. Lowest level, parsing co-ordinate lists, numbers, strings: yacc/lex parser (in an unnamed class that hasn't been written yet) + */ + +#import + +#import "SVGKSource.h" +#import "SVGKParserExtension.h" +#import "SVGKParseResult.h" + +#import "SVGElement.h" + + + +/*! RECOMMENDED: leave this set to 1 to get warnings about "legal, but poorly written" SVG */ +#define PARSER_WARN_FOR_ANONYMOUS_SVG_G_TAGS 1 + +/*! Verbose parser logging - ONLY needed if you have an SVG file that's failing to load / crashing */ +#define DEBUG_VERBOSE_LOG_EVERY_TAG 0 + +@interface SVGKParser : NSObject { + @private + BOOL _storingChars; + NSMutableString *_storedChars; + //NSMutableArray *_elementStack; + NSMutableArray * _stackOfParserExtensions; + Node * _parentOfCurrentNode; +} + +@property(nonatomic,retain,readonly) SVGKSource* source; +@property(nonatomic,retain,readonly) SVGKParseResult* currentParseRun; + + +@property(nonatomic,retain) NSMutableArray* parserExtensions; +@property(nonatomic,retain) NSMutableDictionary* parserKnownNamespaces; /**< maps "uri" to "array of parser-extensions" */ + +#pragma mark - NEW + ++ (SVGKParseResult*) parseSourceUsingDefaultSVGKParser:(SVGKSource*) source; +- (SVGKParseResult*) parseSynchronously; + + ++(NSDictionary *) NSDictionaryFromCSSAttributes: (Attr*) styleAttribute; + + + +#pragma mark - OLD - POTENTIALLY DELETE THESE ONCE THEY'VE ALL BEEN CHECKED AND CONVERTED + +- (id)initWithSource:(SVGKSource *)doc; + +/*! Adds the default SVG-tag parsers (everything in the SVG namespace); you should always use these, unless you + are massively customizing SVGKit's parser! */ +-(void) addDefaultSVGParserExtensions; +/*! NB: you ALMOST ALWAYS want to first call "addDefaultSVGParserExtensions" */ +- (void) addParserExtension:(NSObject*) extension; + + + +@end diff --git a/Source/Core/SVGKParser.m b/Source/Core/SVGKParser.m new file mode 100644 index 000000000..50f1850a8 --- /dev/null +++ b/Source/Core/SVGKParser.m @@ -0,0 +1,696 @@ +// +// SVGKParser.m +// SVGKit +// +// Copyright Matt Rajca 2010-2011. All rights reserved. +// + +#import "SVGKParser.h" +#import + +#import "SVGKParserSVG.h" + +@class SVGKParserPatternsAndGradients; +#import "SVGKParserPatternsAndGradients.h" +@class SVGKParserDefsAndUse; +#import "SVGKParserDefsAndUse.h" +@class SVGKParserDOM; +#import "SVGKParserDOM.h" + +#import "SVGDocument_Mutable.h" // so we can modify the SVGDocuments we're parsing + +#import "Node.h" + +@interface SVGKParser() +@property(nonatomic,retain, readwrite) SVGKSource* source; +@property(nonatomic,retain, readwrite) SVGKParseResult* currentParseRun; +@property(nonatomic,retain) NSString* defaultXMLNamespaceForThisParseRun; +@end + +@implementation SVGKParser + +@synthesize source; +@synthesize currentParseRun; +@synthesize defaultXMLNamespaceForThisParseRun; + +@synthesize parserExtensions; + +static xmlSAXHandler SAXHandler; + +static void startElementSAX(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes); +static void endElementSAX(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI); +static void charactersFoundSAX(void * ctx, const xmlChar * ch, int len); +static void errorEncounteredSAX(void * ctx, const char * msg, ...); + +static NSString *NSStringFromLibxmlString (const xmlChar *string); +static NSMutableDictionary *NSDictionaryFromLibxmlNamespaces (const xmlChar **namespaces, int namespaces_ct); +static NSMutableDictionary *NSDictionaryFromLibxmlAttributes (const xmlChar **attrs, int attr_ct); + ++ (SVGKParseResult*) parseSourceUsingDefaultSVGKParser:(SVGKSource*) source; +{ + SVGKParser *parser = [[[SVGKParser alloc] initWithSource:source] autorelease]; + [parser addDefaultSVGParserExtensions]; + + SVGKParseResult* result = [parser parseSynchronously]; + + return result; +} + + +#define READ_CHUNK_SZ 1024*10 + +- (id)initWithSource:(SVGKSource *) s { + self = [super init]; + if (self) { + self.parserExtensions = [NSMutableArray array]; + + self.source = s; + + _storedChars = [NSMutableString new]; + _stackOfParserExtensions = [NSMutableArray new]; + } + return self; +} + +- (void)dealloc { + self.currentParseRun = nil; + self.source = nil; + [_storedChars release]; + [_stackOfParserExtensions release]; + self.parserExtensions = nil; + [super dealloc]; +} + +-(void) addDefaultSVGParserExtensions +{ + SVGKParserSVG *subParserSVG = [[[SVGKParserSVG alloc] init] autorelease]; + SVGKParserPatternsAndGradients *subParserGradients = [[[SVGKParserPatternsAndGradients alloc] init] autorelease]; + SVGKParserDefsAndUse *subParserDefsAndUse = [[[SVGKParserDefsAndUse alloc] init] autorelease]; + SVGKParserDOM *subParserXMLDOM = [[[SVGKParserDOM alloc] init] autorelease]; + + [self addParserExtension:subParserSVG]; + [self addParserExtension:subParserGradients]; + [self addParserExtension:subParserDefsAndUse]; + [self addParserExtension:subParserXMLDOM]; +} + +- (void) addParserExtension:(NSObject*) extension +{ + // TODO: Should check for conflicts between this parser-extension and our existing parser-extensions, and issue warnings for any we find + + if( self.parserExtensions == nil ) + { + self.parserExtensions = [NSMutableArray array]; + } + + if( [self.parserExtensions containsObject:extension]) + { + NSLog(@"[%@] WARNING: attempted to add a ParserExtension that was already added = %@", [self class], extension); + return; + } + + [self.parserExtensions addObject:extension]; + + if( self.parserKnownNamespaces == nil ) + { + self.parserKnownNamespaces = [NSMutableDictionary dictionary]; + } + for( NSString* parserNamespace in extension.supportedNamespaces ) + { + NSMutableArray* extensionsForNamespace = [self.parserKnownNamespaces objectForKey:parserNamespace]; + if( extensionsForNamespace == nil ) + { + extensionsForNamespace = [NSMutableArray array]; + [self.parserKnownNamespaces setObject:extensionsForNamespace forKey:parserNamespace]; + } + + [extensionsForNamespace addObject:extension]; + } +} + +- (SVGKParseResult*) parseSynchronously +{ + self.currentParseRun = [[SVGKParseResult new] autorelease]; + _parentOfCurrentNode = nil; + [_stackOfParserExtensions removeAllObjects]; + + /* + // 1. while (source has chunks of BYTES) + // 2. read a chunk from source, send to libxml + // 3. if libxml failed chunk, break + // 4. return result + */ + + NSError* error = nil; + NSObject* reader = [source newReader:&error]; + if( error != nil ) + { + [currentParseRun addSourceError:error]; + [source closeReader:reader]; + [reader release]; + return currentParseRun; + } + char buff[READ_CHUNK_SZ]; + + xmlParserCtxtPtr ctx = xmlCreatePushParserCtxt(&SAXHandler, self, NULL, 0, NULL); + + if( ctx ) // if libxml init succeeds... + { + // 1. while (source has chunks of BYTES) + // 2. read a chunk from source, send to libxml + int bytesRead = [source reader:reader readNextChunk:(char *)&buff maxBytes:READ_CHUNK_SZ]; + while( bytesRead > 0 ) + { + int libXmlParserParseError = xmlParseChunk(ctx, buff, bytesRead, 0); + + if( [currentParseRun.errorsFatal count] > 0 ) + { + // 3. if libxml failed chunk, break + if( libXmlParserParseError > 0 ) + { + NSLog(@"[%@] libXml reported internal parser error with magic libxml code = %i (look this up on http://xmlsoft.org/html/libxml-xmlerror.html#xmlParserErrors)", [self class], libXmlParserParseError ); + currentParseRun.libXMLFailed = YES; + } + else + { + NSLog(@"[%@] SVG parser generated one or more FATAL errors (not the XML parser), errors follow:", [self class] ); + for( NSError* error in currentParseRun.errorsFatal ) + { + NSLog(@"[%@] ... FATAL ERRRO in SVG parse: %@", [self class], error ); + } + } + + break; + } + + bytesRead = [source reader:reader readNextChunk:(char *)&buff maxBytes:READ_CHUNK_SZ]; + } + } + + [source closeReader:reader]; // close the handle NO MATTER WHAT + [reader release]; + + if (!currentParseRun.libXMLFailed) + xmlParseChunk(ctx, NULL, 0, 1); // EOF + + xmlFreeParserCtxt(ctx); + + // 4. return result + return currentParseRun; +} + +/** ADAM: use this for a higher-performance, *non-blocking* parse + (when someone upgrades this class and the interface to support non-blocking parse) +// Called when a chunk of data has been downloaded. +- (void)connection:(NSURLConnection *)connection + didReceiveData:(NSData *)data +{ + // Process the downloaded chunk of data. + xmlParseChunk(_xmlParserContext, (const char *)[data bytes], [data length], 0);//....Getting Exception at this line. +} + */ + + +- (void)handleStartElement:(NSString *)name namePrefix:(NSString*)prefix namespaceURI:(NSString*) XMLNSURI attributeObjects:(NSMutableDictionary *) attributeObjects +{ + BOOL parsingRootTag = FALSE; + + if( _parentOfCurrentNode == nil ) + parsingRootTag = TRUE; + + /** + Search for a Parser Extension to handle this XML tag ... + + (most tags are handled by the default SVGParserSVG - but if you have other XML embedded in your SVG, you'll + have custom parser extentions too) + */ + NSObject* defaultParserForThisNamespace = nil; + NSObject* defaultParserForEverything = nil; + for( NSObject* subParser in self.parserExtensions ) + { + // TODO: rather than checking for the default parser on every node, we should stick them in a Dictionar at the start and re-use them when needed + /** + First: check if this parser is a "default" / fallback parser. If so, skip it, and only use it + AT THE VERY END after checking all other parsers + */ + BOOL shouldBreakBecauseParserIsADefault = FALSE; + + if( [[subParser supportedNamespaces] count] == 0 ) + { + defaultParserForEverything = subParser; + shouldBreakBecauseParserIsADefault = TRUE; + } + + if( [[subParser supportedNamespaces] containsObject:XMLNSURI] + && [[subParser supportedTags] count] == 0 ) + { + defaultParserForThisNamespace = subParser; + shouldBreakBecauseParserIsADefault = TRUE; + } + + if( shouldBreakBecauseParserIsADefault ) + continue; + + /** + Now we know it's a specific parser, check if it handles this particular node + */ + if( [[subParser supportedNamespaces] containsObject:XMLNSURI] + && [[subParser supportedTags] containsObject:name] ) + { + [_stackOfParserExtensions addObject:subParser]; + + /** Parser Extenstion creates a node for us */ + Node* subParserResult = [subParser handleStartElement:name document:source namePrefix:prefix namespaceURI:XMLNSURI attributes:attributeObjects parseResult:self.currentParseRun parentNode:_parentOfCurrentNode]; + + NSLog(@"[%@] tag: <%@:%@> id=%@ -- handled by subParser: %@", [self class], prefix, name, ([((Attr*)[attributeObjects objectForKey:@"id"]) value] != nil?[((Attr*)[attributeObjects objectForKey:@"id"]) value]:@"(none)"), subParser ); + + /** Add the new (partially parsed) node to the parent node in tree + + (need this for some of the parsing, later on, where we need to be able to read up + the tree to make decisions about the data - this is REQUIRED by the SVG Spec) + */ + [_parentOfCurrentNode appendChild:subParserResult]; // this is a DOM method: should NOT have side-effects + _parentOfCurrentNode = subParserResult; + + + if ([subParser createdNodeShouldStoreContent:subParserResult]) { + [_storedChars setString:@""]; + _storingChars = YES; + } + else { + _storingChars = NO; + } + + if( parsingRootTag ) + { + currentParseRun.parsedDocument.rootElement = (SVGSVGElement*) subParserResult; + } + + return; + } + } + + /** + IF we had a specific matching parser, we would have returned already. + + Since we haven't, it means we have to try the default parsers instead + */ + NSObject* eventualParser = defaultParserForThisNamespace != nil ? defaultParserForThisNamespace : defaultParserForEverything; + NSAssert( eventualParser != nil, @"Found a tag (prefix:%@ name:%@) that was rejected by all the parsers available. Perhaps you forgot to include a default parser (usually: SVGKParserDOM, which will handle any / all XML tags)", prefix, name ); + + NSLog(@"[%@] WARN: found a tag with no namespace parser: (), using default parser(%@)", [self class], name, eventualParser ); + + + [_stackOfParserExtensions addObject:eventualParser]; + + /** Parser Extenstion creates a node for us */ + Node* subParserResult = [eventualParser handleStartElement:name document:source namePrefix:prefix namespaceURI:XMLNSURI attributes:attributeObjects parseResult:self.currentParseRun parentNode:_parentOfCurrentNode]; + + NSLog(@"[%@] tag: <%@:%@> id=%@ -- handled by subParser: %@", [self class], prefix, name, ([((Attr*)[attributeObjects objectForKey:@"id"]) value] != nil?[((Attr*)[attributeObjects objectForKey:@"id"]) value]:@"(none)"), eventualParser ); + + /** Add the new (partially parsed) node to the parent node in tree + + (need this for some of the parsing, later on, where we need to be able to read up + the tree to make decisions about the data - this is REQUIRED by the SVG Spec) + */ + [_parentOfCurrentNode appendChild:subParserResult]; // this is a DOM method: should NOT have side-effects + _parentOfCurrentNode = subParserResult; + + + if ([eventualParser createdNodeShouldStoreContent:subParserResult]) { + [_storedChars setString:@""]; + _storingChars = YES; + } + else { + _storingChars = NO; + } + + if( parsingRootTag ) + { + currentParseRun.parsedDocument.rootElement = (SVGSVGElement*) subParserResult; + } + + return; +} + + +static void startElementSAX (void *ctx, const xmlChar *localname, const xmlChar *prefix, + const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, + int nb_attributes, int nb_defaulted, const xmlChar **attributes) { + + SVGKParser *self = (SVGKParser *) ctx; + + NSString *stringLocalName = NSStringFromLibxmlString(localname); + NSString *stringPrefix = NSStringFromLibxmlString(prefix); + NSMutableDictionary *namespacesByPrefix = NSDictionaryFromLibxmlNamespaces(namespaces, nb_namespaces); // TODO: need to do something with this; this is the ONLY point at which we discover the "xml:ns" definitions in the SVG doc! See below for a temp fix + NSMutableDictionary *attributeObjects = NSDictionaryFromLibxmlAttributes(attributes, nb_attributes); + NSString *stringURI = NSStringFromLibxmlString(URI); + + /** Set a default Namespace for rest of this document if one is included in the attributes */ + if( self.defaultXMLNamespaceForThisParseRun == nil ) + { + NSString* newDefaultNamespace = [namespacesByPrefix valueForKey:@""]; + if( newDefaultNamespace != nil ) + { + self.defaultXMLNamespaceForThisParseRun = newDefaultNamespace; + } + } + + if( stringURI == nil + && self.defaultXMLNamespaceForThisParseRun != nil ) + { + /** Apply the default XML NS to this tag as if it had been typed in. + + e.g. if somewhere in this doc the author put: + + + + ...then any time we find a tag that HAS NO EXPLICIT NAMESPACE, we act as if it had that one. + */ + + stringURI = self.defaultXMLNamespaceForThisParseRun; + } + + for( Attr* newAttribute in attributeObjects.allValues ) + { + if( newAttribute.namespaceURI == nil ) + newAttribute.namespaceURI = self.defaultXMLNamespaceForThisParseRun; + } + + /** + TODO: temporary workaround to PRETEND that all namespaces are always defined; + this is INCORRECT: namespaces should be UNdefined once you close the parent tag that defined them (I think?) + */ + for( NSString* prefix in namespacesByPrefix ) + { + NSString* uri = [namespacesByPrefix objectForKey:prefix]; + + if( prefix != nil ) + [self.currentParseRun.namespacesEncountered setObject:uri forKey:prefix]; + else + [self.currentParseRun.namespacesEncountered setObject:uri forKey:[NSNull null]]; + } + +#if DEBUG_VERBOSE_LOG_EVERY_TAG + NSLog(@"[%@] DEBUG_VERBOSE: <%@%@> (namespace URL:%@), attributes: %i", [self class], [NSString stringWithFormat:@"%@:",stringPrefix], name, stringURI, nb_attributes ); +#endif + +#if DEBUG_VERBOSE_LOG_EVERY_TAG + if( prefix2 == nil ) + { + /* The XML library allows this, although it's very unhelpful when writing application code */ + + /* Let's find out what namespaces DO exist... */ + + /* + + TODO / DEVELOPER WARNING: the library says nb_namespaces is the number of elements in the array, + but it keeps returning nil pointer (not always, but often). WTF? Not sure what we're doing wrong + here, but commenting it out for now... + + if( nb_namespaces > 0 ) + { + for( int i=0; i", [self class], stringLocalName ); + } + + [self handleStartElement:stringLocalName namePrefix:stringPrefix namespaceURI:stringURI attributeObjects:attributeObjects]; +} + +- (void)handleEndElement:(NSString *)name { + //DELETE DEBUG NSLog(@"ending element, name = %@", name); + + + NSObject* lastobject = [_stackOfParserExtensions lastObject]; + + [_stackOfParserExtensions removeLastObject]; + + NSObject* parser = (NSObject*)lastobject; + NSObject* parentParser = [_stackOfParserExtensions lastObject]; + + + NSLog(@"[%@] DEBUG-PARSER: ended tag (), handled by parser (%@) with parent parsed by %@", [self class], name, parser, parentParser ); + + /** + At this point, the "parent of current node" is still set to the node we're + closing - because we haven't finished closing it yet + */ + if ( [parser createdNodeShouldStoreContent:_parentOfCurrentNode]) { + [parser handleStringContent:_storedChars forNode:_parentOfCurrentNode]; + + [_storedChars setString:@""]; + _storingChars = NO; + } + + /** Update the _parentOfCurrentNode to point to the parent of the node we just closed... + */ + _parentOfCurrentNode = _parentOfCurrentNode.parentNode; + +} + +static void endElementSAX (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI) { + SVGKParser *self = (SVGKParser *) ctx; + [self handleEndElement:NSStringFromLibxmlString(localname)]; +} + +- (void)handleFoundCharacters:(const xmlChar *)chars length:(int)len { + if (_storingChars) { + char value[len + 1]; + strncpy(value, (const char *) chars, len); + value[len] = '\0'; + + [_storedChars appendString:[NSString stringWithUTF8String:value]]; + } +} + +static void charactersFoundSAX (void *ctx, const xmlChar *chars, int len) { + SVGKParser *self = (SVGKParser *) ctx; + [self handleFoundCharacters:chars length:len]; +} + +static void errorEncounteredSAX (void *ctx, const char *msg, ...) { + NSLog(@"Error encountered during parse: %s", msg); + SVGKParseResult* parseResult = ((SVGKParser*) ctx).currentParseRun; + [parseResult addSAXError:[NSError errorWithDomain:@"SVG-SAX" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: + (NSString*) msg, NSLocalizedDescriptionKey, + nil]]]; +} + +static void unparsedEntityDeclaration(void * ctx, + const xmlChar * name, + const xmlChar * publicId, + const xmlChar * systemId, + const xmlChar * notationName) +{ + NSLog(@"ERror: unparsed entity Decl"); +} + +static void structuredError (void * userData, + xmlErrorPtr error) +{ + /** + XML_ERR_WARNING = 1 : A simple warning + XML_ERR_ERROR = 2 : A recoverable error + XML_ERR_FATAL = 3 : A fatal error + */ + xmlErrorLevel errorLevel = error->level; + + NSMutableDictionary* details = [NSMutableDictionary dictionaryWithObjectsAndKeys: + [NSString stringWithCString:error->message encoding:NSUTF8StringEncoding], NSLocalizedDescriptionKey, + [NSNumber numberWithInt:error->line], @"lineNumber", + [NSNumber numberWithInt:error->int2], @"columnNumber", + nil]; + + if( error->str1 ) + [details setValue:[NSString stringWithCString:error->str1 encoding:NSUTF8StringEncoding] forKey:@"bonusInfo1"]; + if( error->str2 ) + [details setValue:[NSString stringWithCString:error->str2 encoding:NSUTF8StringEncoding] forKey:@"bonusInfo2"]; + if( error->str3 ) + [details setValue:[NSString stringWithCString:error->str3 encoding:NSUTF8StringEncoding] forKey:@"bonusInfo3"]; + + NSError* objcError = [NSError errorWithDomain:[[NSNumber numberWithInt:error->domain] stringValue] code:error->code userInfo:details]; + + SVGKParseResult* parseResult = ((SVGKParser*) userData).currentParseRun; + switch( errorLevel ) + { + case XML_ERR_WARNING: + { + [parseResult addParseWarning:objcError]; + }break; + + case XML_ERR_ERROR: + { + [parseResult addParseErrorRecoverable:objcError]; + }break; + + case XML_ERR_FATAL: + { + [parseResult addParseErrorFatal:objcError]; + } + default: + break; + } + +} + +static xmlSAXHandler SAXHandler = { + NULL, /* internalSubset */ + NULL, /* isStandalone */ + NULL, /* hasInternalSubset */ + NULL, /* hasExternalSubset */ + NULL, /* resolveEntity */ + NULL, /* getEntity */ + NULL, /* entityDecl */ + NULL, /* notationDecl */ + NULL, /* attributeDecl */ + NULL, /* elementDecl */ + unparsedEntityDeclaration, /* unparsedEntityDecl */ + NULL, /* setDocumentLocator */ + NULL, /* startDocument */ + NULL, /* endDocument */ + NULL, /* startElement*/ + NULL, /* endElement */ + NULL, /* reference */ + charactersFoundSAX, /* characters */ + NULL, /* ignorableWhitespace */ + NULL, /* processingInstruction */ + NULL, /* comment */ + NULL, /* warning */ + errorEncounteredSAX, /* error */ + NULL, /* fatalError //: unused error() get all the errors */ + NULL, /* getParameterEntity */ + NULL, /* cdataBlock */ + NULL, /* externalSubset */ + XML_SAX2_MAGIC, + NULL, + startElementSAX, /* startElementNs */ + endElementSAX, /* endElementNs */ + structuredError, /* serror */ +}; + +#pragma mark - +#pragma mark Utility + +static NSString *NSStringFromLibxmlString (const xmlChar *string) { + if( string == NULL ) // Yes, Apple requires we do this check! + return nil; + else + return [NSString stringWithUTF8String:(const char *) string]; +} + +static NSMutableDictionary *NSDictionaryFromLibxmlNamespaces (const xmlChar **namespaces, int namespaces_ct) +{ + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + + for (int i = 0; i < namespaces_ct * 2; i += 2) + { + NSString* prefix = NSStringFromLibxmlString(namespaces[i]); + NSString* uri = NSStringFromLibxmlString(namespaces[i+1]); + + if( prefix == nil ) + prefix = @""; // Special case: Apple dictionaries can't handle null keys + + [dict setObject:uri + forKey:prefix]; + } + + return [dict autorelease]; +} + + +static NSMutableDictionary *NSDictionaryFromLibxmlAttributes (const xmlChar **attrs, int attr_ct) { + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + + for (int i = 0; i < attr_ct * 5; i += 5) { + const char *begin = (const char *) attrs[i + 3]; + const char *end = (const char *) attrs[i + 4]; + int vlen = strlen(begin) - strlen(end); + + char val[vlen + 1]; + strncpy(val, begin, vlen); + val[vlen] = '\0'; + + NSString* localName = NSStringFromLibxmlString(attrs[i]); + NSString* prefix = NSStringFromLibxmlString(attrs[i+1]); + NSString* uri = NSStringFromLibxmlString(attrs[i+2]); + NSString* value = [NSString stringWithUTF8String:val]; + + NSString* qname = (prefix == nil) ? localName : [NSString stringWithFormat:@"%@:%@", prefix, localName]; + + Attr* newAttribute = [[[Attr alloc] initWithNamespace:uri qualifiedName:qname value:value] autorelease]; + + [dict setObject:newAttribute + forKey:qname]; + } + + return [dict autorelease]; +} + +#define MAX_ACCUM 256 +#define MAX_NAME 256 + ++(NSDictionary *) NSDictionaryFromCSSAttributes: (Attr*) styleAttribute { + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + + const char *cstr = [styleAttribute.value UTF8String]; + size_t len = strlen(cstr); + + char name[MAX_NAME]; + bzero(name, MAX_NAME); + + char accum[MAX_ACCUM]; + bzero(accum, MAX_ACCUM); + + size_t accumIdx = 0; + + for (size_t n = 0; n <= len; n++) { + char c = cstr[n]; + + if (c == '\n' || c == '\t' || c == ' ') { + continue; + } + + if (c == ':') { + strcpy(name, accum); + name[accumIdx] = '\0'; + + bzero(accum, MAX_ACCUM); + accumIdx = 0; + + continue; + } + else if (c == ';' || c == '\0') { + accum[accumIdx] = '\0'; + + Attr* newAttribute = [[[Attr alloc] initWithNamespace:styleAttribute.namespaceURI qualifiedName:[NSString stringWithUTF8String:name] value:[NSString stringWithUTF8String:accum]] autorelease]; + + [dict setObject:newAttribute + forKey:newAttribute.localName]; + + bzero(name, MAX_NAME); + + bzero(accum, MAX_ACCUM); + accumIdx = 0; + + continue; + } + + accum[accumIdx++] = c; + } + + return [dict autorelease]; +} + +@end diff --git a/Core/SVGPattern.h b/Source/Core/SVGKPattern.h similarity index 63% rename from Core/SVGPattern.h rename to Source/Core/SVGKPattern.h index 11a0c4d73..1534cb5b2 100644 --- a/Core/SVGPattern.h +++ b/Source/Core/SVGKPattern.h @@ -1,8 +1,3 @@ -// -// SVGPattern.h -// SVGKit -// - #import #if TARGET_OS_IPHONE @@ -12,14 +7,14 @@ #endif /** lightweight wrapper for UIColor so that we can draw with fill patterns */ -@interface SVGPattern : NSObject +@interface SKPattern : NSObject { } #if TARGET_OS_IPHONE -+ (SVGPattern*) patternWithUIColor:(UIColor*)color; -+ (SVGPattern*) patternWithImage:(UIImage*)image; ++ (SKPattern*) patternWithUIColor:(UIColor*)color; ++ (SKPattern*) patternWithImage:(UIImage*)image; @property (readwrite,nonatomic,retain) UIColor* color; diff --git a/Core/SVGPattern.m b/Source/Core/SVGKPattern.m similarity index 57% rename from Core/SVGPattern.m rename to Source/Core/SVGKPattern.m index 6adb817fa..c42e9850a 100644 --- a/Core/SVGPattern.m +++ b/Source/Core/SVGKPattern.m @@ -1,24 +1,19 @@ -// -// SVGPattern.m -// SVGKit -// +#import "SVGKPattern.h" -#import "SVGPattern.h" - -@implementation SVGPattern +@implementation SKPattern #if TARGET_OS_IPHONE @synthesize color; -+ (SVGPattern *)patternWithUIColor:(UIColor *)color ++ (SKPattern *)patternWithUIColor:(UIColor *)color { - SVGPattern* p = [[[SVGPattern alloc] init] autorelease]; + SKPattern* p = [[[SKPattern alloc] init] autorelease]; p.color = color; return p; } -+ (SVGPattern*)patternWithImage:(UIImage*)image ++ (SKPattern*)patternWithImage:(UIImage*)image { UIColor* patternImage = [UIColor colorWithPatternImage:image]; return [self patternWithUIColor:patternImage]; diff --git a/Source/Core/SVGKSource.h b/Source/Core/SVGKSource.h new file mode 100644 index 000000000..00997a50b --- /dev/null +++ b/Source/Core/SVGKSource.h @@ -0,0 +1,45 @@ +/** + SVGKSource.h + + SVGKSource represents the info about a file that was read from disk or over the web during parsing. + + Once it has been parsed / loaded, that info is NOT PART OF the in-memory SVG any more - if you were to save the file, you could + save it in a different location, with a different SVG Spec, etc. + + However, it's useful for debugging (and for optional "save this document in same place it was loaded from / same format" + to store this info at runtime just in case it's needed later. + + Also, it helps during parsing to keep track of some document-level information + + */ + +#import + +@protocol SVGKSourceReader +@end + +@interface SVGKSourceFileReader : NSObject +{ + FILE *fileHandle; +} +@end + +@interface SVGKSourceURLReader : NSObject +@property(nonatomic,retain) NSData* httpDataFullyDownloaded; +@end + +@interface SVGKSource : NSObject + +@property(nonatomic,retain) NSString* svgLanguageVersion; /*< */ +@property(nonatomic) BOOL hasSourceFile, hasSourceURL; +@property(nonatomic,retain) NSString* filePath; +@property(nonatomic,retain) NSURL* URL; + ++(SVGKSource*) sourceFromFilename:(NSString*) p; ++(SVGKSource*) sourceFromURL:(NSURL*) u; + +-(NSObject*) newReader:(NSError**) error; +-(void) closeReader:(NSObject*) reader; +-(int) reader:(NSObject*) reader readNextChunk:(char *) chunk maxBytes:(int) READ_CHUNK_SZ; + +@end diff --git a/Source/Core/SVGKSource.m b/Source/Core/SVGKSource.m new file mode 100644 index 000000000..ee18da9c8 --- /dev/null +++ b/Source/Core/SVGKSource.m @@ -0,0 +1,156 @@ + +#import "SVGKSource.h" + +@implementation SVGKSourceFileReader +-(void) setFileHandle:(FILE*) f +{ + fileHandle = f; +} + +-(FILE*) fileHandle +{ + return fileHandle; +} +@end + +@implementation SVGKSourceURLReader +@synthesize httpDataFullyDownloaded; +@end + + +@implementation SVGKSource + +@synthesize svgLanguageVersion; +@synthesize hasSourceFile, hasSourceURL; +@synthesize filePath, URL; + ++(SVGKSource*) sourceFromFilename:(NSString*) p +{ + SVGKSource* d = [[[SVGKSource alloc] init] autorelease]; + + d.hasSourceFile = TRUE; + d.filePath = p; + + return d; +} + ++(SVGKSource*) sourceFromURL:(NSURL*) u +{ + SVGKSource* d = [[[SVGKSource alloc] init] autorelease]; + + d.hasSourceURL = TRUE; + d.URL = u; + + return d; +} + +-(NSObject*) newReader:(NSError**) error +{ + /** + Is this file being loaded from disk? + Or from network? + */ + if( self.hasSourceURL ) + { + /** + NB: + + Currently reads the ENTIRE web file synchronously, holding the entire + thing in memory. + + Not efficient, might crash for 'huge' files (would need to be large numbers of megabytes, though) + + But ... since we want a synchronous parse ... + */ + NSURLResponse* response; + NSData* httpData = nil; + + NSURLRequest* request = [NSURLRequest requestWithURL:self.URL]; + + httpData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:error]; + + if( httpData == nil ) + { + NSLog( @"[%@] ERROR: failed to parse SVG from URL, because failed to download file at URL = %@, error = %@", [self class], self.URL, *error ); + return nil; + } + + SVGKSourceURLReader* urlReader = [[SVGKSourceURLReader alloc] init]; + urlReader.httpDataFullyDownloaded = httpData; + + return urlReader; + } + else + { + FILE *file; // C is wonderful (ly obscure, with mem management) + const char *cPath = [self.filePath fileSystemRepresentation]; + file = fopen(cPath, "r"); + + if (!file) + { + if( error != nil ) + *error = [NSError errorWithDomain:@"SVGKit" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: + [NSString stringWithFormat:@"Couldn't open the file %@ for reading", self.filePath], NSLocalizedDescriptionKey, + nil]]; + } + + SVGKSourceFileReader* fileReader = [[SVGKSourceFileReader alloc] init]; + fileReader.fileHandle = file; + + return fileReader; + } + +} + +-(void) closeReader:(NSObject*) reader +{ + /** + Is this file being loaded from disk? + Or from network? + */ + if( self.hasSourceURL ) + { + // nothing needed - the asynch call was already complete + } + else + { + fclose([((SVGKSourceFileReader*)reader) fileHandle]); + } +} + +-(int) reader:(NSObject*) reader readNextChunk:(char *) chunk maxBytes:(int) READ_CHUNK_SZ +{ + /** + Is this file being loaded from disk? + Or from network? + */ + if( self.hasSourceURL ) + { + SVGKSourceURLReader* urlReader = (SVGKSourceURLReader*) reader; + + const char* dataAsBytes = [urlReader.httpDataFullyDownloaded bytes]; + int dataLength = [urlReader.httpDataFullyDownloaded length]; + + int actualBytesCopied = MIN( dataLength, READ_CHUNK_SZ ); + memcpy( chunk, dataAsBytes, actualBytesCopied); + + /** trim the copied bytes out of the 'handle' NSData object */ + NSRange newRange = { actualBytesCopied, dataLength - actualBytesCopied }; + urlReader.httpDataFullyDownloaded = [urlReader.httpDataFullyDownloaded subdataWithRange:newRange]; + + return actualBytesCopied; + } + else + { + SVGKSourceFileReader* fileReader = (SVGKSourceFileReader*) reader; + + size_t bytesRead = 0; + + bytesRead = fread(chunk, 1, READ_CHUNK_SZ, [fileReader fileHandle]); + + return bytesRead; + } +} + + +@end diff --git a/Source/Core/SVGKit.h b/Source/Core/SVGKit.h new file mode 100644 index 000000000..c420e5f4a --- /dev/null +++ b/Source/Core/SVGKit.h @@ -0,0 +1,41 @@ +/*! + + SVGKit - https://github.com/SVGKit/SVGKit + + THE MOST IMPORTANT ELEMENTS YOU'LL INTERACT WITH: + + 1. SVGKImage = contains most of the convenience methods for loading / reading / displaying SVG files + 2. SVGKImageView = the easiest / fastest way to display an SVGKImage on screen + 3. SVGKLayer = the low-level way of getting an SVG as a bunch of layers + + SVGKImage makes heavy use of the following classes - you'll often use these classes (most of them given to you by an SVGKImage): + + 4. SVGKSource = the "file" or "URL" for loading the SVG data + 5. SVGKParseResult = contains the parsed SVG file AND/OR the list of errors during parsing + + */ + +#include "TargetConditionals.h" + +#import "DOMHelperUtilities.h" + #import "SVGCircleElement.h" + #import "SVGDefsElement.h" + #import "SVGDescriptionElement.h" + #import "SVGKImage.h" + #import "SVGElement.h" + #import "SVGEllipseElement.h" + #import "SVGGroupElement.h" + #import "SVGImageElement.h" + #import "SVGLineElement.h" + #import "SVGPathElement.h" + #import "SVGPolygonElement.h" + #import "SVGPolylineElement.h" + #import "SVGRectElement.h" + #import "SVGShapeElement.h" + #import "SVGKSource.h" + #import "SVGTitleElement.h" + #import "SVGUtils.h" + #import "SVGKPattern.h" + #import "SVGKImageView.h" + #import "SVGKLayeredImageView.h" + #import "SVGKLayer.h" diff --git a/Core/SVGUtils.h b/Source/Core/SVGUtils.h similarity index 86% rename from Core/SVGUtils.h rename to Source/Core/SVGUtils.h index d6ad8e8b8..b0c9919bf 100644 --- a/Core/SVGUtils.h +++ b/Source/Core/SVGUtils.h @@ -27,5 +27,5 @@ SVGColor SVGColorFromString (const char *string); CGFloat SVGPercentageFromString (const char *string); -CGMutablePathRef SVGPathFromPointsInString (const char *string, boolean_t close); +CGMutablePathRef createPathFromPointsInString (const char *string, boolean_t close); CGColorRef CGColorWithSVGColor (SVGColor color); diff --git a/Core/SVGUtils.m b/Source/Core/SVGUtils.m similarity index 98% rename from Core/SVGUtils.m rename to Source/Core/SVGUtils.m index b71395f46..36e4444e2 100644 --- a/Core/SVGUtils.m +++ b/Source/Core/SVGUtils.m @@ -360,7 +360,7 @@ CGFloat SVGPercentageFromString (const char *string) { return atoi(string) / 100.0f; } -CGMutablePathRef SVGPathFromPointsInString (const char *string, boolean_t close) { +CGMutablePathRef createPathFromPointsInString (const char *string, boolean_t close) { CGMutablePathRef path = CGPathCreateMutable(); size_t len = strlen(string); @@ -399,7 +399,7 @@ CGMutablePathRef SVGPathFromPointsInString (const char *string, boolean_t close) bzero(accum, MAX_ACCUM); accumIdx = 0; } - else if (isdigit(c) || c == '.') { // is digit or decimal separator? + else if (isdigit(c) || c == '-' || c == '.') { // is digit or decimal separator OR A MINUS SIGN!!! ? accum[accumIdx++] = c; } } diff --git a/Source/iOS/CALayerExporter.h b/Source/iOS/CALayerExporter.h new file mode 100644 index 000000000..8a7230bb9 --- /dev/null +++ b/Source/iOS/CALayerExporter.h @@ -0,0 +1,38 @@ +// +// CALayerExporter.h +// SVGPad +// +// Created by Steven Fusco on 11/28/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import +#import +#import + +@protocol CALayerExporterDelegate; + +@interface CALayerExporter : NSObject +{ + @private + NSMutableDictionary* propertyRegistry; +} + +@property (readwrite,nonatomic,retain) UIView* rootView; +@property (readwrite,nonatomic,assign) id delegate; + +- (CALayerExporter*) initWithView:(UIView*)v; +- (void) startExport; + +@end + + +@protocol CALayerExporterDelegate + +- (void) layerExporter:(CALayerExporter*)exporter didParseLayer:(CALayer*)layer withStatement:(NSString*)statement; + +@optional + +- (void) layerExporterDidFinish:(CALayerExporter*)exporter; + +@end diff --git a/Source/iOS/CALayerExporter.m b/Source/iOS/CALayerExporter.m new file mode 100644 index 000000000..5ba04b602 --- /dev/null +++ b/Source/iOS/CALayerExporter.m @@ -0,0 +1,283 @@ +// +// CALayerExporter.m +// SVGPad +// +// Created by Steven Fusco on 11/28/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import "CALayerExporter.h" + +typedef struct ExportPathCommandsContext { + NSString* pathName; + NSMutableString* pathCommands; +} ExportPathCommandsContext; + +void exportPathCommands(void *exportPathCommandsConextPtr, const CGPathElement *element) +{ + ExportPathCommandsContext* ctx = (ExportPathCommandsContext*) exportPathCommandsConextPtr; + NSMutableString* pathCommands = ctx->pathCommands; + NSString* pathName = ctx-> pathName; + CGPoint* pathPoints = element->points; + switch (element->type) { + case kCGPathElementMoveToPoint: + [pathCommands appendFormat:@"\nCGPathMoveToPoint(%@, NULL, %f, %f);", pathName, pathPoints[0].x, pathPoints[0].y]; + break; + case kCGPathElementAddLineToPoint: + [pathCommands appendFormat:@"\nCGPathAddLineToPoint(%@, NULL, %f, %f);", pathName, pathPoints[0].x, pathPoints[0].y]; + break; + case kCGPathElementAddQuadCurveToPoint: + { + CGFloat cpx = pathPoints[0].x; + CGFloat cpy = pathPoints[0].y; + CGFloat x = pathPoints[1].x; + CGFloat y = pathPoints[1].y; + [pathCommands appendFormat:@"\nCGPathAddQuadCurveToPoint(%@, NULL, %f, %f, %f, %f);", pathName, cpx, cpy, x, y]; + } + break; + case kCGPathElementAddCurveToPoint: + { + CGFloat cp1x = pathPoints[0].x; + CGFloat cp1y = pathPoints[0].y; + CGFloat cp2x = pathPoints[1].x; + CGFloat cp2y = pathPoints[1].y; + CGFloat x = pathPoints[2].x; + CGFloat y = pathPoints[2].y; + [pathCommands appendFormat:@"\nCGPathAddCurveToPoint(%@, NULL, %f, %f, %f, %f, %f, %f);", pathName, cp1x, cp1y, cp2x, cp2y, x, y]; + } + break; + case kCGPathElementCloseSubpath: + [pathCommands appendFormat:@"\nCGPathCloseSubpath(%@);", pathName]; + break; + + default: + break; + } +} + +@interface CALayerExporter(Private) + +- (void)processLayer:(CALayer *)currentLayer index:(NSInteger)index parent:(NSString*)parentName; + +@end + + +@implementation CALayerExporter + +@synthesize delegate; +@synthesize rootView; + +- (id)initWithView:(UIView*)v +{ + self = [super init]; + if (self) { + self.rootView = v; + + propertyRegistry = [[NSMutableDictionary dictionary] retain]; + + NSArray* CALayerProperties = [NSArray arrayWithObjects:@"name", @"bounds", @"frame", nil]; + [propertyRegistry setObject:CALayerProperties + forKey:NSStringFromClass([CALayer class])]; + + NSArray* CAShapeLayerProperties = [NSArray arrayWithObjects:@"path", @"fillColor", @"fillRule", @"strokeColor", @"lineWidth", @"miterLimit", @"lineCap", @"lineJoin", @"lineDashPhase", @"lineDashPattern", nil]; + [propertyRegistry setObject:CAShapeLayerProperties + forKey:NSStringFromClass([CAShapeLayer class])]; + } + return self; +} + +- (void)dealloc { + [rootView release]; + [super dealloc]; +} + +- (void)startExport +{ + if (nil == rootView) { + return; + } + + [self processLayer:self.rootView.layer index:0 parent:@"root"]; + + if ([self.delegate respondsToSelector:@selector(layerExporterDidFinish:)]) { + [self.delegate layerExporterDidFinish:self]; + } +} + +- (void)processLayer:(CALayer *)currentLayer index:(NSInteger)index parent:(NSString*)parentName +{ + NSString* className = NSStringFromClass([currentLayer class]); + NSString* layerName = [NSString stringWithFormat:@"%@_layer%d", parentName, index]; + NSString* createStatement = [NSString stringWithFormat:@"%@* %@ = [[%@ alloc] init];", className, layerName, className]; + + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:createStatement]; + + for (NSString* registeredClassName in [propertyRegistry allKeys]) { + + Class registeredClass = NSClassFromString(registeredClassName); + if ([currentLayer isKindOfClass:registeredClass]) { + + for (NSString* propertyName in [propertyRegistry objectForKey:registeredClassName]) { + + SEL message = NSSelectorFromString(propertyName); + + NSMethodSignature* methodSig = [currentLayer methodSignatureForSelector:message]; + + NSString* propertyValue = nil; + const char * methodReturnType = [methodSig methodReturnType]; + + if (0 == strcmp("@", methodReturnType)) { + + id v = [currentLayer performSelector:message]; + + if (nil == v) { + propertyValue = @"nil"; + } else if ([v isKindOfClass:[NSString class]]) { + propertyValue = [NSString stringWithFormat:@"@\"%@\"", v]; + } else { + propertyValue = NSStringFromClass([v class]); + } + } else { + NSInvocation *inv = [NSInvocation invocationWithMethodSignature:methodSig]; + [inv setSelector:message]; + [inv setTarget:currentLayer]; + [inv invoke]; + + if (0 == strcmp("f", methodReturnType)) { + float r; + [inv getReturnValue:&r]; + propertyValue = [NSString stringWithFormat:@"%f", r]; + } else if (0 == strcmp("{CGRect={CGPoint=ff}{CGSize=ff}}", methodReturnType)) { + CGRect r; + [inv getReturnValue:&r]; + propertyValue = [NSString stringWithFormat:@"CGRectMake(%f, %f, %f, %f)", r.origin.x, r.origin.y, r.size.width, r.size.height]; + } else if (0 == strcmp("^{CGColor=}", methodReturnType)) { + + CGColorRef color; + [inv getReturnValue:&color]; + + if (0 == color) { + propertyValue = @"0"; + } else { + NSString* colorName = [NSString stringWithFormat:@"%@_%@_colorref", layerName, propertyName]; + NSString* spaceName = [colorName stringByAppendingString:@"_colorSpace"]; + NSString* componentsName = [colorName stringByAppendingString:@"_colorComponents"]; + + CGColorSpaceRef colorSpace = CGColorGetColorSpace(color); + + NSMutableString* colorSpaceCreateStatement = [NSMutableString stringWithFormat:@"CGColorSpaceRef %@ = ", spaceName]; + + CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace); + switch (colorSpaceModel) { + case kCGColorSpaceModelMonochrome: + [colorSpaceCreateStatement appendString:@"CGColorSpaceCreateDeviceGray();"]; + break; + case kCGColorSpaceModelRGB: + [colorSpaceCreateStatement appendString:@"CGColorSpaceCreateDeviceRGB();"]; + break; + case kCGColorSpaceModelCMYK: + [colorSpaceCreateStatement appendString:@"CGColorSpaceCreateDeviceCMYK();"]; + break; + case kCGColorSpaceModelLab: + // CGColorSpaceCreateLab(<#const CGFloat *whitePoint#>, <#const CGFloat *blackPoint#>, <#const CGFloat *range#>) + break; + case kCGColorSpaceModelDeviceN: + // CGColorSpaceCreateWithICCProfile(<#CFDataRef data#>) + break; + case kCGColorSpaceModelIndexed: + // CGColorSpaceCreateIndexed(<#CGColorSpaceRef baseSpace#>, <#size_t lastIndex#>, <#const unsigned char *colorTable#>) + break; + case kCGColorSpaceModelPattern: + // CGColorSpaceCreatePattern(<#CGColorSpaceRef baseSpace#>) + break; + default: + break; + } + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:colorSpaceCreateStatement]; + + const CGFloat* colorComponents = CGColorGetComponents(color); + size_t colorComponentsCount = CGColorGetNumberOfComponents(color); + NSMutableString* colorComponentsCreateStatement = [NSMutableString stringWithFormat:@"CGFloat %@[] = ", componentsName]; + [colorComponentsCreateStatement appendString:@"{"]; + for (int i=0; i != colorComponentsCount; ++i) { + [colorComponentsCreateStatement appendFormat:@"%@%f", ((i != 0) ? @"," : @""), colorComponents[i]]; + } + [colorComponentsCreateStatement appendString:@"};"]; + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:colorComponentsCreateStatement]; + + NSString* colorCreateStatement = [NSString stringWithFormat:@"CGColorRef %@ = CGColorCreate(%@, %@);", colorName, spaceName, componentsName]; + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:colorCreateStatement]; + + propertyValue = colorName; + } + + } else if (0 == strcmp("^{CGPath=}", methodReturnType)) { + CGPathRef path; + [inv getReturnValue:&path]; + + if (0 == path) { + propertyValue = @"0"; + } else { + + NSString* pathName = [NSString stringWithFormat:@"%@_%@_pathref", layerName, propertyName]; + NSString* pathCreateStatement = [NSString stringWithFormat:@"CGMutablePathRef %@ = CGPathCreateMutable();", pathName]; + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:pathCreateStatement]; + + NSMutableString* pathCommands = [NSMutableString string]; + ExportPathCommandsContext exportPathContext; + exportPathContext.pathName = pathName; + exportPathContext.pathCommands = pathCommands; + + CGPathApply(path, &exportPathContext, exportPathCommands); + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:pathCommands]; + + propertyValue = pathName; + } + } else { + propertyValue = [NSString stringWithCString:methodReturnType encoding:NSUTF8StringEncoding]; + } + } + + NSString* propertyAssignmentStatement = [NSString stringWithFormat:@"%@.%@ = %@;", layerName, propertyName, propertyValue]; + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:propertyAssignmentStatement]; + } + } + } + + + NSString* addSublayerStatement = [NSString stringWithFormat:@"[%@ addSublayer:%@];", parentName, layerName]; + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:addSublayerStatement]; + + NSString* releaseStatement = [NSString stringWithFormat:@"[%@ release];", layerName]; + [self.delegate layerExporter:self + didParseLayer:currentLayer + withStatement:releaseStatement]; + + int i = index; + for (CALayer* childLayer in currentLayer.sublayers) { + [self processLayer:childLayer index:++i parent:layerName]; + } +} + + + + + +@end + diff --git a/iOS/CALayerWithChildHitTest.h b/Source/iOS/CALayerWithChildHitTest.h similarity index 100% rename from iOS/CALayerWithChildHitTest.h rename to Source/iOS/CALayerWithChildHitTest.h diff --git a/iOS/CALayerWithChildHitTest.m b/Source/iOS/CALayerWithChildHitTest.m similarity index 50% rename from iOS/CALayerWithChildHitTest.m rename to Source/iOS/CALayerWithChildHitTest.m index 2419b8dd5..a35d20f83 100644 --- a/iOS/CALayerWithChildHitTest.m +++ b/Source/iOS/CALayerWithChildHitTest.m @@ -2,8 +2,6 @@ // CALayerWithChildHitTest.m // SVGKit // -// Created by adam on 27/11/2011. -// Copyright 2011 __MyCompanyName__. All rights reserved. // #import "CALayerWithChildHitTest.h" @@ -12,7 +10,7 @@ @implementation CALayerWithChildHitTest - (BOOL) containsPoint:(CGPoint)p { - BOOL boundsContains = CGRectContainsPoint(self.bounds, p); + BOOL boundsContains = CGRectContainsPoint(self.bounds, p); // must be BOUNDS because Apple pre-converts the point to local co-ords before running the test if( boundsContains ) { @@ -20,7 +18,11 @@ - (BOOL) containsPoint:(CGPoint)p for( CALayer* subLayer in self.sublayers ) { - if( [subLayer containsPoint:p] ) + // must pre-convert the point to local co-ords before running the test because Apple defines "containsPoint" in that fashion + + CGPoint pointInSubLayer = [self convertPoint:p toLayer:subLayer]; + + if( [subLayer containsPoint:pointInSubLayer] ) { atLeastOneChildContainsPoint = TRUE; break; diff --git a/iOS/CAShapeLayerWithHitTest.h b/Source/iOS/CAShapeLayerWithHitTest.h similarity index 100% rename from iOS/CAShapeLayerWithHitTest.h rename to Source/iOS/CAShapeLayerWithHitTest.h diff --git a/iOS/CAShapeLayerWithHitTest.m b/Source/iOS/CAShapeLayerWithHitTest.m similarity index 64% rename from iOS/CAShapeLayerWithHitTest.m rename to Source/iOS/CAShapeLayerWithHitTest.m index 7787c66d5..a6326a5aa 100644 --- a/iOS/CAShapeLayerWithHitTest.m +++ b/Source/iOS/CAShapeLayerWithHitTest.m @@ -9,19 +9,22 @@ @implementation CAShapeLayerWithHitTest - (BOOL) containsPoint:(CGPoint)p { - //BOOL frameContains = CGRectContainsPoint(self.frame, p); - BOOL boundsContains = CGRectContainsPoint(self.bounds, p); - BOOL pathContains = CGPathContainsPoint(self.path, NULL, p, false); + BOOL boundsContains = CGRectContainsPoint(self.bounds, p); // must be BOUNDS because Apple pre-converts the point to local co-ords before running the test - if( boundsContains && pathContains ) + if( boundsContains ) { + BOOL pathContains = CGPathContainsPoint(self.path, NULL, p, false); + + if( pathContains ) + { for( CALayer* subLayer in self.sublayers ) { NSLog(@"...contains point, Apple will now check sublayer: %@", subLayer); } - return TRUE; + return TRUE; + } } - return NO; + return FALSE; } @end diff --git a/XCodeProjectData/SVGKit-iOS/SVGKit-iOS-Prefix.pch b/XCodeProjectData/SVGKit-iOS/SVGKit-iOS-Prefix.pch new file mode 100644 index 000000000..fea0b09c5 --- /dev/null +++ b/XCodeProjectData/SVGKit-iOS/SVGKit-iOS-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'SVGKit-iOS' target in the 'SVGKit-iOS' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/XCodeProjectData/iOSDemo/AppDelegate.h b/XCodeProjectData/iOSDemo/AppDelegate.h new file mode 100644 index 000000000..c3e84be58 --- /dev/null +++ b/XCodeProjectData/iOSDemo/AppDelegate.h @@ -0,0 +1,19 @@ +// +// AppDelegate.h +// iOSDemo +// +// Created by adam on 29/09/2012. +// Copyright (c) 2012 na. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@property (strong, nonatomic) UINavigationController *navigationController; + +@property (strong, nonatomic) UISplitViewController *splitViewController; + +@end diff --git a/XCodeProjectData/iOSDemo/AppDelegate.m b/XCodeProjectData/iOSDemo/AppDelegate.m new file mode 100644 index 000000000..7ed9e507b --- /dev/null +++ b/XCodeProjectData/iOSDemo/AppDelegate.m @@ -0,0 +1,88 @@ +// +// AppDelegate.m +// iOSDemo +// +// Created by adam on 29/09/2012. +// Copyright (c) 2012 na. All rights reserved. +// + +#import "AppDelegate.h" + +#import "MasterViewController.h" + +#import "DetailViewController.h" + +@implementation AppDelegate + +- (void)dealloc +{ + [_window release]; + [_navigationController release]; + [_splitViewController release]; + [super dealloc]; +} + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; + // Override point for customization after application launch. + if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { + MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController_iPhone" bundle:nil] autorelease]; + self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease]; + self.window.rootViewController = self.navigationController; + } else { + MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController_iPad" bundle:nil] autorelease]; + UINavigationController *masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease]; + + /** + ADAM: NB: I had to rename the XIB file. + + Apple is so bad at testing, Xcode 4.5 apparently re-introduces several regression bugs + that are 2-3 years old, where it overwrites new files with the contents of + old files at build time, and it is impossible to get it to use the real file. + + Even restarting didn't fix Xcode, but renaming the file does. + */ + DetailViewController *detailViewController = [[[DetailViewController alloc] initWithNibName:@"iPadDetailViewController" bundle:nil] autorelease]; + UINavigationController *detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease]; + + masterViewController.detailViewController = detailViewController; + + self.splitViewController = [[[UISplitViewController alloc] init] autorelease]; + self.splitViewController.delegate = detailViewController; + self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController]; + + self.window.rootViewController = self.splitViewController; + } + [self.window makeKeyAndVisible]; + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/XCodeProjectData/iOSDemo/DetailViewController.h b/XCodeProjectData/iOSDemo/DetailViewController.h new file mode 100644 index 000000000..e8029caba --- /dev/null +++ b/XCodeProjectData/iOSDemo/DetailViewController.h @@ -0,0 +1,34 @@ +// +// DetailViewController.h +// iOSDemo +// +// Created by adam on 29/09/2012. +// Copyright (c) 2012 na. All rights reserved. +// + +#import + +#import "SVGKit.h" +#import "CALayerExporter.h" +#import "SVGKImage.h" + +@interface DetailViewController : UIViewController < UIPopoverControllerDelegate, UISplitViewControllerDelegate , CALayerExporterDelegate, UIScrollViewDelegate> + +@property (nonatomic, retain) NSString *name; +@property (nonatomic, retain) UITextView* exportText; +@property (nonatomic, retain) NSMutableString* exportLog; +@property (nonatomic, retain) CALayerExporter* layerExporter; + +@property (nonatomic, retain) IBOutlet UIToolbar *toolbar; +@property (nonatomic, retain) IBOutlet UIScrollView *scrollViewForSVG; +@property (nonatomic, retain) IBOutlet SVGKImageView *contentView; +@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *viewActivityIndicator; + +@property (nonatomic, retain) id detailItem; + +- (IBAction)animate:(id)sender; +- (IBAction)exportLayers:(id)sender; + +- (IBAction) showHideBorder:(id)sender; + +@end diff --git a/XCodeProjectData/iOSDemo/DetailViewController.m b/XCodeProjectData/iOSDemo/DetailViewController.m new file mode 100644 index 000000000..de111ebad --- /dev/null +++ b/XCodeProjectData/iOSDemo/DetailViewController.m @@ -0,0 +1,331 @@ +// +// DetailViewController.m +// iOSDemo +// +// Created by adam on 29/09/2012. +// Copyright (c) 2012 na. All rights reserved. +// +#import "DetailViewController.h" + +#import "MasterViewController.h" + +#import "NodeList+Mutable.h" + +#import "SVGKFastImageView.h" + +@interface DetailViewController () + +@property (nonatomic, retain) UIPopoverController *popoverController; + +- (void)loadResource:(NSString *)name; +- (void)shakeHead; + +@end + + +@implementation DetailViewController +@synthesize scrollViewForSVG; + +@synthesize toolbar, popoverController, contentView, detailItem; +@synthesize viewActivityIndicator; + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + } + return self; +} + +- (void)dealloc { + self.popoverController = nil; + self.toolbar = nil; + self.detailItem = nil; + + self.name = nil; + self.exportText = nil; + self.exportLog = nil; + self.layerExporter = nil; + self.scrollViewForSVG = nil; + self.contentView = nil; + self.viewActivityIndicator = nil; + + [super dealloc]; +} + +-(void)viewDidLoad +{ + self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects: + [[[UIBarButtonItem alloc] initWithTitle:@"Debug" style:UIBarButtonItemStyleBordered target:self action:@selector(showHideBorder:)] autorelease], + [[[UIBarButtonItem alloc] initWithTitle:@"Animate" style:UIBarButtonItemStyleBordered target:self action:@selector(animate:)] autorelease], + nil]; +} + +#pragma mark - CRITICAL: this method makes Apple render SVGs in sharp focus + +-(void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)finalScale +{ + /** NB: very important! The "finalScale" paramter to this method is SLIGHTLY DIFFERENT from the scale that Apple reports in the other delegate methods + + This is very confusing, clearly it's bit of a hack - the other methods get called + at slightly the wrong time, and so their data is slightly wrong (out-by-one animation step). + + ONLY the values passed as params to this method are correct! + */ + + /** + + Apple's implementation of zooming is EXTREMELY poorly designed; it's a hack onto a class + that was only designed to do panning (hence the name: uiSCROLLview) + + So ... "zooming" via a UIScrollView is NOT integrated with UIView + rendering - in a UIView subclass, you CANNOT KNOW whether you have been "zoomed" + (i.e.: had your view contents ruined horribly by Apple's class) + + The three lines that follow are - allegedly - Apple's preferred way of handling + the situation. Note that we DO NOT SET view.frame! According to official docs, + view.frame is UNDEFINED (this is very worrying, breaks a huge amount of UIKit-related code, + but that's how Apple has documented / implemented it!) + */ + view.transform = CGAffineTransformIdentity; // this alters view.frame! But *not* view.bounds + view.bounds = CGRectApplyAffineTransform( view.bounds, CGAffineTransformMakeScale(finalScale, finalScale)); + [view setNeedsDisplay]; + + /** + Workaround for another bug in Apple's hacks for UIScrollView: + + - when you reset the transform, as advised by Apple, you "break" Apple's memory of the scroll factor. + ... because they "forgot" to store it anywhere (they read your view.transform as if it were a private + variable inside UIScrollView! This causes MANY bugs in applications :( ) + */ + self.scrollViewForSVG.minimumZoomScale /= finalScale; + self.scrollViewForSVG.maximumZoomScale /= finalScale; +} + +#pragma mark - rest of class + +- (void)setDetailItem:(id)newDetailItem { + if (detailItem != newDetailItem) { + [detailItem release]; + detailItem = [newDetailItem retain]; + + // FIXME: re-write this class so that this method does NOT require self.view to exist + [self view]; // Apple's design to trigger the creation of view. Original design of THIS class is that it breaks if view isn't already existing + [self loadResource:newDetailItem]; + } + + if (self.popoverController) { + [self.popoverController dismissPopoverAnimated:YES]; + } +} + +- (void)loadResource:(NSString *)name +{ + [self.viewActivityIndicator startAnimating]; + [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; // makes the animation appear + + [self.contentView removeFromSuperview]; + + SVGKImage *document = nil; + /** Detect URL vs file */ + if( [name hasPrefix:@"http://"]) + { + document = [SVGKImage imageWithContentsOfURL:[NSURL URLWithString:name]]; + } + else + document = [SVGKImage imageNamed:[name stringByAppendingPathExtension:@"svg"]]; + + + + if( document == nil ) + { + [[[[UIAlertView alloc] initWithTitle:@"SVG parse failed" message:@"Total failure. See console log" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease] show]; + } + else + { + if( document.parseErrorsAndWarnings.rootOfSVGTree != nil ) + { + NSLog(@"[%@] Freshly loaded document (name = %@) has size = %@", [self class], name, NSStringFromCGSize(document.size) ); + + if( [name isEqualToString:@"Monkey"]) + { + /** + + NB: very special-case handling here -- this is included AS AN EXAMPLE so you can see the differences. + + The problem: Apple's code doesn't allow us to support CoreAnimation *and* make image loading easy. + The solution: there are two versions of SVGKImageView - a "normal" one, and a "weaker one that supports CoreAnimation" + + In this demo, we setup the Monkey.SVG to allow layer-based animation... + */ + + self.contentView = [[[SVGKLayeredImageView alloc] initWithSVGKImage:document] autorelease]; + } + else + { + self.contentView = [[[SVGKFastImageView alloc] initWithSVGKImage:document] autorelease]; + + NSLog(@"[%@] WARNING: workaround for Apple bugs: UIScrollView spams tiny changes to the transform to the content view; currently, we have NO WAY of efficiently measuring whether or not to re-draw the SVGKImageView. As a temporary solution, we are DISABLING the SVGKImageView's auto-redraw-at-higher-resolution code - in general, you do NOT want to do this", [self class]); + + ((SVGKFastImageView*)self.contentView).disableAutoRedrawAtHighestResolution = TRUE; + } + self.contentView.showBorder = FALSE; + + if (_name) { + [_name release]; + _name = nil; + } + + _name = [name copy]; + + [self.scrollViewForSVG addSubview:self.contentView]; + [self.scrollViewForSVG setContentSize: self.contentView.frame.size]; + + float screenToDocumentSizeRatio = self.scrollViewForSVG.frame.size.width / self.contentView.frame.size.width; + + self.scrollViewForSVG.minimumZoomScale = MIN( 1, screenToDocumentSizeRatio ); + self.scrollViewForSVG.maximumZoomScale = MAX( 1, screenToDocumentSizeRatio ); + + NodeList* elementsUsingTagG = [document.DOMDocument getElementsByTagName:@"g"]; + NSLog( @"[%@] checking for SVG standard set of elements with XML tag/node of : %@", [self class], elementsUsingTagG.internalArray ); + } + else + { + [[[[UIAlertView alloc] initWithTitle:@"SVG parse failed" message:[NSString stringWithFormat:@"%i fatal errors, %i warnings. First fatal = %@",[document.parseErrorsAndWarnings.errorsFatal count],[document.parseErrorsAndWarnings.errorsRecoverable count]+[document.parseErrorsAndWarnings.warnings count], ((NSError*)[document.parseErrorsAndWarnings.errorsFatal objectAtIndex:0]).localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease] show]; + } + } + + [self.viewActivityIndicator stopAnimating]; +} + +- (IBAction)animate:(id)sender { + if ([_name isEqualToString:@"Monkey"]) { + [self shakeHead]; + } +} + + +- (void)shakeHead { + CALayer *layer = [self.contentView.image layerWithIdentifier:@"head"]; + + CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; + animation.duration = 0.25f; + animation.autoreverses = YES; + animation.repeatCount = 100000; + animation.fromValue = [NSNumber numberWithFloat:0.1f]; + animation.toValue = [NSNumber numberWithFloat:-0.1f]; + + [layer addAnimation:animation forKey:@"shakingHead"]; +} + +- (IBAction) showHideBorder:(id)sender +{ + self.contentView.showBorder = ! self.contentView.showBorder; + + /** + NB: normally, the following would NOT be needed - the SVGKImageView would automatically + detect it needs to be re-drawn. + + But ... because we're doing zooming in this class, and Apple's zooming causes huge performance problems, + we disabled the auto-redraw in the loadResource: method above. + + So, now, we have to manually tell the SVGKImageView to redraw + */ + [self.contentView setNeedsDisplay]; +} + +- (void)splitViewController:(UISplitViewController *)svc + willHideViewController:(UIViewController *)aViewController + withBarButtonItem:(UIBarButtonItem *)barButtonItem + forPopoverController:(UIPopoverController *)pc { + + barButtonItem.title = @"Samples"; + + NSMutableArray *items = [[toolbar items] mutableCopy]; + [items insertObject:barButtonItem atIndex:0]; + + [toolbar setItems:items animated:YES]; + [items release]; + + self.popoverController = pc; +} + +- (void)splitViewController:(UISplitViewController *)svc + willShowViewController:(UIViewController *)aViewController + invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem { + + NSMutableArray *items = [[toolbar items] mutableCopy]; + [items removeObjectAtIndex:0]; + + [toolbar setItems:items animated:YES]; + [items release]; + + self.popoverController = nil; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return YES; +} + +- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView +{ + return self.contentView; +} + +#pragma mark Export + + +- (IBAction)exportLayers:(id)sender { + if (_layerExporter) { + return; + } + _layerExporter = [[CALayerExporter alloc] initWithView:contentView]; + _layerExporter.delegate = self; + + UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)]; + UIViewController* textViewController = [[[UIViewController alloc] init] autorelease]; + [textViewController setView:textView]; + UIPopoverController* exportPopover = [[UIPopoverController alloc] initWithContentViewController:textViewController]; + [exportPopover setDelegate:self]; + [exportPopover presentPopoverFromBarButtonItem:sender + permittedArrowDirections:UIPopoverArrowDirectionAny + animated:YES]; + + _exportText = textView; + _exportText.text = @"exporting..."; + + _exportLog = [[NSMutableString alloc] init]; + [_layerExporter startExport]; +} + +- (void) layerExporter:(CALayerExporter*)exporter didParseLayer:(CALayer*)layer withStatement:(NSString*)statement +{ + //NSLog(@"%@", statement); + [_exportLog appendString:statement]; + [_exportLog appendString:@"\n"]; +} + +- (void)layerExporterDidFinish:(CALayerExporter *)exporter +{ + _exportText.text = _exportLog; +} + +- (void)popoverControllerDidDismissPopover:(UIPopoverController *)pc +{ + [_exportText release]; + _exportText = nil; + + [_layerExporter release]; + _layerExporter = nil; + + [pc release]; +} + + +- (void)viewDidUnload { + [super viewDidUnload]; +} + + + +@end diff --git a/XCodeProjects/SVGPadDemo/Classes/RootViewController.h b/XCodeProjectData/iOSDemo/MasterViewController.h similarity index 65% rename from XCodeProjects/SVGPadDemo/Classes/RootViewController.h rename to XCodeProjectData/iOSDemo/MasterViewController.h index 6cd774e53..a1b67b467 100644 --- a/XCodeProjects/SVGPadDemo/Classes/RootViewController.h +++ b/XCodeProjectData/iOSDemo/MasterViewController.h @@ -7,10 +7,9 @@ @class DetailViewController; -@interface RootViewController : UITableViewController { - @private - NSArray *_sampleNames; -} +@interface MasterViewController : UITableViewController + +@property(nonatomic,retain) NSMutableArray *sampleNames; @property (nonatomic, retain) IBOutlet DetailViewController *detailViewController; diff --git a/XCodeProjectData/iOSDemo/MasterViewController.m b/XCodeProjectData/iOSDemo/MasterViewController.m new file mode 100644 index 000000000..94b17bbcf --- /dev/null +++ b/XCodeProjectData/iOSDemo/MasterViewController.m @@ -0,0 +1,98 @@ +// +// RootViewController.m +// SVGPad +// +// Copyright Matt Rajca 2010-2011. All rights reserved. +// + +#import "MasterViewController.h" + +#import "DetailViewController.h" + +@implementation MasterViewController + +@synthesize sampleNames = _sampleNames; +@synthesize detailViewController = _detailViewController; + +- (id)init +{ + if (self) { + self.sampleNames = [NSMutableArray arrayWithObjects: @"http://upload.wikimedia.org/wikipedia/commons/f/f9/BlankMap-Africa.svg", @"australia_states_blank", @"Reinel_compass_rose", @"Monkey", @"Blank_Map-Africa", @"Note", @"imageWithASinglePointPath", @"Lion", @"Map", @"CurvedDiamond", @"Text", @"Location_European_nation_states", @"uk-only", @"Europe_states_reduced", @"Compass_rose_pale", @"MathCurve", @"voies", nil]; + } + + /** Apple really sucks. They keep randomly changing which init methods they call, BREAKING ALL EXISTING CODE */ + return nil; +} + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + [self init]; + } + return self; +} +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (self) { + [self init]; + } + return self; +} + +- (void)dealloc { + [_detailViewController release]; + [_sampleNames release]; + + [super dealloc]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.clearsSelectionOnViewWillAppear = NO; + self.contentSizeForViewInPopover = CGSizeMake(320.0f, 600.0f); +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return YES; +} + +- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section { + return [_sampleNames count]; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + + if (!cell) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:CellIdentifier] autorelease]; + } + + cell.textLabel.text = [_sampleNames objectAtIndex:indexPath.row]; + + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + if( [[_sampleNames objectAtIndex:indexPath.row] isEqualToString:@"Reinel_compass_rose"]) + { + NSLog(@"*****************\n* WARNING\n*\n* The sample 'Reinel_compass_rose' is currently unsupported;\n* it is included in this build so that people working on it can test it and see if it works yet\n*\n*\n*****************"); + } + + if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { + if (!self.detailViewController) { + self.detailViewController = [[[DetailViewController alloc] initWithNibName:@"iPhoneDetailViewController" bundle:nil] autorelease]; + } + [self.navigationController pushViewController:self.detailViewController animated:YES]; + self.detailViewController.detailItem = [_sampleNames objectAtIndex:indexPath.row]; + } else { + self.detailViewController.detailItem = [_sampleNames objectAtIndex:indexPath.row]; + } +} + +@end diff --git a/XCodeProjectData/iOSDemo/en.lproj/InfoPlist.strings b/XCodeProjectData/iOSDemo/en.lproj/InfoPlist.strings new file mode 100644 index 000000000..477b28ff8 --- /dev/null +++ b/XCodeProjectData/iOSDemo/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/XCodeProjectData/iOSDemo/en.lproj/MasterViewController_iPad.xib b/XCodeProjectData/iOSDemo/en.lproj/MasterViewController_iPad.xib new file mode 100644 index 000000000..3374145cc --- /dev/null +++ b/XCodeProjectData/iOSDemo/en.lproj/MasterViewController_iPad.xib @@ -0,0 +1,227 @@ + + + + 1536 + 12C54 + 2840 + 1187.34 + 625.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 1926 + + + IBProxyObject + IBUITableView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 274 + {{0, 20}, {320, 832}} + + + + 3 + MQA + + YES + + 2 + + + IBUISplitViewMasterSimulatedSizeMetrics + + YES + + + + + + {320, 852} + {320, 768} + + + IBIPadFramework + Master + IBUISplitViewController + + IBUISplitViewControllerContentSizeLocation + IBUISplitViewControllerContentSizeLocationMaster + + + IBIPadFramework + YES + 1 + 0 + YES + 44 + 22 + 22 + + + + + + + view + + + + 3 + + + + dataSource + + + + 4 + + + + delegate + + + + 5 + + + + + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + + + + + MasterViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 5 + + + + + DetailViewController + UIViewController + + id + id + + + + animate: + id + + + exportLayers: + id + + + + SVGKImageView + UIScrollView + UIToolbar + UIActivityIndicatorView + + + + contentView + SVGKImageView + + + scrollViewForSVG + UIScrollView + + + toolbar + UIToolbar + + + viewActivityIndicator + UIActivityIndicatorView + + + + IBProjectSource + ./Classes/DetailViewController.h + + + + MasterViewController + UITableViewController + + detailViewController + DetailViewController + + + detailViewController + + detailViewController + DetailViewController + + + + IBProjectSource + ./Classes/MasterViewController.h + + + + SVGKImageView + UIView + + IBProjectSource + ./Classes/SVGKImageView.h + + + + + 0 + IBIPadFramework + YES + 3 + 1926 + + diff --git a/XCodeProjectData/iOSDemo/en.lproj/MasterViewController_iPhone.xib b/XCodeProjectData/iOSDemo/en.lproj/MasterViewController_iPhone.xib new file mode 100644 index 000000000..cf8d86b84 --- /dev/null +++ b/XCodeProjectData/iOSDemo/en.lproj/MasterViewController_iPhone.xib @@ -0,0 +1,221 @@ + + + + 1536 + 12C54 + 2840 + 1187.34 + 625.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 1926 + + + IBProxyObject + IBUITableView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {{0, 20}, {320, 548}} + + + + 3 + MQA + + YES + + + IBUIScreenMetrics + + YES + + + + + + {320, 568} + {568, 320} + + + IBCocoaTouchFramework + Retina 4 Full Screen + 2 + + IBCocoaTouchFramework + YES + 1 + 0 + YES + 44 + 22 + 22 + + + + + + + view + + + + 3 + + + + dataSource + + + + 4 + + + + delegate + + + + 5 + + + + + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + + + + + MasterViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 5 + + + + + DetailViewController + UIViewController + + id + id + + + + animate: + id + + + exportLayers: + id + + + + SVGKImageView + UIScrollView + UIToolbar + UIActivityIndicatorView + + + + contentView + SVGKImageView + + + scrollViewForSVG + UIScrollView + + + toolbar + UIToolbar + + + viewActivityIndicator + UIActivityIndicatorView + + + + IBProjectSource + ./Classes/DetailViewController.h + + + + MasterViewController + UITableViewController + + detailViewController + DetailViewController + + + detailViewController + + detailViewController + DetailViewController + + + + IBProjectSource + ./Classes/MasterViewController.h + + + + SVGKImageView + UIView + + IBProjectSource + ./Classes/SVGKImageView.h + + + + + 0 + IBCocoaTouchFramework + YES + 3 + 1926 + + diff --git a/XCodeProjectData/iOSDemo/en.lproj/iPadDetailViewController.xib b/XCodeProjectData/iOSDemo/en.lproj/iPadDetailViewController.xib new file mode 100644 index 000000000..a87e44950 --- /dev/null +++ b/XCodeProjectData/iOSDemo/en.lproj/iPadDetailViewController.xib @@ -0,0 +1,358 @@ + + + + 1536 + 12B19 + 2840 + 1187 + 624.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 1926 + + + IBProxyObject + IBUIActivityIndicatorView + IBUILabel + IBUIScrollView + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 274 + + + + 274 + + + + 274 + + + + 292 + {{337, 294}, {320, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + Select a sample file from the list on the left + + 1 + MCAwIDAAA + darkTextColor + + + 0 + + 1 + 17 + + + Helvetica + 17 + 16 + + NO + + + + 292 + {{289, 361}, {349, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + (rotate iPad to landscape if you cant see a list) + + + 0 + + + NO + + + {768, 1004} + + + + _NS:9 + + 3 + MC42NjY2NjY2NjY3AA + + IBIPadFramework + + + {768, 1004} + + + + _NS:9 + YES + YES + IBIPadFramework + NO + + + + 292 + {{365, 484}, {37, 37}} + + + + _NS:9 + NO + IBIPadFramework + YES + 0 + + 1 + MC4wMDYxMzA2NzIwMTYgMC4zMDE0NjA1OTc4IDAAA + + + + {{0, 20}, {768, 1004}} + + + + + 3 + MQA + + NO + + 2 + + IBIPadFramework + + + + + + + view + + + + 12 + + + + scrollViewForSVG + + + + 123 + + + + contentView + + + + 125 + + + + viewActivityIndicator + + + + 147 + + + + delegate + + + + 124 + + + + + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 8 + + + + + + + + + 99 + + + + + + + + 108 + + + + + + + + + 126 + + + + + 129 + + + + + 141 + + + + + + + DetailViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + SVGKFastImageView + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 147 + + + + + DetailViewController + UIViewController + + id + id + id + + + + animate: + id + + + exportLayers: + id + + + showHideBorder: + id + + + + SVGKImageView + UIScrollView + UIToolbar + UIActivityIndicatorView + + + + contentView + SVGKImageView + + + scrollViewForSVG + UIScrollView + + + toolbar + UIToolbar + + + viewActivityIndicator + UIActivityIndicatorView + + + + IBProjectSource + ./Classes/DetailViewController.h + + + + SVGKFastImageView + SVGKImageView + + IBProjectSource + ./Classes/SVGKFastImageView.h + + + + SVGKImageView + UIView + + IBProjectSource + ./Classes/SVGKImageView.h + + + + + 0 + IBIPadFramework + YES + 3 + 1926 + + diff --git a/XCodeProjectData/iOSDemo/en.lproj/iPhoneDetailViewController.xib b/XCodeProjectData/iOSDemo/en.lproj/iPhoneDetailViewController.xib new file mode 100644 index 000000000..8c546c33a --- /dev/null +++ b/XCodeProjectData/iOSDemo/en.lproj/iPhoneDetailViewController.xib @@ -0,0 +1,276 @@ + + + + 1536 + 12B19 + 2840 + 1187 + 624.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 1926 + + + IBProxyObject + IBUIActivityIndicatorView + IBUILabel + IBUIScrollView + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + + + 274 + + + + 274 + + + + 292 + {{71, 200}, {179, 21}} + + + _NS:9 + NO + YES + 7 + NO + IBCocoaTouchFramework + Loading, please wait + + 1 + MCAwIDAAA + darkTextColor + + + 0 + + 1 + 17 + + + Helvetica + 17 + 16 + + NO + + + {320, 504} + + + _NS:9 + + 3 + MC42NjY2NjY2NjY3AA + + IBCocoaTouchFramework + + + {320, 504} + + + _NS:9 + YES + YES + + IBUIScreenMetrics + + YES + + + + + + {320, 568} + {568, 320} + + + IBCocoaTouchFramework + Retina 4 Full Screen + 2 + + IBCocoaTouchFramework + NO + + + + 292 + {{141, 256}, {37, 37}} + + _NS:9 + NO + IBCocoaTouchFramework + YES + 0 + + 1 + MC4wMDYxMzA2NzIwMTYgMC4zMDE0NjA1OTc4IDAAA + + + + {{0, 64}, {320, 504}} + + + + 3 + MQA + + 2 + + + + + NO + + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + contentView + + + + 43 + + + + scrollViewForSVG + + + + 44 + + + + viewActivityIndicator + + + + 48 + + + + delegate + + + + 65 + + + + + + 0 + + + + + + 1 + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 25 + + + + + + + + 26 + + + + + + + + 38 + + + + + + 45 + + + + + + + DetailViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + SVGKFastImageView + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 68 + + + 0 + IBCocoaTouchFramework + YES + 3 + 1926 + + diff --git a/XCodeProjects/SVGPadDemo/SVGPad-Info.plist b/XCodeProjectData/iOSDemo/iOSDemo-Info.plist similarity index 66% rename from XCodeProjects/SVGPadDemo/SVGPad-Info.plist rename to XCodeProjectData/iOSDemo/iOSDemo-Info.plist index c7357da71..af4296405 100644 --- a/XCodeProjects/SVGPadDemo/SVGPad-Info.plist +++ b/XCodeProjectData/iOSDemo/iOSDemo-Info.plist @@ -3,30 +3,39 @@ CFBundleDevelopmentRegion - English + en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} - CFBundleIconFile - CFBundleIdentifier - com.MattRajca.${PRODUCT_NAME:rfc1034identifier} + na.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS - NSMainNibFile - MainWindow + UIRequiredDeviceCapabilities + + armv7 + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortraitUpsideDown + + UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown diff --git a/XCodeProjectData/iOSDemo/iOSDemo-Prefix.pch b/XCodeProjectData/iOSDemo/iOSDemo-Prefix.pch new file mode 100644 index 000000000..e01e0f8f9 --- /dev/null +++ b/XCodeProjectData/iOSDemo/iOSDemo-Prefix.pch @@ -0,0 +1,14 @@ +// +// Prefix header for all source files of the 'iOSDemo' target in the 'iOSDemo' project +// + +#import + +#ifndef __IPHONE_4_0 +#warning "This project uses features only available in iOS SDK 4.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/XCodeProjectData/iOSDemo/main.m b/XCodeProjectData/iOSDemo/main.m new file mode 100644 index 000000000..140a8f314 --- /dev/null +++ b/XCodeProjectData/iOSDemo/main.m @@ -0,0 +1,18 @@ +// +// main.m +// iOSDemo +// +// Created by adam on 29/09/2012. +// Copyright (c) 2012 na. All rights reserved. +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/XCodeProjects/SVGKit/Info.plist b/XCodeProjects/SVGKit/Info.plist deleted file mode 100644 index 43f8a739b..000000000 --- a/XCodeProjects/SVGKit/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.MattRajca.${PRODUCT_NAME:rfc1034Identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - NSPrincipalClass - - - diff --git a/XCodeProjects/SVGKit/SVGKit.xcodeproj/project.pbxproj b/XCodeProjects/SVGKit/SVGKit.xcodeproj/project.pbxproj deleted file mode 100644 index dba1dcb54..000000000 --- a/XCodeProjects/SVGKit/SVGKit.xcodeproj/project.pbxproj +++ /dev/null @@ -1,817 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 3BF5039E148C5FBC00CC7D17 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BF5039D148C5FBC00CC7D17 /* libxml2.dylib */; }; - 3BF503A0148C5FC600CC7D17 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BF5039F148C5FC600CC7D17 /* UIKit.framework */; }; - 3BF503A2148C5FCE00CC7D17 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BF503A1148C5FCE00CC7D17 /* CoreGraphics.framework */; }; - 3BF503A4148C5FD400CC7D17 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BF503A3148C5FD400CC7D17 /* QuartzCore.framework */; }; - 3BF503A5148C612100CC7D17 /* CAShapeLayerWithHitTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213548148AF80A006881E1 /* CAShapeLayerWithHitTest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3BF503A6148C612F00CC7D17 /* CAShapeLayerWithHitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66213549148AF80A006881E1 /* CAShapeLayerWithHitTest.m */; }; - 3BF503A7148C614600CC7D17 /* CALayerWithChildHitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66213547148AF80A006881E1 /* CALayerWithChildHitTest.m */; }; - 3BF503A8148C614D00CC7D17 /* CALayerWithChildHitTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213546148AF80A006881E1 /* CALayerWithChildHitTest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6604FCF714A0CDA800B4D2D9 /* SVGPointsAndPathsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 6604FCF314A0CDA800B4D2D9 /* SVGPointsAndPathsParser.m */; }; - 6604FCF814A0CDA800B4D2D9 /* SVGPointsAndPathsParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 6604FCF414A0CDA800B4D2D9 /* SVGPointsAndPathsParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6604FCF914A0CDA800B4D2D9 /* SVGTextElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6604FCF514A0CDA800B4D2D9 /* SVGTextElement.m */; }; - 6604FCFA14A0CDA800B4D2D9 /* SVGTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6604FCF614A0CDA800B4D2D9 /* SVGTextElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6604FCFC14A0CDAE00B4D2D9 /* SVGPointsAndPathsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 6604FCF314A0CDA800B4D2D9 /* SVGPointsAndPathsParser.m */; }; - 6604FCFD14A0CDAE00B4D2D9 /* SVGPointsAndPathsParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 6604FCF414A0CDA800B4D2D9 /* SVGPointsAndPathsParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6604FCFE14A0CDAE00B4D2D9 /* SVGTextElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6604FCF514A0CDA800B4D2D9 /* SVGTextElement.m */; }; - 6604FCFF14A0CDAE00B4D2D9 /* SVGTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6604FCF614A0CDA800B4D2D9 /* SVGTextElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213433148AF2CF006881E1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66226B53148AEAB100EF4A6D /* Foundation.framework */; }; - 662134C3148AF4F7006881E1 /* SVGPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213496148AF4F7006881E1 /* SVGPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134C4148AF4F7006881E1 /* SVGPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213496148AF4F7006881E1 /* SVGPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134C5148AF4F7006881E1 /* SVGUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213497148AF4F7006881E1 /* SVGUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134C6148AF4F7006881E1 /* SVGUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213497148AF4F7006881E1 /* SVGUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134C7148AF4F7006881E1 /* SVGImageElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 66213498148AF4F7006881E1 /* SVGImageElement.m */; }; - 662134C8148AF4F7006881E1 /* SVGImageElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 66213498148AF4F7006881E1 /* SVGImageElement.m */; }; - 662134C9148AF4F7006881E1 /* CGPathAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213499148AF4F7006881E1 /* CGPathAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134CA148AF4F7006881E1 /* CGPathAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213499148AF4F7006881E1 /* CGPathAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134CB148AF4F7006881E1 /* SVGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621349A148AF4F7006881E1 /* SVGUtils.m */; }; - 662134CC148AF4F7006881E1 /* SVGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621349A148AF4F7006881E1 /* SVGUtils.m */; }; - 662134CD148AF4F7006881E1 /* SVGTitleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621349B148AF4F7006881E1 /* SVGTitleElement.m */; }; - 662134CE148AF4F7006881E1 /* SVGTitleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621349B148AF4F7006881E1 /* SVGTitleElement.m */; }; - 662134CF148AF4F7006881E1 /* SVGTitleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621349C148AF4F7006881E1 /* SVGTitleElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134D0148AF4F7006881E1 /* SVGTitleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621349C148AF4F7006881E1 /* SVGTitleElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134D1148AF4F7006881E1 /* SVGShapeElement+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621349D148AF4F7006881E1 /* SVGShapeElement+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134D2148AF4F7006881E1 /* SVGShapeElement+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621349D148AF4F7006881E1 /* SVGShapeElement+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134D3148AF4F7006881E1 /* SVGShapeElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621349E148AF4F7006881E1 /* SVGShapeElement.m */; }; - 662134D4148AF4F7006881E1 /* SVGShapeElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621349E148AF4F7006881E1 /* SVGShapeElement.m */; }; - 662134D5148AF4F7006881E1 /* SVGShapeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621349F148AF4F7006881E1 /* SVGShapeElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134D6148AF4F7006881E1 /* SVGShapeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621349F148AF4F7006881E1 /* SVGShapeElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134D7148AF4F7006881E1 /* SVGRectElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A0148AF4F7006881E1 /* SVGRectElement.m */; }; - 662134D8148AF4F7006881E1 /* SVGRectElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A0148AF4F7006881E1 /* SVGRectElement.m */; }; - 662134D9148AF4F7006881E1 /* SVGRectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134A1148AF4F7006881E1 /* SVGRectElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134DA148AF4F7006881E1 /* SVGRectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134A1148AF4F7006881E1 /* SVGRectElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134DB148AF4F7006881E1 /* SVGPolylineElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A2148AF4F7006881E1 /* SVGPolylineElement.m */; }; - 662134DC148AF4F7006881E1 /* SVGPolylineElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A2148AF4F7006881E1 /* SVGPolylineElement.m */; }; - 662134DD148AF4F7006881E1 /* SVGPolylineElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134A3148AF4F7006881E1 /* SVGPolylineElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134DE148AF4F7006881E1 /* SVGPolylineElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134A3148AF4F7006881E1 /* SVGPolylineElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134DF148AF4F7006881E1 /* SVGPolygonElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A4148AF4F7006881E1 /* SVGPolygonElement.m */; }; - 662134E0148AF4F7006881E1 /* SVGPolygonElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A4148AF4F7006881E1 /* SVGPolygonElement.m */; }; - 662134E1148AF4F7006881E1 /* SVGPolygonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134A5148AF4F7006881E1 /* SVGPolygonElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134E2148AF4F7006881E1 /* SVGPolygonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134A5148AF4F7006881E1 /* SVGPolygonElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134E3148AF4F7006881E1 /* SVGPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A6148AF4F7006881E1 /* SVGPattern.m */; }; - 662134E4148AF4F7006881E1 /* SVGPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A6148AF4F7006881E1 /* SVGPattern.m */; }; - 662134E5148AF4F7006881E1 /* SVGPathElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A7148AF4F7006881E1 /* SVGPathElement.m */; }; - 662134E6148AF4F7006881E1 /* SVGPathElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A7148AF4F7006881E1 /* SVGPathElement.m */; }; - 662134E7148AF4F7006881E1 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134A8148AF4F7006881E1 /* SVGPathElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134E8148AF4F7006881E1 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134A8148AF4F7006881E1 /* SVGPathElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134E9148AF4F7006881E1 /* SVGParserSVG.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A9148AF4F7006881E1 /* SVGParserSVG.m */; }; - 662134EA148AF4F7006881E1 /* SVGParserSVG.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134A9148AF4F7006881E1 /* SVGParserSVG.m */; }; - 662134EB148AF4F7006881E1 /* SVGParserSVG.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134AA148AF4F7006881E1 /* SVGParserSVG.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134EC148AF4F7006881E1 /* SVGParserSVG.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134AA148AF4F7006881E1 /* SVGParserSVG.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134ED148AF4F7006881E1 /* SVGParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134AB148AF4F7006881E1 /* SVGParser.m */; }; - 662134EE148AF4F7006881E1 /* SVGParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134AB148AF4F7006881E1 /* SVGParser.m */; }; - 662134EF148AF4F7006881E1 /* SVGParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134AC148AF4F7006881E1 /* SVGParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134F0148AF4F7006881E1 /* SVGParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134AC148AF4F7006881E1 /* SVGParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134F1148AF4F7006881E1 /* SVGLineElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134AD148AF4F7006881E1 /* SVGLineElement.m */; }; - 662134F2148AF4F7006881E1 /* SVGLineElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134AD148AF4F7006881E1 /* SVGLineElement.m */; }; - 662134F3148AF4F7006881E1 /* SVGLineElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134AE148AF4F7006881E1 /* SVGLineElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134F4148AF4F7006881E1 /* SVGLineElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134AE148AF4F7006881E1 /* SVGLineElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134F5148AF4F7006881E1 /* SVGKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134AF148AF4F7006881E1 /* SVGKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134F6148AF4F7006881E1 /* SVGKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134AF148AF4F7006881E1 /* SVGKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134F7148AF4F7006881E1 /* SVGImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B0148AF4F7006881E1 /* SVGImageElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134F8148AF4F7006881E1 /* SVGImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B0148AF4F7006881E1 /* SVGImageElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134F9148AF4F7006881E1 /* SVGGroupElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134B1148AF4F7006881E1 /* SVGGroupElement.m */; }; - 662134FA148AF4F7006881E1 /* SVGGroupElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134B1148AF4F7006881E1 /* SVGGroupElement.m */; }; - 662134FB148AF4F7006881E1 /* SVGGroupElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B2148AF4F7006881E1 /* SVGGroupElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134FC148AF4F7006881E1 /* SVGGroupElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B2148AF4F7006881E1 /* SVGGroupElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 662134FD148AF4F7006881E1 /* SVGEllipseElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134B3148AF4F7006881E1 /* SVGEllipseElement.m */; }; - 662134FE148AF4F7006881E1 /* SVGEllipseElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134B3148AF4F7006881E1 /* SVGEllipseElement.m */; }; - 662134FF148AF4F7006881E1 /* SVGEllipseElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B4148AF4F7006881E1 /* SVGEllipseElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213500148AF4F7006881E1 /* SVGEllipseElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B4148AF4F7006881E1 /* SVGEllipseElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213501148AF4F7006881E1 /* SVGElement+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B5148AF4F7006881E1 /* SVGElement+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213502148AF4F7006881E1 /* SVGElement+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B5148AF4F7006881E1 /* SVGElement+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213503148AF4F7006881E1 /* SVGElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134B6148AF4F7006881E1 /* SVGElement.m */; }; - 66213504148AF4F7006881E1 /* SVGElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134B6148AF4F7006881E1 /* SVGElement.m */; }; - 66213505148AF4F7006881E1 /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B7148AF4F7006881E1 /* SVGElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213506148AF4F7006881E1 /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B7148AF4F7006881E1 /* SVGElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213507148AF4F7006881E1 /* SVGDocument+CA.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134B8148AF4F7006881E1 /* SVGDocument+CA.m */; }; - 66213508148AF4F7006881E1 /* SVGDocument+CA.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134B8148AF4F7006881E1 /* SVGDocument+CA.m */; }; - 66213509148AF4F7006881E1 /* SVGDocument+CA.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B9148AF4F7006881E1 /* SVGDocument+CA.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6621350A148AF4F7006881E1 /* SVGDocument+CA.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134B9148AF4F7006881E1 /* SVGDocument+CA.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6621350B148AF4F7006881E1 /* SVGDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134BA148AF4F7006881E1 /* SVGDocument.m */; }; - 6621350C148AF4F7006881E1 /* SVGDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134BA148AF4F7006881E1 /* SVGDocument.m */; }; - 6621350D148AF4F7006881E1 /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134BB148AF4F7006881E1 /* SVGDocument.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6621350E148AF4F7006881E1 /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134BB148AF4F7006881E1 /* SVGDocument.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6621350F148AF4F7006881E1 /* SVGDescriptionElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134BC148AF4F7006881E1 /* SVGDescriptionElement.m */; }; - 66213510148AF4F7006881E1 /* SVGDescriptionElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134BC148AF4F7006881E1 /* SVGDescriptionElement.m */; }; - 66213511148AF4F7006881E1 /* SVGDescriptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134BD148AF4F7006881E1 /* SVGDescriptionElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213512148AF4F7006881E1 /* SVGDescriptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134BD148AF4F7006881E1 /* SVGDescriptionElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213513148AF4F7006881E1 /* SVGDefsElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134BE148AF4F7006881E1 /* SVGDefsElement.m */; }; - 66213514148AF4F7006881E1 /* SVGDefsElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134BE148AF4F7006881E1 /* SVGDefsElement.m */; }; - 66213515148AF4F7006881E1 /* SVGDefsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134BF148AF4F7006881E1 /* SVGDefsElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213516148AF4F7006881E1 /* SVGDefsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134BF148AF4F7006881E1 /* SVGDefsElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213517148AF4F7006881E1 /* SVGCircleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134C0148AF4F7006881E1 /* SVGCircleElement.m */; }; - 66213518148AF4F7006881E1 /* SVGCircleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134C0148AF4F7006881E1 /* SVGCircleElement.m */; }; - 66213519148AF4F7006881E1 /* SVGCircleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134C1148AF4F7006881E1 /* SVGCircleElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6621351A148AF4F7006881E1 /* SVGCircleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 662134C1148AF4F7006881E1 /* SVGCircleElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6621351B148AF4F7006881E1 /* CGPathAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134C2148AF4F7006881E1 /* CGPathAdditions.m */; }; - 6621351C148AF4F7006881E1 /* CGPathAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 662134C2148AF4F7006881E1 /* CGPathAdditions.m */; }; - 66213550148AF80B006881E1 /* CALayerWithChildHitTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213546148AF80A006881E1 /* CALayerWithChildHitTest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213551148AF80B006881E1 /* CALayerWithChildHitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66213547148AF80A006881E1 /* CALayerWithChildHitTest.m */; }; - 66213552148AF80B006881E1 /* CAShapeLayerWithHitTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 66213548148AF80A006881E1 /* CAShapeLayerWithHitTest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213553148AF80B006881E1 /* CAShapeLayerWithHitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66213549148AF80A006881E1 /* CAShapeLayerWithHitTest.m */; }; - 66213554148AF80B006881E1 /* SVGDocumentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621354A148AF80A006881E1 /* SVGDocumentView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213555148AF80B006881E1 /* SVGDocumentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621354B148AF80A006881E1 /* SVGDocumentView.m */; }; - 66213556148AF80B006881E1 /* SVGPathView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621354C148AF80A006881E1 /* SVGPathView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213557148AF80B006881E1 /* SVGPathView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621354D148AF80A006881E1 /* SVGPathView.m */; }; - 66213558148AF80B006881E1 /* SVGView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6621354E148AF80A006881E1 /* SVGView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66213559148AF80B006881E1 /* SVGView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6621354F148AF80A006881E1 /* SVGView.m */; }; - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; - C92418E5127336D000403FA7 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C95263281271228F00434805 /* libxml2.dylib */; }; - C9379C5A12777AEC00B0589E /* SVGView.h in Headers */ = {isa = PBXBuildFile; fileRef = C9379C5812777AEC00B0589E /* SVGView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C9379C5B12777AEC00B0589E /* SVGView.m in Sources */ = {isa = PBXBuildFile; fileRef = C9379C5912777AEC00B0589E /* SVGView.m */; }; - C996E4BC1336CBC200EC3F18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C996E4BB1336CBC100EC3F18 /* QuartzCore.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 32DBCF5E0370ADEE00C91783 /* SVGKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKit_Prefix.pch; sourceTree = ""; }; - 3BF5039D148C5FBC00CC7D17 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libxml2.dylib; sourceTree = DEVELOPER_DIR; }; - 3BF5039F148C5FC600CC7D17 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; - 3BF503A1148C5FCE00CC7D17 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; - 3BF503A3148C5FD400CC7D17 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; - 6604FCF314A0CDA800B4D2D9 /* SVGPointsAndPathsParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPointsAndPathsParser.m; sourceTree = ""; }; - 6604FCF414A0CDA800B4D2D9 /* SVGPointsAndPathsParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPointsAndPathsParser.h; sourceTree = ""; }; - 6604FCF514A0CDA800B4D2D9 /* SVGTextElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTextElement.m; sourceTree = ""; }; - 6604FCF614A0CDA800B4D2D9 /* SVGTextElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextElement.h; sourceTree = ""; }; - 66213432148AF2CF006881E1 /* libSVGKitLibrary.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSVGKitLibrary.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 66213436148AF2CF006881E1 /* SVGKitLibrary-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SVGKitLibrary-Prefix.pch"; sourceTree = ""; }; - 66213496148AF4F7006881E1 /* SVGPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPattern.h; sourceTree = ""; }; - 66213497148AF4F7006881E1 /* SVGUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGUtils.h; sourceTree = ""; }; - 66213498148AF4F7006881E1 /* SVGImageElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGImageElement.m; sourceTree = ""; }; - 66213499148AF4F7006881E1 /* CGPathAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGPathAdditions.h; sourceTree = ""; }; - 6621349A148AF4F7006881E1 /* SVGUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGUtils.m; sourceTree = ""; }; - 6621349B148AF4F7006881E1 /* SVGTitleElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTitleElement.m; sourceTree = ""; }; - 6621349C148AF4F7006881E1 /* SVGTitleElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTitleElement.h; sourceTree = ""; }; - 6621349D148AF4F7006881E1 /* SVGShapeElement+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGShapeElement+Private.h"; sourceTree = ""; }; - 6621349E148AF4F7006881E1 /* SVGShapeElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGShapeElement.m; sourceTree = ""; }; - 6621349F148AF4F7006881E1 /* SVGShapeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGShapeElement.h; sourceTree = ""; }; - 662134A0148AF4F7006881E1 /* SVGRectElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGRectElement.m; sourceTree = ""; }; - 662134A1148AF4F7006881E1 /* SVGRectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectElement.h; sourceTree = ""; }; - 662134A2148AF4F7006881E1 /* SVGPolylineElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPolylineElement.m; sourceTree = ""; }; - 662134A3148AF4F7006881E1 /* SVGPolylineElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPolylineElement.h; sourceTree = ""; }; - 662134A4148AF4F7006881E1 /* SVGPolygonElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPolygonElement.m; sourceTree = ""; }; - 662134A5148AF4F7006881E1 /* SVGPolygonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPolygonElement.h; sourceTree = ""; }; - 662134A6148AF4F7006881E1 /* SVGPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPattern.m; sourceTree = ""; }; - 662134A7148AF4F7006881E1 /* SVGPathElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPathElement.m; sourceTree = ""; }; - 662134A8148AF4F7006881E1 /* SVGPathElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathElement.h; sourceTree = ""; }; - 662134A9148AF4F7006881E1 /* SVGParserSVG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGParserSVG.m; sourceTree = ""; }; - 662134AA148AF4F7006881E1 /* SVGParserSVG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGParserSVG.h; sourceTree = ""; }; - 662134AB148AF4F7006881E1 /* SVGParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGParser.m; sourceTree = ""; }; - 662134AC148AF4F7006881E1 /* SVGParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGParser.h; sourceTree = ""; }; - 662134AD148AF4F7006881E1 /* SVGLineElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGLineElement.m; sourceTree = ""; }; - 662134AE148AF4F7006881E1 /* SVGLineElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLineElement.h; sourceTree = ""; }; - 662134AF148AF4F7006881E1 /* SVGKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKit.h; sourceTree = ""; }; - 662134B0148AF4F7006881E1 /* SVGImageElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageElement.h; sourceTree = ""; }; - 662134B1148AF4F7006881E1 /* SVGGroupElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGGroupElement.m; sourceTree = ""; }; - 662134B2148AF4F7006881E1 /* SVGGroupElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGroupElement.h; sourceTree = ""; }; - 662134B3148AF4F7006881E1 /* SVGEllipseElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGEllipseElement.m; sourceTree = ""; }; - 662134B4148AF4F7006881E1 /* SVGEllipseElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGEllipseElement.h; sourceTree = ""; }; - 662134B5148AF4F7006881E1 /* SVGElement+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGElement+Private.h"; sourceTree = ""; }; - 662134B6148AF4F7006881E1 /* SVGElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGElement.m; sourceTree = ""; }; - 662134B7148AF4F7006881E1 /* SVGElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElement.h; sourceTree = ""; }; - 662134B8148AF4F7006881E1 /* SVGDocument+CA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SVGDocument+CA.m"; sourceTree = ""; }; - 662134B9148AF4F7006881E1 /* SVGDocument+CA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGDocument+CA.h"; sourceTree = ""; }; - 662134BA148AF4F7006881E1 /* SVGDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDocument.m; sourceTree = ""; }; - 662134BB148AF4F7006881E1 /* SVGDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDocument.h; sourceTree = ""; }; - 662134BC148AF4F7006881E1 /* SVGDescriptionElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDescriptionElement.m; sourceTree = ""; }; - 662134BD148AF4F7006881E1 /* SVGDescriptionElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDescriptionElement.h; sourceTree = ""; }; - 662134BE148AF4F7006881E1 /* SVGDefsElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDefsElement.m; sourceTree = ""; }; - 662134BF148AF4F7006881E1 /* SVGDefsElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDefsElement.h; sourceTree = ""; }; - 662134C0148AF4F7006881E1 /* SVGCircleElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGCircleElement.m; sourceTree = ""; }; - 662134C1148AF4F7006881E1 /* SVGCircleElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGCircleElement.h; sourceTree = ""; }; - 662134C2148AF4F7006881E1 /* CGPathAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGPathAdditions.m; sourceTree = ""; }; - 66213546148AF80A006881E1 /* CALayerWithChildHitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CALayerWithChildHitTest.h; path = ../iOS/CALayerWithChildHitTest.h; sourceTree = ""; }; - 66213547148AF80A006881E1 /* CALayerWithChildHitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CALayerWithChildHitTest.m; path = ../iOS/CALayerWithChildHitTest.m; sourceTree = ""; }; - 66213548148AF80A006881E1 /* CAShapeLayerWithHitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CAShapeLayerWithHitTest.h; path = ../iOS/CAShapeLayerWithHitTest.h; sourceTree = ""; }; - 66213549148AF80A006881E1 /* CAShapeLayerWithHitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CAShapeLayerWithHitTest.m; path = ../iOS/CAShapeLayerWithHitTest.m; sourceTree = ""; }; - 6621354A148AF80A006881E1 /* SVGDocumentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDocumentView.h; sourceTree = ""; }; - 6621354B148AF80A006881E1 /* SVGDocumentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDocumentView.m; sourceTree = ""; }; - 6621354C148AF80A006881E1 /* SVGPathView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathView.h; sourceTree = ""; }; - 6621354D148AF80A006881E1 /* SVGPathView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPathView.m; sourceTree = ""; }; - 6621354E148AF80A006881E1 /* SVGView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGView.h; sourceTree = ""; }; - 6621354F148AF80A006881E1 /* SVGView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGView.m; sourceTree = ""; }; - 66226B53148AEAB100EF4A6D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 8DC2EF5B0486A6940098B216 /* SVGKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SVGKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - C9379C5812777AEC00B0589E /* SVGView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGView.h; sourceTree = ""; }; - C9379C5912777AEC00B0589E /* SVGView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGView.m; sourceTree = ""; }; - C95263281271228F00434805 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; - C996E4BB1336CBC100EC3F18 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 6621342F148AF2CF006881E1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 3BF503A4148C5FD400CC7D17 /* QuartzCore.framework in Frameworks */, - 3BF503A2148C5FCE00CC7D17 /* CoreGraphics.framework in Frameworks */, - 3BF503A0148C5FC600CC7D17 /* UIKit.framework in Frameworks */, - 3BF5039E148C5FBC00CC7D17 /* libxml2.dylib in Frameworks */, - 66213433148AF2CF006881E1 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8DC2EF560486A6940098B216 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, - C996E4BC1336CBC200EC3F18 /* QuartzCore.framework in Frameworks */, - C92418E5127336D000403FA7 /* libxml2.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 034768DFFF38A50411DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - 8DC2EF5B0486A6940098B216 /* SVGKit.framework */, - 66213432148AF2CF006881E1 /* libSVGKitLibrary.a */, - ); - name = Products; - sourceTree = ""; - }; - 0867D691FE84028FC02AAC07 /* SVGKit */ = { - isa = PBXGroup; - children = ( - C952623F12711D8600434805 /* Framework */, - 66213434148AF2CF006881E1 /* SVGKitLibrary */, - ); - name = SVGKit; - sourceTree = ""; - }; - 0867D69AFE84028FC02AAC07 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, - 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; - 089C1665FE841158C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 8DC2EF5A0486A6940098B216 /* Info.plist */, - ); - name = Resources; - sourceTree = ""; - }; - 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, - C996E4BB1336CBC100EC3F18 /* QuartzCore.framework */, - C95263281271228F00434805 /* libxml2.dylib */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 0867D6A5FE840307C02AAC07 /* AppKit.framework */, - D2F7E79907B2D74100F64583 /* CoreData.framework */, - 0867D69BFE84028FC02AAC07 /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 32C88DFF0371C24200C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32DBCF5E0370ADEE00C91783 /* SVGKit_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 66213434148AF2CF006881E1 /* SVGKitLibrary */ = { - isa = PBXGroup; - children = ( - 66226B52148AEAB100EF4A6D /* Linked Frameworks */, - 66213435148AF2CF006881E1 /* Supporting Files */, - ); - path = SVGKitLibrary; - sourceTree = ""; - }; - 66213435148AF2CF006881E1 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 66213436148AF2CF006881E1 /* SVGKitLibrary-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 66213545148AF80A006881E1 /* iOS */ = { - isa = PBXGroup; - children = ( - 6621354A148AF80A006881E1 /* SVGDocumentView.h */, - 6621354B148AF80A006881E1 /* SVGDocumentView.m */, - 6621354C148AF80A006881E1 /* SVGPathView.h */, - 6621354D148AF80A006881E1 /* SVGPathView.m */, - 6621354E148AF80A006881E1 /* SVGView.h */, - 6621354F148AF80A006881E1 /* SVGView.m */, - ); - name = iOS; - path = ../../iOS; - sourceTree = ""; - }; - 66226B52148AEAB100EF4A6D /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 3BF5039D148C5FBC00CC7D17 /* libxml2.dylib */, - 3BF503A3148C5FD400CC7D17 /* QuartzCore.framework */, - 3BF503A1148C5FCE00CC7D17 /* CoreGraphics.framework */, - 3BF5039F148C5FC600CC7D17 /* UIKit.framework */, - 66226B53148AEAB100EF4A6D /* Foundation.framework */, - ); - name = "Linked Frameworks"; - path = ..; - sourceTree = ""; - }; - C952623F12711D8600434805 /* Framework */ = { - isa = PBXGroup; - children = ( - C952631B1271225F00434805 /* Core */, - C9DA5C5E1273D26A000CB487 /* Mac */, - 66213545148AF80A006881E1 /* iOS */, - 32C88DFF0371C24200C91783 /* Other Sources */, - 089C1665FE841158C02AAC07 /* Resources */, - 0867D69AFE84028FC02AAC07 /* Frameworks */, - 034768DFFF38A50411DB9C8B /* Products */, - ); - name = Framework; - sourceTree = ""; - }; - C952631B1271225F00434805 /* Core */ = { - isa = PBXGroup; - children = ( - 66213546148AF80A006881E1 /* CALayerWithChildHitTest.h */, - 66213547148AF80A006881E1 /* CALayerWithChildHitTest.m */, - 66213548148AF80A006881E1 /* CAShapeLayerWithHitTest.h */, - 66213549148AF80A006881E1 /* CAShapeLayerWithHitTest.m */, - 6604FCF314A0CDA800B4D2D9 /* SVGPointsAndPathsParser.m */, - 6604FCF414A0CDA800B4D2D9 /* SVGPointsAndPathsParser.h */, - 6604FCF514A0CDA800B4D2D9 /* SVGTextElement.m */, - 6604FCF614A0CDA800B4D2D9 /* SVGTextElement.h */, - 66213496148AF4F7006881E1 /* SVGPattern.h */, - 66213497148AF4F7006881E1 /* SVGUtils.h */, - 66213498148AF4F7006881E1 /* SVGImageElement.m */, - 66213499148AF4F7006881E1 /* CGPathAdditions.h */, - 6621349A148AF4F7006881E1 /* SVGUtils.m */, - 6621349B148AF4F7006881E1 /* SVGTitleElement.m */, - 6621349C148AF4F7006881E1 /* SVGTitleElement.h */, - 6621349D148AF4F7006881E1 /* SVGShapeElement+Private.h */, - 6621349E148AF4F7006881E1 /* SVGShapeElement.m */, - 6621349F148AF4F7006881E1 /* SVGShapeElement.h */, - 662134A0148AF4F7006881E1 /* SVGRectElement.m */, - 662134A1148AF4F7006881E1 /* SVGRectElement.h */, - 662134A2148AF4F7006881E1 /* SVGPolylineElement.m */, - 662134A3148AF4F7006881E1 /* SVGPolylineElement.h */, - 662134A4148AF4F7006881E1 /* SVGPolygonElement.m */, - 662134A5148AF4F7006881E1 /* SVGPolygonElement.h */, - 662134A6148AF4F7006881E1 /* SVGPattern.m */, - 662134A7148AF4F7006881E1 /* SVGPathElement.m */, - 662134A8148AF4F7006881E1 /* SVGPathElement.h */, - 662134A9148AF4F7006881E1 /* SVGParserSVG.m */, - 662134AA148AF4F7006881E1 /* SVGParserSVG.h */, - 662134AB148AF4F7006881E1 /* SVGParser.m */, - 662134AC148AF4F7006881E1 /* SVGParser.h */, - 662134AD148AF4F7006881E1 /* SVGLineElement.m */, - 662134AE148AF4F7006881E1 /* SVGLineElement.h */, - 662134AF148AF4F7006881E1 /* SVGKit.h */, - 662134B0148AF4F7006881E1 /* SVGImageElement.h */, - 662134B1148AF4F7006881E1 /* SVGGroupElement.m */, - 662134B2148AF4F7006881E1 /* SVGGroupElement.h */, - 662134B3148AF4F7006881E1 /* SVGEllipseElement.m */, - 662134B4148AF4F7006881E1 /* SVGEllipseElement.h */, - 662134B5148AF4F7006881E1 /* SVGElement+Private.h */, - 662134B6148AF4F7006881E1 /* SVGElement.m */, - 662134B7148AF4F7006881E1 /* SVGElement.h */, - 662134B8148AF4F7006881E1 /* SVGDocument+CA.m */, - 662134B9148AF4F7006881E1 /* SVGDocument+CA.h */, - 662134BA148AF4F7006881E1 /* SVGDocument.m */, - 662134BB148AF4F7006881E1 /* SVGDocument.h */, - 662134BC148AF4F7006881E1 /* SVGDescriptionElement.m */, - 662134BD148AF4F7006881E1 /* SVGDescriptionElement.h */, - 662134BE148AF4F7006881E1 /* SVGDefsElement.m */, - 662134BF148AF4F7006881E1 /* SVGDefsElement.h */, - 662134C0148AF4F7006881E1 /* SVGCircleElement.m */, - 662134C1148AF4F7006881E1 /* SVGCircleElement.h */, - 662134C2148AF4F7006881E1 /* CGPathAdditions.m */, - ); - name = Core; - path = ../../Core; - sourceTree = ""; - }; - C9DA5C5E1273D26A000CB487 /* Mac */ = { - isa = PBXGroup; - children = ( - C9379C5812777AEC00B0589E /* SVGView.h */, - C9379C5912777AEC00B0589E /* SVGView.m */, - ); - name = Mac; - path = ../../Mac; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 66213430148AF2CF006881E1 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 662134C4148AF4F7006881E1 /* SVGPattern.h in Headers */, - 662134C6148AF4F7006881E1 /* SVGUtils.h in Headers */, - 662134CA148AF4F7006881E1 /* CGPathAdditions.h in Headers */, - 662134D0148AF4F7006881E1 /* SVGTitleElement.h in Headers */, - 662134D2148AF4F7006881E1 /* SVGShapeElement+Private.h in Headers */, - 662134D6148AF4F7006881E1 /* SVGShapeElement.h in Headers */, - 662134DA148AF4F7006881E1 /* SVGRectElement.h in Headers */, - 662134DE148AF4F7006881E1 /* SVGPolylineElement.h in Headers */, - 662134E2148AF4F7006881E1 /* SVGPolygonElement.h in Headers */, - 662134E8148AF4F7006881E1 /* SVGPathElement.h in Headers */, - 662134EC148AF4F7006881E1 /* SVGParserSVG.h in Headers */, - 662134F0148AF4F7006881E1 /* SVGParser.h in Headers */, - 662134F4148AF4F7006881E1 /* SVGLineElement.h in Headers */, - 662134F6148AF4F7006881E1 /* SVGKit.h in Headers */, - 662134F8148AF4F7006881E1 /* SVGImageElement.h in Headers */, - 662134FC148AF4F7006881E1 /* SVGGroupElement.h in Headers */, - 66213500148AF4F7006881E1 /* SVGEllipseElement.h in Headers */, - 66213502148AF4F7006881E1 /* SVGElement+Private.h in Headers */, - 66213506148AF4F7006881E1 /* SVGElement.h in Headers */, - 6621350A148AF4F7006881E1 /* SVGDocument+CA.h in Headers */, - 6621350E148AF4F7006881E1 /* SVGDocument.h in Headers */, - 66213512148AF4F7006881E1 /* SVGDescriptionElement.h in Headers */, - 66213516148AF4F7006881E1 /* SVGDefsElement.h in Headers */, - 6621351A148AF4F7006881E1 /* SVGCircleElement.h in Headers */, - 66213550148AF80B006881E1 /* CALayerWithChildHitTest.h in Headers */, - 66213552148AF80B006881E1 /* CAShapeLayerWithHitTest.h in Headers */, - 66213554148AF80B006881E1 /* SVGDocumentView.h in Headers */, - 66213556148AF80B006881E1 /* SVGPathView.h in Headers */, - 66213558148AF80B006881E1 /* SVGView.h in Headers */, - 6604FCFD14A0CDAE00B4D2D9 /* SVGPointsAndPathsParser.h in Headers */, - 6604FCFF14A0CDAE00B4D2D9 /* SVGTextElement.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8DC2EF500486A6940098B216 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - C9379C5A12777AEC00B0589E /* SVGView.h in Headers */, - 3BF503A8148C614D00CC7D17 /* CALayerWithChildHitTest.h in Headers */, - 3BF503A5148C612100CC7D17 /* CAShapeLayerWithHitTest.h in Headers */, - 662134C3148AF4F7006881E1 /* SVGPattern.h in Headers */, - 662134C5148AF4F7006881E1 /* SVGUtils.h in Headers */, - 662134C9148AF4F7006881E1 /* CGPathAdditions.h in Headers */, - 662134CF148AF4F7006881E1 /* SVGTitleElement.h in Headers */, - 662134D1148AF4F7006881E1 /* SVGShapeElement+Private.h in Headers */, - 662134D5148AF4F7006881E1 /* SVGShapeElement.h in Headers */, - 662134D9148AF4F7006881E1 /* SVGRectElement.h in Headers */, - 662134DD148AF4F7006881E1 /* SVGPolylineElement.h in Headers */, - 662134E1148AF4F7006881E1 /* SVGPolygonElement.h in Headers */, - 662134E7148AF4F7006881E1 /* SVGPathElement.h in Headers */, - 662134EB148AF4F7006881E1 /* SVGParserSVG.h in Headers */, - 662134EF148AF4F7006881E1 /* SVGParser.h in Headers */, - 662134F3148AF4F7006881E1 /* SVGLineElement.h in Headers */, - 662134F7148AF4F7006881E1 /* SVGImageElement.h in Headers */, - 662134FB148AF4F7006881E1 /* SVGGroupElement.h in Headers */, - 662134FF148AF4F7006881E1 /* SVGEllipseElement.h in Headers */, - 66213501148AF4F7006881E1 /* SVGElement+Private.h in Headers */, - 66213505148AF4F7006881E1 /* SVGElement.h in Headers */, - 66213509148AF4F7006881E1 /* SVGDocument+CA.h in Headers */, - 6621350D148AF4F7006881E1 /* SVGDocument.h in Headers */, - 66213511148AF4F7006881E1 /* SVGDescriptionElement.h in Headers */, - 6604FCF814A0CDA800B4D2D9 /* SVGPointsAndPathsParser.h in Headers */, - 6604FCFA14A0CDA800B4D2D9 /* SVGTextElement.h in Headers */, - 66213515148AF4F7006881E1 /* SVGDefsElement.h in Headers */, - 66213519148AF4F7006881E1 /* SVGCircleElement.h in Headers */, - 662134F5148AF4F7006881E1 /* SVGKit.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 66213431148AF2CF006881E1 /* SVGKitLibrary */ = { - isa = PBXNativeTarget; - buildConfigurationList = 66213437148AF2CF006881E1 /* Build configuration list for PBXNativeTarget "SVGKitLibrary" */; - buildPhases = ( - 6621342E148AF2CF006881E1 /* Sources */, - 6621342F148AF2CF006881E1 /* Frameworks */, - 66213430148AF2CF006881E1 /* Headers */, - 66213464148AF3A7006881E1 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SVGKitLibrary; - productName = SVGKitLibrary; - productReference = 66213432148AF2CF006881E1 /* libSVGKitLibrary.a */; - productType = "com.apple.product-type.library.static"; - }; - 8DC2EF4F0486A6940098B216 /* SVGKit */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "SVGKit" */; - buildPhases = ( - 8DC2EF500486A6940098B216 /* Headers */, - 8DC2EF520486A6940098B216 /* Resources */, - 8DC2EF540486A6940098B216 /* Sources */, - 8DC2EF560486A6940098B216 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SVGKit; - productInstallPath = "$(HOME)/Library/Frameworks"; - productName = SVGKit; - productReference = 8DC2EF5B0486A6940098B216 /* SVGKit.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0420; - }; - buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "SVGKit" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* SVGKit */; - productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8DC2EF4F0486A6940098B216 /* SVGKit */, - 66213431148AF2CF006881E1 /* SVGKitLibrary */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8DC2EF520486A6940098B216 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 66213464148AF3A7006881E1 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 12; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Version 2.0 (updated for Xcode 4, with some fixes)\n# Changes:\n# - Works with xcode 4, even when running xcode 3 projects (Workarounds for apple bugs)\n# - Faster / better: only runs lipo once, instead of once per recursion\n# - Added some debugging statemetns that can be switched on/off by changing the DEBUG_THIS_SCRIPT variable to \"true\"\n# - Fixed some typos\n# \n# Purpose:\n# Create a static library for iPhone from within XCode\n# Because Apple staff DELIBERATELY broke Xcode to make this impossible from the GUI (Xcode 3.2.3 specifically states this in the Release notes!)\n# ...no, I don't understand why they did this!\n#\n# Author: Adam Martin - http://twitter.com/redglassesapps\n# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER)\n#\n# More info: see this Stack Overflow question: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4\n\n#################[ Tests: helps workaround any future bugs in Xcode ]########\n#\nDEBUG_THIS_SCRIPT=\"false\"\n\nif [ $DEBUG_THIS_SCRIPT = \"true\" ]\nthen\necho \"########### TESTS #############\"\necho \"Use the following variables when debugging this script; note that they may change on recursions\"\necho \"BUILD_DIR = $BUILD_DIR\"\necho \"BUILD_ROOT = $BUILD_ROOT\"\necho \"CONFIGURATION_BUILD_DIR = $CONFIGURATION_BUILD_DIR\"\necho \"BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR\"\necho \"CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR\"\necho \"TARGET_BUILD_DIR = $TARGET_BUILD_DIR\"\nfi\n\n#####################[ part 1 ]##################\n# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it)\n# (incidental: searching for substrings in sh is a nightmare! Sob)\n\nSDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\\{3\\}$')\n\n# Next, work out if we're in SIM or DEVICE\n\nif [ ${PLATFORM_NAME} = \"iphonesimulator\" ]\nthen\nOTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION}\nelse\nOTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION}\nfi\n\necho \"XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})\"\necho \"...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}\"\n#\n#####################[ end of part 1 ]##################\n\n#####################[ part 2 ]##################\n#\n# IF this is the original invocation, invoke WHATEVER other builds are required\n#\n# Xcode is already building ONE target...\n#\n# ...but this is a LIBRARY, so Apple is wrong to set it to build just one.\n# ...we need to build ALL targets\n# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!)\n#\n#\n# So: build ONLY the missing platforms/configurations.\n\nif [ \"true\" == ${ALREADYINVOKED:-false} ]\nthen\necho \"RECURSION: I am NOT the root invocation, so I'm NOT going to recurse\"\nelse\n# CRITICAL:\n# Prevent infinite recursion (Xcode sucks)\nexport ALREADYINVOKED=\"true\"\n\necho \"RECURSION: I am the root ... recursing all missing build targets NOW...\"\necho \"RECURSION: ...about to invoke: xcodebuild -configuration \\\"${CONFIGURATION}\\\" -target \\\"${TARGET_NAME}\\\" -sdk \\\"${OTHER_SDK_TO_BUILD}\\\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO\"\nxcodebuild -configuration \"${CONFIGURATION}\" -target \"${TARGET_NAME}\" -sdk \"${OTHER_SDK_TO_BUILD}\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\"\n\nACTION=\"build\"\n\n#Merge all platform binaries as a fat binary for each configurations.\n\n# Calculate where the (multiple) built files are coming from:\nCURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos\nCURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator\n\necho \"Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}\"\necho \"Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}\"\n\nCREATING_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION}-universal\necho \"...I will output a universal build to: ${CREATING_UNIVERSAL_DIR}\"\n\n# ... remove the products of previous runs of this script\n# NB: this directory is ONLY created by this script - it should be safe to delete!\n\nrm -rf \"${CREATING_UNIVERSAL_DIR}\"\nmkdir \"${CREATING_UNIVERSAL_DIR}\"\n\n#\necho \"lipo: for current configuration (${CONFIGURATION}) creating output file: ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}\"\nlipo -create -output \"${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}\" \"${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}\" \"${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}\"\n\n#########\n#\n# Added: StackOverflow suggestion to also copy \"include\" files\n# (untested, but should work OK)\n#\nif [ -d \"${CURRENTCONFIG_DEVICE_DIR}/usr/local/include\" ]\nthen\nmkdir -p \"${CREATING_UNIVERSAL_DIR}/usr/local/include\"\n# * needs to be outside the double quotes?\ncp \"${CURRENTCONFIG_DEVICE_DIR}/usr/local/include/\"* \"${CREATING_UNIVERSAL_DIR}/usr/local/include\"\nfi\nfi\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 6621342E148AF2CF006881E1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 662134C8148AF4F7006881E1 /* SVGImageElement.m in Sources */, - 662134CC148AF4F7006881E1 /* SVGUtils.m in Sources */, - 662134CE148AF4F7006881E1 /* SVGTitleElement.m in Sources */, - 662134D4148AF4F7006881E1 /* SVGShapeElement.m in Sources */, - 662134D8148AF4F7006881E1 /* SVGRectElement.m in Sources */, - 662134DC148AF4F7006881E1 /* SVGPolylineElement.m in Sources */, - 662134E0148AF4F7006881E1 /* SVGPolygonElement.m in Sources */, - 662134E4148AF4F7006881E1 /* SVGPattern.m in Sources */, - 662134E6148AF4F7006881E1 /* SVGPathElement.m in Sources */, - 662134EA148AF4F7006881E1 /* SVGParserSVG.m in Sources */, - 662134EE148AF4F7006881E1 /* SVGParser.m in Sources */, - 662134F2148AF4F7006881E1 /* SVGLineElement.m in Sources */, - 662134FA148AF4F7006881E1 /* SVGGroupElement.m in Sources */, - 662134FE148AF4F7006881E1 /* SVGEllipseElement.m in Sources */, - 66213504148AF4F7006881E1 /* SVGElement.m in Sources */, - 66213508148AF4F7006881E1 /* SVGDocument+CA.m in Sources */, - 6621350C148AF4F7006881E1 /* SVGDocument.m in Sources */, - 66213510148AF4F7006881E1 /* SVGDescriptionElement.m in Sources */, - 66213514148AF4F7006881E1 /* SVGDefsElement.m in Sources */, - 66213518148AF4F7006881E1 /* SVGCircleElement.m in Sources */, - 6621351C148AF4F7006881E1 /* CGPathAdditions.m in Sources */, - 66213551148AF80B006881E1 /* CALayerWithChildHitTest.m in Sources */, - 66213553148AF80B006881E1 /* CAShapeLayerWithHitTest.m in Sources */, - 66213555148AF80B006881E1 /* SVGDocumentView.m in Sources */, - 66213557148AF80B006881E1 /* SVGPathView.m in Sources */, - 66213559148AF80B006881E1 /* SVGView.m in Sources */, - 6604FCFC14A0CDAE00B4D2D9 /* SVGPointsAndPathsParser.m in Sources */, - 6604FCFE14A0CDAE00B4D2D9 /* SVGTextElement.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8DC2EF540486A6940098B216 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3BF503A7148C614600CC7D17 /* CALayerWithChildHitTest.m in Sources */, - 3BF503A6148C612F00CC7D17 /* CAShapeLayerWithHitTest.m in Sources */, - C9379C5B12777AEC00B0589E /* SVGView.m in Sources */, - 662134C7148AF4F7006881E1 /* SVGImageElement.m in Sources */, - 662134CB148AF4F7006881E1 /* SVGUtils.m in Sources */, - 662134CD148AF4F7006881E1 /* SVGTitleElement.m in Sources */, - 662134D3148AF4F7006881E1 /* SVGShapeElement.m in Sources */, - 662134D7148AF4F7006881E1 /* SVGRectElement.m in Sources */, - 662134DB148AF4F7006881E1 /* SVGPolylineElement.m in Sources */, - 662134DF148AF4F7006881E1 /* SVGPolygonElement.m in Sources */, - 662134E3148AF4F7006881E1 /* SVGPattern.m in Sources */, - 662134E5148AF4F7006881E1 /* SVGPathElement.m in Sources */, - 662134E9148AF4F7006881E1 /* SVGParserSVG.m in Sources */, - 662134ED148AF4F7006881E1 /* SVGParser.m in Sources */, - 662134F1148AF4F7006881E1 /* SVGLineElement.m in Sources */, - 662134F9148AF4F7006881E1 /* SVGGroupElement.m in Sources */, - 662134FD148AF4F7006881E1 /* SVGEllipseElement.m in Sources */, - 66213503148AF4F7006881E1 /* SVGElement.m in Sources */, - 66213507148AF4F7006881E1 /* SVGDocument+CA.m in Sources */, - 6621350B148AF4F7006881E1 /* SVGDocument.m in Sources */, - 6621350F148AF4F7006881E1 /* SVGDescriptionElement.m in Sources */, - 66213513148AF4F7006881E1 /* SVGDefsElement.m in Sources */, - 66213517148AF4F7006881E1 /* SVGCircleElement.m in Sources */, - 6621351B148AF4F7006881E1 /* CGPathAdditions.m in Sources */, - 6604FCF714A0CDA800B4D2D9 /* SVGPointsAndPathsParser.m in Sources */, - 6604FCF914A0CDA800B4D2D9 /* SVGTextElement.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1DEB91AE08733DA50010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_DYNAMIC_NO_PIC = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = SVGKit_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = DEBUG; - HEADER_SEARCH_PATHS = /usr/include/libxml2; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@executable_path/../Frameworks"; - PRODUCT_NAME = SVGKit; - WRAPPER_EXTENSION = framework; - }; - name = Debug; - }; - 1DEB91AF08733DA50010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = SVGKit_Prefix.pch; - HEADER_SEARCH_PATHS = /usr/include/libxml2; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@executable_path/../Frameworks"; - PRODUCT_NAME = SVGKit; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; - 1DEB91B208733DA50010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_GC = supported; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 1DEB91B308733DA50010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_GC = supported; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - SDKROOT = macosx; - }; - name = Release; - }; - 66213438148AF2CF006881E1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - DSTROOT = /tmp/SVGKitLibrary.dst; - GCC_ENABLE_OBJC_GC = unsupported; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SVGKitLibrary/SVGKitLibrary-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = DEBUG; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - HEADER_SEARCH_PATHS = /usr/include/libxml2; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 66213439148AF2CF006881E1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - DSTROOT = /tmp/SVGKitLibrary.dst; - GCC_ENABLE_OBJC_GC = unsupported; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SVGKitLibrary/SVGKitLibrary-Prefix.pch"; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - HEADER_SEARCH_PATHS = /usr/include/libxml2; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "SVGKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91AE08733DA50010E9CD /* Debug */, - 1DEB91AF08733DA50010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "SVGKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91B208733DA50010E9CD /* Debug */, - 1DEB91B308733DA50010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 66213437148AF2CF006881E1 /* Build configuration list for PBXNativeTarget "SVGKitLibrary" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 66213438148AF2CF006881E1 /* Debug */, - 66213439148AF2CF006881E1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/XCodeProjects/SVGKit/SVGKitLibrary/SVGKitLibrary-Prefix.pch b/XCodeProjects/SVGKit/SVGKitLibrary/SVGKitLibrary-Prefix.pch deleted file mode 100644 index 7c3a2edf1..000000000 --- a/XCodeProjects/SVGKit/SVGKitLibrary/SVGKitLibrary-Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'SVGKitLibrary' target in the 'SVGKitLibrary' project -// - -#ifdef __OBJC__ - #import -#endif diff --git a/XCodeProjects/SVGKit/SVGKit_Prefix.pch b/XCodeProjects/SVGKit/SVGKit_Prefix.pch deleted file mode 100644 index bc9cf2df2..000000000 --- a/XCodeProjects/SVGKit/SVGKit_Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'SVGKit' target in the 'SVGKit' project. -// - -#ifdef __OBJC__ - #import -#endif diff --git a/XCodeProjects/SVGPadDemo/Classes/DetailViewController.h b/XCodeProjects/SVGPadDemo/Classes/DetailViewController.h deleted file mode 100644 index cc7281c8b..000000000 --- a/XCodeProjects/SVGPadDemo/Classes/DetailViewController.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// DetailViewController.h -// SVGPad -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGKit.h" -#import "CALayerExporter.h" - -@interface DetailViewController : UIViewController < UIPopoverControllerDelegate, UISplitViewControllerDelegate , CALayerExporterDelegate, UIScrollViewDelegate> { - @private - NSString *_name; - UITextView* _exportText; - NSMutableString* _exportLog; - CALayerExporter* _layerExporter; -} - -@property (nonatomic, retain) IBOutlet UIToolbar *toolbar; -@property (retain, nonatomic) IBOutlet UIScrollView *scrollView; -@property (nonatomic, retain) IBOutlet SVGView *contentView; - -@property (nonatomic, retain) id detailItem; - -- (IBAction)animate:(id)sender; -- (IBAction)exportLayers:(id)sender; - -@end diff --git a/XCodeProjects/SVGPadDemo/Classes/DetailViewController.m b/XCodeProjects/SVGPadDemo/Classes/DetailViewController.m deleted file mode 100644 index 3c00d11e8..000000000 --- a/XCodeProjects/SVGPadDemo/Classes/DetailViewController.m +++ /dev/null @@ -1,189 +0,0 @@ -// -// DetailViewController.m -// SVGPad -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "DetailViewController.h" - -#import "RootViewController.h" - -@interface DetailViewController () - -@property (nonatomic, retain) UIPopoverController *popoverController; - -- (void)loadResource:(NSString *)name; -- (void)shakeHead; - -@end - - -@implementation DetailViewController -@synthesize scrollView; - -@synthesize toolbar, popoverController, contentView, detailItem; - -- (void)viewDidLoad -{ - [super viewDidLoad]; -} - -- (void)dealloc { - self.popoverController = nil; - self.toolbar = nil; - self.detailItem = nil; - - [scrollView release]; - [super dealloc]; -} - -- (void)setDetailItem:(id)newDetailItem { - if (detailItem != newDetailItem) { - [detailItem release]; - detailItem = [newDetailItem retain]; - - [self loadResource:newDetailItem]; - } - - if (self.popoverController) { - [self.popoverController dismissPopoverAnimated:YES]; - } -} - -- (void)loadResource:(NSString *)name -{ - [self.contentView removeFromSuperview]; - - SVGDocument *document = [SVGDocument documentNamed:[name stringByAppendingPathExtension:@"svg"]]; - NSLog(@"[%@] Freshly loaded document (name = %@) has width,height = (%.2f, %.2f)", [self class], name, document.width, document.height ); - self.contentView = [[[SVGView alloc] initWithDocument:document] autorelease]; - - if (_name) { - [_name release]; - _name = nil; - } - - _name = [name copy]; - - [self.scrollView addSubview:self.contentView]; - [self.scrollView setContentSize:CGSizeMake(document.width, document.height)]; - [self.scrollView zoomToRect:CGRectMake(0, 0, document.width, document.height) animated:YES]; -} - -- (IBAction)animate:(id)sender { - if ([_name isEqualToString:@"Monkey"]) { - [self shakeHead]; - } -} - - -- (void)shakeHead { - CALayer *layer = [self.contentView.document layerWithIdentifier:@"head"]; - - CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; - animation.duration = 0.25f; - animation.autoreverses = YES; - animation.repeatCount = 100000; - animation.fromValue = [NSNumber numberWithFloat:0.1f]; - animation.toValue = [NSNumber numberWithFloat:-0.1f]; - - [layer addAnimation:animation forKey:@"shakingHead"]; -} - -- (void)splitViewController:(UISplitViewController *)svc - willHideViewController:(UIViewController *)aViewController - withBarButtonItem:(UIBarButtonItem *)barButtonItem - forPopoverController:(UIPopoverController *)pc { - - barButtonItem.title = @"Samples"; - - NSMutableArray *items = [[toolbar items] mutableCopy]; - [items insertObject:barButtonItem atIndex:0]; - - [toolbar setItems:items animated:YES]; - [items release]; - - self.popoverController = pc; -} - -- (void)splitViewController:(UISplitViewController *)svc - willShowViewController:(UIViewController *)aViewController - invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem { - - NSMutableArray *items = [[toolbar items] mutableCopy]; - [items removeObjectAtIndex:0]; - - [toolbar setItems:items animated:YES]; - [items release]; - - self.popoverController = nil; -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return YES; -} - -- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView -{ - return self.contentView; -} - -#pragma mark Export - - -- (IBAction)exportLayers:(id)sender { - if (_layerExporter) { - return; - } - _layerExporter = [[CALayerExporter alloc] initWithView:contentView]; - _layerExporter.delegate = self; - - UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)]; - UIViewController* textViewController = [[[UIViewController alloc] init] autorelease]; - [textViewController setView:textView]; - UIPopoverController* exportPopover = [[UIPopoverController alloc] initWithContentViewController:textViewController]; - [exportPopover setDelegate:self]; - [exportPopover presentPopoverFromBarButtonItem:sender - permittedArrowDirections:UIPopoverArrowDirectionAny - animated:YES]; - - _exportText = textView; - _exportText.text = @"exporting..."; - - _exportLog = [[NSMutableString alloc] init]; - [_layerExporter startExport]; -} - -- (void) layerExporter:(CALayerExporter*)exporter didParseLayer:(CALayer*)layer withStatement:(NSString*)statement -{ - //NSLog(@"%@", statement); - [_exportLog appendString:statement]; - [_exportLog appendString:@"\n"]; -} - -- (void)layerExporterDidFinish:(CALayerExporter *)exporter -{ - _exportText.text = _exportLog; -} - -- (void)popoverControllerDidDismissPopover:(UIPopoverController *)pc -{ - [_exportText release]; - _exportText = nil; - - [_layerExporter release]; - _layerExporter = nil; - - [pc release]; -} - - -- (void)viewDidUnload { - [self setScrollView:nil]; - [super viewDidUnload]; -} - - - -@end diff --git a/XCodeProjects/SVGPadDemo/Classes/RootViewController.m b/XCodeProjects/SVGPadDemo/Classes/RootViewController.m deleted file mode 100644 index 76d19df19..000000000 --- a/XCodeProjects/SVGPadDemo/Classes/RootViewController.m +++ /dev/null @@ -1,65 +0,0 @@ -// -// RootViewController.m -// SVGPad -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "RootViewController.h" - -#import "DetailViewController.h" - -@implementation RootViewController - -@synthesize detailViewController = _detailViewController; - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - _sampleNames = [[NSArray alloc] initWithObjects:@"map-test-australia_states_blank", @"Monkey", @"Blank_Map-Africa", @"Note", @"Lion", @"Map", @"CurvedDiamond", @"Text", @"Location_European_nation_states", @"map-test-Location_European_nation_states-ukonly", @"map-test-Location_European_nation_states-adam1", nil]; - } - return self; -} - -- (void)dealloc { - [_detailViewController release]; - [_sampleNames release]; - - [super dealloc]; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.clearsSelectionOnViewWillAppear = NO; - self.contentSizeForViewInPopover = CGSizeMake(320.0f, 600.0f); -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return YES; -} - -- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section { - return [_sampleNames count]; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - - if (!cell) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:CellIdentifier] autorelease]; - } - - cell.textLabel.text = [_sampleNames objectAtIndex:indexPath.row]; - - return cell; -} - -- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - _detailViewController.detailItem = [_sampleNames objectAtIndex:indexPath.row]; -} - -@end diff --git a/XCodeProjects/SVGPadDemo/Classes/SVGPadAppDelegate.h b/XCodeProjects/SVGPadDemo/Classes/SVGPadAppDelegate.h deleted file mode 100644 index 10c937b9a..000000000 --- a/XCodeProjects/SVGPadDemo/Classes/SVGPadAppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// SVGPadAppDelegate.h -// SVGPad -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -@class RootViewController, DetailViewController; - -@interface SVGPadAppDelegate : NSObject < UIApplicationDelegate > { } - -@property (nonatomic, retain) IBOutlet UIWindow *window; - -@property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController; -@property (nonatomic, retain) IBOutlet RootViewController *rootViewController; -@property (nonatomic, retain) IBOutlet DetailViewController *detailViewController; - -@end diff --git a/XCodeProjects/SVGPadDemo/Classes/SVGPadAppDelegate.m b/XCodeProjects/SVGPadDemo/Classes/SVGPadAppDelegate.m deleted file mode 100644 index 0404f7de3..000000000 --- a/XCodeProjects/SVGPadDemo/Classes/SVGPadAppDelegate.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// SVGPadAppDelegate.m -// SVGPad -// -// Copyright Matt Rajca 2010. All rights reserved. -// - -#import "SVGPadAppDelegate.h" - -#import "DetailViewController.h" -#import "RootViewController.h" - -@implementation SVGPadAppDelegate - -@synthesize window, splitViewController, rootViewController, detailViewController; - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [self.window addSubview:splitViewController.view]; - [self.window makeKeyAndVisible]; - - return YES; -} - -- (void)dealloc { - self.window = nil; - self.splitViewController = nil; - self.rootViewController = nil; - self.detailViewController = nil; - - [super dealloc]; -} - -@end diff --git a/XCodeProjects/SVGPadDemo/DetailView.xib b/XCodeProjects/SVGPadDemo/DetailView.xib deleted file mode 100644 index c5ef8f039..000000000 --- a/XCodeProjects/SVGPadDemo/DetailView.xib +++ /dev/null @@ -1,410 +0,0 @@ - - - - 1280 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 933 - - - YES - IBUIBarButtonItem - IBUIToolbar - IBUIView - IBUIScrollView - IBProxyObject - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 274 - - YES - - - 290 - {768, 44} - - - - NO - NO - IBIPadFramework - - YES - - IBIPadFramework - - 5 - - - Export Layers - IBIPadFramework - 1 - - - - Animate - IBIPadFramework - 1 - - - - - - - 274 - - YES - - - 292 - {768, 960} - - - - - 3 - MQA - - 2 - - - IBIPadFramework - - - {{0, 44}, {768, 960}} - - - - YES - YES - IBIPadFramework - 0.25 - 3 - - - {{0, 20}, {768, 1004}} - - - - - 3 - MQA - - NO - - 2 - - IBIPadFramework - - - - - YES - - - view - - - - 12 - - - - toolbar - - - - 65 - - - - contentView - - - - 86 - - - - scrollView - - - - 95 - - - - animate: - - - - 89 - - - - exportLayers: - - - - 92 - - - - delegate - - - - 94 - - - - - YES - - 0 - - YES - - - - - - -1 - - - File's Owner - - - -2 - - - - - 8 - - - YES - - - - - - - 63 - - - YES - - - - - - - - 87 - - - - - 88 - - - - - 90 - - - - - 93 - - - YES - - - - - - 85 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 63.IBPluginDependency - 8.IBPluginDependency - 85.CustomClassName - 85.IBPluginDependency - 87.IBPluginDependency - 88.IBPluginDependency - 90.IBPluginDependency - 93.IBPluginDependency - - - YES - DetailViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - SVGView - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 95 - - - - YES - - DetailViewController - UIViewController - - YES - - YES - animate: - exportLayers: - - - YES - id - id - - - - YES - - YES - animate: - exportLayers: - - - YES - - animate: - id - - - exportLayers: - id - - - - - YES - - YES - contentView - scrollView - toolbar - - - YES - SVGView - UIScrollView - UIToolbar - - - - YES - - YES - contentView - scrollView - toolbar - - - YES - - contentView - SVGView - - - scrollView - UIScrollView - - - toolbar - UIToolbar - - - - - IBProjectSource - ./Classes/DetailViewController.h - - - - SVGView - UIView - - IBProjectSource - ./Classes/SVGView.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 933 - - diff --git a/XCodeProjects/SVGPadDemo/MainWindow.xib b/XCodeProjects/SVGPadDemo/MainWindow.xib deleted file mode 100644 index 4b98bca85..000000000 --- a/XCodeProjects/SVGPadDemo/MainWindow.xib +++ /dev/null @@ -1,626 +0,0 @@ - - - - 1056 - 10F569 - 823 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - {768, 1024} - - 1 - MSAxIDEAA - - NO - NO - - 2 - - IBIPadFramework - YES - - - IBIPadFramework - - - - - 2 - - - 3 - - IBIPadFramework - YES - - - - 2 - - - 1 - - IBIPadFramework - NO - - - 256 - {0, 0} - YES - YES - IBIPadFramework - - - - - - Samples - IBIPadFramework - - - - 2 - - - 1 - - IBIPadFramework - NO - - - - - - - DetailView - - 1 - - IBIPadFramework - NO - - - - - - - - window - - - - 4 - - - - delegate - - - - 17 - - - - splitViewController - - - - 43 - - - - rootViewController - - - - 44 - - - - detailViewController - - - - 45 - - - - detailViewController - - - - 46 - - - - delegate - - - - 49 - - - - - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - - - 3 - - - - - 37 - - - - - - - - - 38 - - - - - - - - - 39 - - - - - 40 - - - - - - - - 41 - - - - - 42 - - - - - - - UIApplication - UIResponder - {{190, 57}, {783, 799}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - SVGPadAppDelegate - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{251, 388}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - DetailViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - RootViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 49 - - - - - ContentView - UIView - - IBProjectSource - Classes/ContentView.h - - - - DetailViewController - UIViewController - - ContentView - UIToolbar - - - - contentView - ContentView - - - toolbar - UIToolbar - - - - IBProjectSource - Classes/DetailViewController.h - - - - RootViewController - UITableViewController - - detailViewController - DetailViewController - - - detailViewController - - detailViewController - DetailViewController - - - - IBProjectSource - Classes/RootViewController.h - - - - RootViewController - UITableViewController - - IBUserSource - - - - - SVGPadAppDelegate - NSObject - - DetailViewController - RootViewController - UISplitViewController - UIWindow - - - - detailViewController - DetailViewController - - - rootViewController - RootViewController - - - splitViewController - UISplitViewController - - - window - UIWindow - - - - IBProjectSource - Classes/SVGPadAppDelegate.h - - - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIApplication - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIApplication.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UINavigationBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UINavigationBar.h - - - - UINavigationController - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UINavigationItem - NSObject - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISplitViewController - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UITableViewController - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITableViewController.h - - - - UIToolbar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIToolbar.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - UIWindow - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIWindow.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - SVGPad.xcodeproj - 3 - 132 - - diff --git a/XCodeProjects/SVGPadDemo/SVGPad.xcodeproj/project.pbxproj b/XCodeProjects/SVGPadDemo/SVGPad.xcodeproj/project.pbxproj deleted file mode 100755 index 762c63330..000000000 --- a/XCodeProjects/SVGPadDemo/SVGPad.xcodeproj/project.pbxproj +++ /dev/null @@ -1,560 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1D3623260D0F684500981E51 /* SVGPadAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* SVGPadAppDelegate.m */; }; - 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 2804200B108E984D000629CD /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28042008108E984D000629CD /* RootViewController.m */; }; - 2804200C108E984D000629CD /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2804200A108E984D000629CD /* DetailViewController.m */; }; - 2804203C108E9BAB000629CD /* DetailView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2804203B108E9BAB000629CD /* DetailView.xib */; }; - 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */; }; - 28AD73600D9D9599002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD735F0D9D9599002E5188 /* MainWindow.xib */; }; - 3BC23F071488686900FC74CE /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC23F061488686900FC74CE /* libxml2.dylib */; }; - 3BF503FB148C62D900CC7D17 /* CGPathAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503C2148C62D900CC7D17 /* CGPathAdditions.m */; }; - 3BF503FC148C62D900CC7D17 /* SVGCircleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503C4148C62D900CC7D17 /* SVGCircleElement.m */; }; - 3BF503FD148C62D900CC7D17 /* SVGDefsElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503C6148C62D900CC7D17 /* SVGDefsElement.m */; }; - 3BF503FE148C62D900CC7D17 /* SVGDescriptionElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503C8148C62D900CC7D17 /* SVGDescriptionElement.m */; }; - 3BF503FF148C62D900CC7D17 /* SVGDocument+CA.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503CA148C62D900CC7D17 /* SVGDocument+CA.m */; }; - 3BF50400148C62D900CC7D17 /* SVGDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503CC148C62D900CC7D17 /* SVGDocument.m */; }; - 3BF50401148C62D900CC7D17 /* SVGElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503CF148C62D900CC7D17 /* SVGElement.m */; }; - 3BF50402148C62D900CC7D17 /* SVGEllipseElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503D1148C62D900CC7D17 /* SVGEllipseElement.m */; }; - 3BF50403148C62D900CC7D17 /* SVGGroupElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503D3148C62D900CC7D17 /* SVGGroupElement.m */; }; - 3BF50404148C62D900CC7D17 /* SVGImageElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503D5148C62D900CC7D17 /* SVGImageElement.m */; }; - 3BF50405148C62D900CC7D17 /* SVGLineElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503D8148C62D900CC7D17 /* SVGLineElement.m */; }; - 3BF50406148C62D900CC7D17 /* SVGParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503DA148C62D900CC7D17 /* SVGParser.m */; }; - 3BF50407148C62D900CC7D17 /* SVGParserSVG.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503DC148C62D900CC7D17 /* SVGParserSVG.m */; }; - 3BF50408148C62D900CC7D17 /* SVGPathElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503DE148C62D900CC7D17 /* SVGPathElement.m */; }; - 3BF50409148C62D900CC7D17 /* SVGPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503E0148C62D900CC7D17 /* SVGPattern.m */; }; - 3BF5040A148C62D900CC7D17 /* SVGPolygonElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503E2148C62D900CC7D17 /* SVGPolygonElement.m */; }; - 3BF5040B148C62D900CC7D17 /* SVGPolylineElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503E4148C62D900CC7D17 /* SVGPolylineElement.m */; }; - 3BF5040C148C62D900CC7D17 /* SVGRectElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503E6148C62D900CC7D17 /* SVGRectElement.m */; }; - 3BF5040D148C62D900CC7D17 /* SVGShapeElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503E9148C62D900CC7D17 /* SVGShapeElement.m */; }; - 3BF5040E148C62D900CC7D17 /* SVGTextElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503EB148C62D900CC7D17 /* SVGTextElement.m */; }; - 3BF5040F148C62D900CC7D17 /* SVGTitleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503ED148C62D900CC7D17 /* SVGTitleElement.m */; }; - 3BF50410148C62D900CC7D17 /* SVGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503EF148C62D900CC7D17 /* SVGUtils.m */; }; - 3BF50411148C62D900CC7D17 /* CALayerWithChildHitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503F2148C62D900CC7D17 /* CALayerWithChildHitTest.m */; }; - 3BF50412148C62D900CC7D17 /* CAShapeLayerWithHitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503F4148C62D900CC7D17 /* CAShapeLayerWithHitTest.m */; }; - 3BF50413148C62D900CC7D17 /* SVGDocumentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503F6148C62D900CC7D17 /* SVGDocumentView.m */; }; - 3BF50414148C62D900CC7D17 /* SVGPathView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503F8148C62D900CC7D17 /* SVGPathView.m */; }; - 3BF50415148C62D900CC7D17 /* SVGView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF503FA148C62D900CC7D17 /* SVGView.m */; }; - 3BF50422148C63F500CC7D17 /* CurvedDiamond.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3BF5041B148C63F500CC7D17 /* CurvedDiamond.svg */; }; - 3BF50423148C63F500CC7D17 /* Lion.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3BF5041C148C63F500CC7D17 /* Lion.svg */; }; - 3BF50424148C63F500CC7D17 /* Map.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3BF5041D148C63F500CC7D17 /* Map.svg */; }; - 3BF50425148C63F500CC7D17 /* Monkey.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3BF5041E148C63F500CC7D17 /* Monkey.svg */; }; - 3BF50426148C63F500CC7D17 /* Note.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3BF5041F148C63F500CC7D17 /* Note.svg */; }; - 3BF50427148C63F500CC7D17 /* test-wave-1.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3BF50420148C63F500CC7D17 /* test-wave-1.svg */; }; - 3BF50428148C63F500CC7D17 /* Text.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3BF50421148C63F500CC7D17 /* Text.svg */; }; - 663C41C6149E638000F546A3 /* SVGPointsAndPathsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 663C41C5149E638000F546A3 /* SVGPointsAndPathsParser.m */; }; - 663DEFEC14BFD6BC00C56E07 /* Location_European_nation_states.svg in Resources */ = {isa = PBXBuildFile; fileRef = 663DEFEB14BFD6BC00C56E07 /* Location_European_nation_states.svg */; }; - 663DEFEF14BFDAC100C56E07 /* map-test-Location_European_nation_states-ukonly.svg in Resources */ = {isa = PBXBuildFile; fileRef = 663DEFEE14BFDAC100C56E07 /* map-test-Location_European_nation_states-ukonly.svg */; }; - 66436E5314A0BCEF001CC769 /* CALayerExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 66436E5214A0BCEF001CC769 /* CALayerExporter.m */; }; - 6680A6D3149E4F0B00F2113F /* Blank_Map-Africa.svg in Resources */ = {isa = PBXBuildFile; fileRef = 6680A6D2149E4F0B00F2113F /* Blank_Map-Africa.svg */; }; - 6680A6D5149E4F3900F2113F /* Sample Licenses.txt in Resources */ = {isa = PBXBuildFile; fileRef = 6680A6D4149E4F3900F2113F /* Sample Licenses.txt */; }; - 66BBD74315028F0A00102FEF /* map-test-australia_states_blank.svg in Resources */ = {isa = PBXBuildFile; fileRef = 66BBD74215028F0A00102FEF /* map-test-australia_states_blank.svg */; }; - 66BBD7461502A4EE00102FEF /* map-test-Location_European_nation_states-adam1.svg in Resources */ = {isa = PBXBuildFile; fileRef = 66BBD7451502A4EE00102FEF /* map-test-Location_European_nation_states-adam1.svg */; }; - C94B6C5D1274BBFC00B456EB /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C94B6C5C1274BBFC00B456EB /* QuartzCore.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D3623240D0F684500981E51 /* SVGPadAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPadAppDelegate.h; sourceTree = ""; }; - 1D3623250D0F684500981E51 /* SVGPadAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPadAppDelegate.m; sourceTree = ""; }; - 1D6058910D05DD3D006BFB54 /* SVGPad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SVGPad.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 28042007108E984D000629CD /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; - 28042008108E984D000629CD /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; - 28042009108E984D000629CD /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; - 2804200A108E984D000629CD /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; - 2804203B108E9BAB000629CD /* DetailView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DetailView.xib; sourceTree = ""; }; - 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 28A0AAE50D9B0CCF005BE974 /* SVGPad_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPad_Prefix.pch; sourceTree = ""; }; - 28AD735F0D9D9599002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 3BC23F061488686900FC74CE /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; - 3BF503C1148C62D900CC7D17 /* CGPathAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGPathAdditions.h; sourceTree = ""; }; - 3BF503C2148C62D900CC7D17 /* CGPathAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGPathAdditions.m; sourceTree = ""; }; - 3BF503C3148C62D900CC7D17 /* SVGCircleElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGCircleElement.h; sourceTree = ""; }; - 3BF503C4148C62D900CC7D17 /* SVGCircleElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGCircleElement.m; sourceTree = ""; }; - 3BF503C5148C62D900CC7D17 /* SVGDefsElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDefsElement.h; sourceTree = ""; }; - 3BF503C6148C62D900CC7D17 /* SVGDefsElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDefsElement.m; sourceTree = ""; }; - 3BF503C7148C62D900CC7D17 /* SVGDescriptionElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDescriptionElement.h; sourceTree = ""; }; - 3BF503C8148C62D900CC7D17 /* SVGDescriptionElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDescriptionElement.m; sourceTree = ""; }; - 3BF503C9148C62D900CC7D17 /* SVGDocument+CA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGDocument+CA.h"; sourceTree = ""; }; - 3BF503CA148C62D900CC7D17 /* SVGDocument+CA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SVGDocument+CA.m"; sourceTree = ""; }; - 3BF503CB148C62D900CC7D17 /* SVGDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDocument.h; sourceTree = ""; }; - 3BF503CC148C62D900CC7D17 /* SVGDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDocument.m; sourceTree = ""; }; - 3BF503CD148C62D900CC7D17 /* SVGElement+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGElement+Private.h"; sourceTree = ""; }; - 3BF503CE148C62D900CC7D17 /* SVGElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElement.h; sourceTree = ""; }; - 3BF503CF148C62D900CC7D17 /* SVGElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGElement.m; sourceTree = ""; }; - 3BF503D0148C62D900CC7D17 /* SVGEllipseElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGEllipseElement.h; sourceTree = ""; }; - 3BF503D1148C62D900CC7D17 /* SVGEllipseElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGEllipseElement.m; sourceTree = ""; }; - 3BF503D2148C62D900CC7D17 /* SVGGroupElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGroupElement.h; sourceTree = ""; }; - 3BF503D3148C62D900CC7D17 /* SVGGroupElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGGroupElement.m; sourceTree = ""; }; - 3BF503D4148C62D900CC7D17 /* SVGImageElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageElement.h; sourceTree = ""; }; - 3BF503D5148C62D900CC7D17 /* SVGImageElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGImageElement.m; sourceTree = ""; }; - 3BF503D6148C62D900CC7D17 /* SVGKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGKit.h; sourceTree = ""; }; - 3BF503D7148C62D900CC7D17 /* SVGLineElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLineElement.h; sourceTree = ""; }; - 3BF503D8148C62D900CC7D17 /* SVGLineElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGLineElement.m; sourceTree = ""; }; - 3BF503D9148C62D900CC7D17 /* SVGParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGParser.h; sourceTree = ""; }; - 3BF503DA148C62D900CC7D17 /* SVGParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGParser.m; sourceTree = ""; }; - 3BF503DB148C62D900CC7D17 /* SVGParserSVG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGParserSVG.h; sourceTree = ""; }; - 3BF503DC148C62D900CC7D17 /* SVGParserSVG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGParserSVG.m; sourceTree = ""; }; - 3BF503DD148C62D900CC7D17 /* SVGPathElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathElement.h; sourceTree = ""; }; - 3BF503DE148C62D900CC7D17 /* SVGPathElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPathElement.m; sourceTree = ""; }; - 3BF503DF148C62D900CC7D17 /* SVGPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPattern.h; sourceTree = ""; }; - 3BF503E0148C62D900CC7D17 /* SVGPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPattern.m; sourceTree = ""; }; - 3BF503E1148C62D900CC7D17 /* SVGPolygonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPolygonElement.h; sourceTree = ""; }; - 3BF503E2148C62D900CC7D17 /* SVGPolygonElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPolygonElement.m; sourceTree = ""; }; - 3BF503E3148C62D900CC7D17 /* SVGPolylineElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPolylineElement.h; sourceTree = ""; }; - 3BF503E4148C62D900CC7D17 /* SVGPolylineElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPolylineElement.m; sourceTree = ""; }; - 3BF503E5148C62D900CC7D17 /* SVGRectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectElement.h; sourceTree = ""; }; - 3BF503E6148C62D900CC7D17 /* SVGRectElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGRectElement.m; sourceTree = ""; }; - 3BF503E7148C62D900CC7D17 /* SVGShapeElement+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGShapeElement+Private.h"; sourceTree = ""; }; - 3BF503E8148C62D900CC7D17 /* SVGShapeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGShapeElement.h; sourceTree = ""; }; - 3BF503E9148C62D900CC7D17 /* SVGShapeElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGShapeElement.m; sourceTree = ""; }; - 3BF503EA148C62D900CC7D17 /* SVGTextElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextElement.h; sourceTree = ""; }; - 3BF503EB148C62D900CC7D17 /* SVGTextElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTextElement.m; sourceTree = ""; }; - 3BF503EC148C62D900CC7D17 /* SVGTitleElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTitleElement.h; sourceTree = ""; }; - 3BF503ED148C62D900CC7D17 /* SVGTitleElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTitleElement.m; sourceTree = ""; }; - 3BF503EE148C62D900CC7D17 /* SVGUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGUtils.h; sourceTree = ""; }; - 3BF503EF148C62D900CC7D17 /* SVGUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGUtils.m; sourceTree = ""; }; - 3BF503F1148C62D900CC7D17 /* CALayerWithChildHitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CALayerWithChildHitTest.h; sourceTree = ""; }; - 3BF503F2148C62D900CC7D17 /* CALayerWithChildHitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CALayerWithChildHitTest.m; sourceTree = ""; }; - 3BF503F3148C62D900CC7D17 /* CAShapeLayerWithHitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAShapeLayerWithHitTest.h; sourceTree = ""; }; - 3BF503F4148C62D900CC7D17 /* CAShapeLayerWithHitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CAShapeLayerWithHitTest.m; sourceTree = ""; }; - 3BF503F5148C62D900CC7D17 /* SVGDocumentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGDocumentView.h; sourceTree = ""; }; - 3BF503F6148C62D900CC7D17 /* SVGDocumentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGDocumentView.m; sourceTree = ""; }; - 3BF503F7148C62D900CC7D17 /* SVGPathView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathView.h; sourceTree = ""; }; - 3BF503F8148C62D900CC7D17 /* SVGPathView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPathView.m; sourceTree = ""; }; - 3BF503F9148C62D900CC7D17 /* SVGView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGView.h; sourceTree = ""; }; - 3BF503FA148C62D900CC7D17 /* SVGView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGView.m; sourceTree = ""; }; - 3BF5041B148C63F500CC7D17 /* CurvedDiamond.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CurvedDiamond.svg; sourceTree = ""; }; - 3BF5041C148C63F500CC7D17 /* Lion.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Lion.svg; sourceTree = ""; }; - 3BF5041D148C63F500CC7D17 /* Map.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Map.svg; sourceTree = ""; }; - 3BF5041E148C63F500CC7D17 /* Monkey.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Monkey.svg; sourceTree = ""; }; - 3BF5041F148C63F500CC7D17 /* Note.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Note.svg; sourceTree = ""; }; - 3BF50420148C63F500CC7D17 /* test-wave-1.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test-wave-1.svg"; sourceTree = ""; }; - 3BF50421148C63F500CC7D17 /* Text.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Text.svg; sourceTree = ""; }; - 663C41C4149E638000F546A3 /* SVGPointsAndPathsParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPointsAndPathsParser.h; sourceTree = ""; }; - 663C41C5149E638000F546A3 /* SVGPointsAndPathsParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPointsAndPathsParser.m; sourceTree = ""; }; - 663DEFEB14BFD6BC00C56E07 /* Location_European_nation_states.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Location_European_nation_states.svg; sourceTree = ""; }; - 663DEFEE14BFDAC100C56E07 /* map-test-Location_European_nation_states-ukonly.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "map-test-Location_European_nation_states-ukonly.svg"; sourceTree = ""; }; - 66436E5114A0BCEF001CC769 /* CALayerExporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CALayerExporter.h; sourceTree = ""; }; - 66436E5214A0BCEF001CC769 /* CALayerExporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CALayerExporter.m; sourceTree = ""; }; - 6680A6D2149E4F0B00F2113F /* Blank_Map-Africa.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Blank_Map-Africa.svg"; sourceTree = ""; }; - 6680A6D4149E4F3900F2113F /* Sample Licenses.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Sample Licenses.txt"; sourceTree = ""; }; - 66BBD74215028F0A00102FEF /* map-test-australia_states_blank.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "map-test-australia_states_blank.svg"; sourceTree = ""; }; - 66BBD7451502A4EE00102FEF /* map-test-Location_European_nation_states-adam1.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "map-test-Location_European_nation_states-adam1.svg"; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* SVGPad-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SVGPad-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; - C94B6C5C1274BBFC00B456EB /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 3BC23F071488686900FC74CE /* libxml2.dylib in Frameworks */, - 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */, - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - C94B6C5D1274BBFC00B456EB /* QuartzCore.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Controllers */ = { - isa = PBXGroup; - children = ( - 28042009108E984D000629CD /* DetailViewController.h */, - 2804200A108E984D000629CD /* DetailViewController.m */, - 28042007108E984D000629CD /* RootViewController.h */, - 28042008108E984D000629CD /* RootViewController.m */, - 1D3623240D0F684500981E51 /* SVGPadAppDelegate.h */, - 1D3623250D0F684500981E51 /* SVGPadAppDelegate.m */, - ); - name = Controllers; - path = Classes; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 1D6058910D05DD3D006BFB54 /* SVGPad.app */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { - isa = PBXGroup; - children = ( - 66436E5014A0BCEF001CC769 /* calayer-exporter */, - 080E96DDFE201D6D7F000001 /* Controllers */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - ); - name = CustomTemplate; - sourceTree = ""; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 29B97316FDCFA39411CA2CEA /* main.m */, - 28A0AAE50D9B0CCF005BE974 /* SVGPad_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 3BF5041A148C63F500CC7D17 /* Samples */, - 8D1107310486CEB800E47090 /* SVGPad-Info.plist */, - 28AD735F0D9D9599002E5188 /* MainWindow.xib */, - 2804203B108E9BAB000629CD /* DetailView.xib */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 3BF503BB148C62A800CC7D17 /* SVGKit */, - 3BC23F061488686900FC74CE /* libxml2.dylib */, - C94B6C5C1274BBFC00B456EB /* QuartzCore.framework */, - 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */, - 1D30AB110D05D00D00671497 /* Foundation.framework */, - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 3BF503BB148C62A800CC7D17 /* SVGKit */ = { - isa = PBXGroup; - children = ( - 3BF503C0148C62D900CC7D17 /* Core */, - 3BF503F0148C62D900CC7D17 /* iOS */, - ); - name = SVGKit; - sourceTree = ""; - }; - 3BF503C0148C62D900CC7D17 /* Core */ = { - isa = PBXGroup; - children = ( - 3BF503C1148C62D900CC7D17 /* CGPathAdditions.h */, - 3BF503C2148C62D900CC7D17 /* CGPathAdditions.m */, - 3BF503C3148C62D900CC7D17 /* SVGCircleElement.h */, - 3BF503C4148C62D900CC7D17 /* SVGCircleElement.m */, - 3BF503C5148C62D900CC7D17 /* SVGDefsElement.h */, - 3BF503C6148C62D900CC7D17 /* SVGDefsElement.m */, - 3BF503C7148C62D900CC7D17 /* SVGDescriptionElement.h */, - 3BF503C8148C62D900CC7D17 /* SVGDescriptionElement.m */, - 3BF503C9148C62D900CC7D17 /* SVGDocument+CA.h */, - 3BF503CA148C62D900CC7D17 /* SVGDocument+CA.m */, - 3BF503CB148C62D900CC7D17 /* SVGDocument.h */, - 3BF503CC148C62D900CC7D17 /* SVGDocument.m */, - 3BF503CD148C62D900CC7D17 /* SVGElement+Private.h */, - 3BF503CE148C62D900CC7D17 /* SVGElement.h */, - 3BF503CF148C62D900CC7D17 /* SVGElement.m */, - 3BF503D0148C62D900CC7D17 /* SVGEllipseElement.h */, - 3BF503D1148C62D900CC7D17 /* SVGEllipseElement.m */, - 3BF503D2148C62D900CC7D17 /* SVGGroupElement.h */, - 3BF503D3148C62D900CC7D17 /* SVGGroupElement.m */, - 3BF503D4148C62D900CC7D17 /* SVGImageElement.h */, - 3BF503D5148C62D900CC7D17 /* SVGImageElement.m */, - 3BF503D6148C62D900CC7D17 /* SVGKit.h */, - 3BF503D7148C62D900CC7D17 /* SVGLineElement.h */, - 3BF503D8148C62D900CC7D17 /* SVGLineElement.m */, - 3BF503D9148C62D900CC7D17 /* SVGParser.h */, - 3BF503DA148C62D900CC7D17 /* SVGParser.m */, - 3BF503DB148C62D900CC7D17 /* SVGParserSVG.h */, - 3BF503DC148C62D900CC7D17 /* SVGParserSVG.m */, - 3BF503DD148C62D900CC7D17 /* SVGPathElement.h */, - 3BF503DE148C62D900CC7D17 /* SVGPathElement.m */, - 663C41C4149E638000F546A3 /* SVGPointsAndPathsParser.h */, - 663C41C5149E638000F546A3 /* SVGPointsAndPathsParser.m */, - 3BF503DF148C62D900CC7D17 /* SVGPattern.h */, - 3BF503E0148C62D900CC7D17 /* SVGPattern.m */, - 3BF503E1148C62D900CC7D17 /* SVGPolygonElement.h */, - 3BF503E2148C62D900CC7D17 /* SVGPolygonElement.m */, - 3BF503E3148C62D900CC7D17 /* SVGPolylineElement.h */, - 3BF503E4148C62D900CC7D17 /* SVGPolylineElement.m */, - 3BF503E5148C62D900CC7D17 /* SVGRectElement.h */, - 3BF503E6148C62D900CC7D17 /* SVGRectElement.m */, - 3BF503E7148C62D900CC7D17 /* SVGShapeElement+Private.h */, - 3BF503E8148C62D900CC7D17 /* SVGShapeElement.h */, - 3BF503E9148C62D900CC7D17 /* SVGShapeElement.m */, - 3BF503EA148C62D900CC7D17 /* SVGTextElement.h */, - 3BF503EB148C62D900CC7D17 /* SVGTextElement.m */, - 3BF503EC148C62D900CC7D17 /* SVGTitleElement.h */, - 3BF503ED148C62D900CC7D17 /* SVGTitleElement.m */, - 3BF503EE148C62D900CC7D17 /* SVGUtils.h */, - 3BF503EF148C62D900CC7D17 /* SVGUtils.m */, - ); - name = Core; - path = ../../Core; - sourceTree = ""; - }; - 3BF503F0148C62D900CC7D17 /* iOS */ = { - isa = PBXGroup; - children = ( - 3BF503F1148C62D900CC7D17 /* CALayerWithChildHitTest.h */, - 3BF503F2148C62D900CC7D17 /* CALayerWithChildHitTest.m */, - 3BF503F3148C62D900CC7D17 /* CAShapeLayerWithHitTest.h */, - 3BF503F4148C62D900CC7D17 /* CAShapeLayerWithHitTest.m */, - 3BF503F5148C62D900CC7D17 /* SVGDocumentView.h */, - 3BF503F6148C62D900CC7D17 /* SVGDocumentView.m */, - 3BF503F7148C62D900CC7D17 /* SVGPathView.h */, - 3BF503F8148C62D900CC7D17 /* SVGPathView.m */, - 3BF503F9148C62D900CC7D17 /* SVGView.h */, - 3BF503FA148C62D900CC7D17 /* SVGView.m */, - ); - name = iOS; - path = ../../iOS; - sourceTree = ""; - }; - 3BF5041A148C63F500CC7D17 /* Samples */ = { - isa = PBXGroup; - children = ( - 66BBD7451502A4EE00102FEF /* map-test-Location_European_nation_states-adam1.svg */, - 66BBD74215028F0A00102FEF /* map-test-australia_states_blank.svg */, - 663DEFEE14BFDAC100C56E07 /* map-test-Location_European_nation_states-ukonly.svg */, - 663DEFEB14BFD6BC00C56E07 /* Location_European_nation_states.svg */, - 6680A6D2149E4F0B00F2113F /* Blank_Map-Africa.svg */, - 3BF5041B148C63F500CC7D17 /* CurvedDiamond.svg */, - 3BF5041C148C63F500CC7D17 /* Lion.svg */, - 3BF5041D148C63F500CC7D17 /* Map.svg */, - 3BF5041E148C63F500CC7D17 /* Monkey.svg */, - 3BF5041F148C63F500CC7D17 /* Note.svg */, - 3BF50420148C63F500CC7D17 /* test-wave-1.svg */, - 3BF50421148C63F500CC7D17 /* Text.svg */, - 6680A6D4149E4F3900F2113F /* Sample Licenses.txt */, - ); - name = Samples; - path = ../../Samples; - sourceTree = ""; - }; - 66436E5014A0BCEF001CC769 /* calayer-exporter */ = { - isa = PBXGroup; - children = ( - 66436E5114A0BCEF001CC769 /* CALayerExporter.h */, - 66436E5214A0BCEF001CC769 /* CALayerExporter.m */, - ); - name = "calayer-exporter"; - path = "../../calayer-exporter"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* SVGPad */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "SVGPad" */; - buildPhases = ( - 1D60588D0D05DD3D006BFB54 /* Resources */, - 1D60588E0D05DD3D006BFB54 /* Sources */, - 1D60588F0D05DD3D006BFB54 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SVGPad; - productName = SVGPad; - productReference = 1D6058910D05DD3D006BFB54 /* SVGPad.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0430; - }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SVGPad" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - en, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 1D6058900D05DD3D006BFB54 /* SVGPad */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 1D60588D0D05DD3D006BFB54 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 28AD73600D9D9599002E5188 /* MainWindow.xib in Resources */, - 2804203C108E9BAB000629CD /* DetailView.xib in Resources */, - 3BF50422148C63F500CC7D17 /* CurvedDiamond.svg in Resources */, - 3BF50423148C63F500CC7D17 /* Lion.svg in Resources */, - 3BF50424148C63F500CC7D17 /* Map.svg in Resources */, - 3BF50425148C63F500CC7D17 /* Monkey.svg in Resources */, - 3BF50426148C63F500CC7D17 /* Note.svg in Resources */, - 3BF50427148C63F500CC7D17 /* test-wave-1.svg in Resources */, - 3BF50428148C63F500CC7D17 /* Text.svg in Resources */, - 6680A6D3149E4F0B00F2113F /* Blank_Map-Africa.svg in Resources */, - 6680A6D5149E4F3900F2113F /* Sample Licenses.txt in Resources */, - 663DEFEC14BFD6BC00C56E07 /* Location_European_nation_states.svg in Resources */, - 663DEFEF14BFDAC100C56E07 /* map-test-Location_European_nation_states-ukonly.svg in Resources */, - 66BBD74315028F0A00102FEF /* map-test-australia_states_blank.svg in Resources */, - 66BBD7461502A4EE00102FEF /* map-test-Location_European_nation_states-adam1.svg in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 1D60588E0D05DD3D006BFB54 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589B0D05DD56006BFB54 /* main.m in Sources */, - 1D3623260D0F684500981E51 /* SVGPadAppDelegate.m in Sources */, - 2804200B108E984D000629CD /* RootViewController.m in Sources */, - 2804200C108E984D000629CD /* DetailViewController.m in Sources */, - 3BF503FB148C62D900CC7D17 /* CGPathAdditions.m in Sources */, - 3BF503FC148C62D900CC7D17 /* SVGCircleElement.m in Sources */, - 3BF503FD148C62D900CC7D17 /* SVGDefsElement.m in Sources */, - 3BF503FE148C62D900CC7D17 /* SVGDescriptionElement.m in Sources */, - 3BF503FF148C62D900CC7D17 /* SVGDocument+CA.m in Sources */, - 3BF50400148C62D900CC7D17 /* SVGDocument.m in Sources */, - 3BF50401148C62D900CC7D17 /* SVGElement.m in Sources */, - 3BF50402148C62D900CC7D17 /* SVGEllipseElement.m in Sources */, - 3BF50403148C62D900CC7D17 /* SVGGroupElement.m in Sources */, - 3BF50404148C62D900CC7D17 /* SVGImageElement.m in Sources */, - 3BF50405148C62D900CC7D17 /* SVGLineElement.m in Sources */, - 3BF50406148C62D900CC7D17 /* SVGParser.m in Sources */, - 3BF50407148C62D900CC7D17 /* SVGParserSVG.m in Sources */, - 3BF50408148C62D900CC7D17 /* SVGPathElement.m in Sources */, - 3BF50409148C62D900CC7D17 /* SVGPattern.m in Sources */, - 3BF5040A148C62D900CC7D17 /* SVGPolygonElement.m in Sources */, - 3BF5040B148C62D900CC7D17 /* SVGPolylineElement.m in Sources */, - 3BF5040C148C62D900CC7D17 /* SVGRectElement.m in Sources */, - 3BF5040D148C62D900CC7D17 /* SVGShapeElement.m in Sources */, - 3BF5040E148C62D900CC7D17 /* SVGTextElement.m in Sources */, - 3BF5040F148C62D900CC7D17 /* SVGTitleElement.m in Sources */, - 3BF50410148C62D900CC7D17 /* SVGUtils.m in Sources */, - 3BF50411148C62D900CC7D17 /* CALayerWithChildHitTest.m in Sources */, - 3BF50412148C62D900CC7D17 /* CAShapeLayerWithHitTest.m in Sources */, - 3BF50413148C62D900CC7D17 /* SVGDocumentView.m in Sources */, - 3BF50414148C62D900CC7D17 /* SVGPathView.m in Sources */, - 3BF50415148C62D900CC7D17 /* SVGView.m in Sources */, - 663C41C6149E638000F546A3 /* SVGPointsAndPathsParser.m in Sources */, - 66436E5314A0BCEF001CC769 /* CALayerExporter.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1D6058940D05DD3E006BFB54 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = SVGPad_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = DEBUG; - HEADER_SEARCH_PATHS = /usr/include/libxml2; - INFOPLIST_FILE = "SVGPad-Info.plist"; - PRODUCT_NAME = SVGPad; - }; - name = Debug; - }; - 1D6058950D05DD3E006BFB54 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = SVGPad_Prefix.pch; - HEADER_SEARCH_PATHS = /usr/include/libxml2; - INFOPLIST_FILE = "SVGPad-Info.plist"; - PRODUCT_NAME = SVGPad; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.2; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = 2; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.2; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = 2; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "SVGPad" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1D6058940D05DD3E006BFB54 /* Debug */, - 1D6058950D05DD3E006BFB54 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SVGPad" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/XCodeProjects/SVGPadDemo/SVGPad_Prefix.pch b/XCodeProjects/SVGPadDemo/SVGPad_Prefix.pch deleted file mode 100644 index d6eb0699b..000000000 --- a/XCodeProjects/SVGPadDemo/SVGPad_Prefix.pch +++ /dev/null @@ -1,17 +0,0 @@ -// -// Prefix header for all source files of the 'SVGPad' target in the 'SVGPad' project -// - -#import - -#ifndef __IPHONE_3_2 -#warning "This project uses features only available in iPhone SDK 3.2 and later." -#endif - -#define OUTLINE_SHAPES 1 - -#ifdef __OBJC__ - #import - #import - #import "SVGKit.h" -#endif diff --git a/XCodeProjects/SVGPadDemo/main.m b/XCodeProjects/SVGPadDemo/main.m deleted file mode 100644 index 8f84c1dab..000000000 --- a/XCodeProjects/SVGPadDemo/main.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// main.m -// SVGPad -// -// Copyright Matt Rajca 2010. All rights reserved. -// - -int main (int argc, char *argv[]) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - int retVal = UIApplicationMain(argc, argv, nil, nil); - [pool release]; - - return retVal; -} diff --git a/XCodeProjects/SVGTesterDemo/Classes/ComparisonView.h b/XCodeProjects/SVGTesterDemo/Classes/ComparisonView.h deleted file mode 100644 index 9a0d44716..000000000 --- a/XCodeProjects/SVGTesterDemo/Classes/ComparisonView.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ComparisonView.h -// SVGTester -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -@interface ComparisonView : NSView { - @private - NSBitmapImageRep *_original; - NSBitmapImageRep *_output; -} - -- (void)compareImage:(NSBitmapImageRep *)image withOriginal:(NSBitmapImageRep *)original; - -@end diff --git a/XCodeProjects/SVGTesterDemo/Classes/ComparisonView.m b/XCodeProjects/SVGTesterDemo/Classes/ComparisonView.m deleted file mode 100644 index d7b4ec1e2..000000000 --- a/XCodeProjects/SVGTesterDemo/Classes/ComparisonView.m +++ /dev/null @@ -1,70 +0,0 @@ -// -// ComparisonView.m -// SVGTester -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -#import "ComparisonView.h" - -@implementation ComparisonView - -- (void)compareImage:(NSBitmapImageRep *)image withOriginal:(NSBitmapImageRep *)original { - if (!NSEqualSizes([image size], [original size])) { - NSLog(@"Invalid image sizes"); - return; - } - - _original = [image retain]; - - _output = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:image.size.width - pixelsHigh:image.size.height - bitsPerSample:8 - samplesPerPixel:3 - hasAlpha:NO - isPlanar:NO - colorSpaceName:NSCalibratedRGBColorSpace - bytesPerRow:4 * image.size.width - bitsPerPixel:32]; - - for (NSUInteger x = 0; x < image.size.width; x++) { - for (NSUInteger y = 0; y < image.size.height; y++) { - NSUInteger comps[3]; - [image getPixel:comps atX:x y:y]; - - NSUInteger compsTwo[3]; - [original getPixel:compsTwo atX:x y:y]; - - if (comps[0] == compsTwo[0] && comps[1] == compsTwo[1] && comps[2] == compsTwo[2]) { - [_output setColor:[NSColor greenColor] atX:x y:y]; - } - else { - [_output setColor:[NSColor redColor] atX:x y:y]; - } - } - } - - [self setNeedsDisplay:YES]; -} - -- (void)drawRect:(NSRect)dirtyRect { - if (!_output) - return; - - NSSize size = _original.size; - - NSPoint origin = NSMakePoint((int) (self.bounds.size.width - size.width) / 2, - (int) (self.bounds.size.height - size.height) / 2); - - [_original drawAtPoint:origin]; - - [_output drawInRect:NSMakeRect(origin.x, origin.y, size.width, size.height) - fromRect:NSZeroRect - operation:NSCompositeSourceOver - fraction:0.4f - respectFlipped:NO - hints:nil]; -} - -@end diff --git a/XCodeProjects/SVGTesterDemo/Classes/MainWindowController.h b/XCodeProjects/SVGTesterDemo/Classes/MainWindowController.h deleted file mode 100644 index 5930d3a1b..000000000 --- a/XCodeProjects/SVGTesterDemo/Classes/MainWindowController.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// MainWindowController.h -// SVGTester -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -#import -#import "ComparisonView.h" - -@interface MainWindowController : NSWindowController { - @private - NSArray *_names; - NSUInteger _currentIndex; -} - -@property (nonatomic, retain) IBOutlet ComparisonView *view; - -- (IBAction)next:(id)sender; - -@end diff --git a/XCodeProjects/SVGTesterDemo/Classes/MainWindowController.m b/XCodeProjects/SVGTesterDemo/Classes/MainWindowController.m deleted file mode 100644 index 7695eb85f..000000000 --- a/XCodeProjects/SVGTesterDemo/Classes/MainWindowController.m +++ /dev/null @@ -1,74 +0,0 @@ -// -// MainWindowController.m -// SVGTester -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -#import "MainWindowController.h" - -@implementation MainWindowController - -@synthesize view = _view; - -- (id)init { - self = [super initWithWindowNibName:@"MainWindow"]; - if (self) { - _names = [NSArray arrayWithObjects:@"Monkey.svg", @"Note.svg", nil]; - _currentIndex = 0; - } - return self; -} - -- (IBAction)next:(id)sender { - NSString *name = [_names objectAtIndex:_currentIndex]; - - SVGDocument *document = [SVGDocument documentNamed:name]; - - NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:document.width - pixelsHigh:document.height - bitsPerSample:8 - samplesPerPixel:3 - hasAlpha:NO - isPlanar:NO - colorSpaceName:NSCalibratedRGBColorSpace - bytesPerRow:4 * document.width - bitsPerPixel:32]; - - CGContextRef context = [[NSGraphicsContext graphicsContextWithBitmapImageRep:rep] graphicsPort]; - - CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // white background - CGContextFillRect(context, CGRectMake(0.0f, 0.0f, document.width, document.height)); - - CGContextScaleCTM(context, 1.0f, -1.0f); // flip - CGContextTranslateCTM(context, 0.0f, -document.height); - - [[document layerTree] renderInContext:context]; - - CGImageRef image = CGBitmapContextCreateImage(context); - - NSBitmapImageRep *rendering = [[NSBitmapImageRep alloc] initWithCGImage:image]; - CGImageRelease(image); - - NSString *imageName = [name stringByReplacingOccurrencesOfString:@"svg" withString:@"png"]; - NSString *file = [[NSBundle mainBundle] pathForImageResource:imageName]; - - NSData *data = [NSData dataWithContentsOfFile:file]; - NSBitmapImageRep *original = [[NSBitmapImageRep alloc] initWithData:data]; - - [_view compareImage:rendering withOriginal:original]; - - if (_currentIndex == [_names count] - 1) { - [sender setEnabled:NO]; - } - - _currentIndex++; -} - -- (void)windowDidLoad { - [super windowDidLoad]; - [self next:nil]; -} - -@end diff --git a/XCodeProjects/SVGTesterDemo/Classes/SVGTesterAppDelegate.h b/XCodeProjects/SVGTesterDemo/Classes/SVGTesterAppDelegate.h deleted file mode 100644 index 1842e1552..000000000 --- a/XCodeProjects/SVGTesterDemo/Classes/SVGTesterAppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// SVGTesterAppDelegate.h -// SVGTester -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -@class MainWindowController; - -@interface SVGTesterAppDelegate : NSObject < NSApplicationDelegate > { - @private - MainWindowController *_controller; -} - -@end diff --git a/XCodeProjects/SVGTesterDemo/Classes/SVGTesterAppDelegate.m b/XCodeProjects/SVGTesterDemo/Classes/SVGTesterAppDelegate.m deleted file mode 100644 index efa4cef12..000000000 --- a/XCodeProjects/SVGTesterDemo/Classes/SVGTesterAppDelegate.m +++ /dev/null @@ -1,22 +0,0 @@ -// -// SVGTesterAppDelegate.m -// SVGTester -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -#import "SVGTesterAppDelegate.h" - -#import "MainWindowController.h" - -@implementation SVGTesterAppDelegate - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - if (!_controller) { - _controller = [[MainWindowController alloc] init]; - } - - [_controller showWindow:self]; -} - -@end diff --git a/XCodeProjects/SVGTesterDemo/SVGTester-Info.plist b/XCodeProjects/SVGTesterDemo/SVGTester-Info.plist deleted file mode 100644 index dfbe30bc1..000000000 --- a/XCodeProjects/SVGTesterDemo/SVGTester-Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.MattRajca.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/XCodeProjects/SVGTesterDemo/SVGTester-Prefix.pch b/XCodeProjects/SVGTesterDemo/SVGTester-Prefix.pch deleted file mode 100644 index a6ba44c68..000000000 --- a/XCodeProjects/SVGTesterDemo/SVGTester-Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'SVGTester' target in the 'SVGTester' project -// - -#ifdef __OBJC__ - #import -#endif diff --git a/XCodeProjects/SVGTesterDemo/SVGTester.xcodeproj/project.pbxproj b/XCodeProjects/SVGTesterDemo/SVGTester.xcodeproj/project.pbxproj deleted file mode 100644 index 66e9a6140..000000000 --- a/XCodeProjects/SVGTesterDemo/SVGTester.xcodeproj/project.pbxproj +++ /dev/null @@ -1,429 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 3B86B3CD148C661C0082ACCF /* SVGKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B86B3CA148C66030082ACCF /* SVGKit.framework */; }; - 3B86B3D7148C66AE0082ACCF /* CurvedDiamond.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3D0148C66AE0082ACCF /* CurvedDiamond.svg */; }; - 3B86B3D8148C66AE0082ACCF /* Lion.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3D1148C66AE0082ACCF /* Lion.svg */; }; - 3B86B3D9148C66AE0082ACCF /* Map.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3D2148C66AE0082ACCF /* Map.svg */; }; - 3B86B3DA148C66AE0082ACCF /* Monkey.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3D3148C66AE0082ACCF /* Monkey.svg */; }; - 3B86B3DB148C66AE0082ACCF /* Note.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3D4148C66AE0082ACCF /* Note.svg */; }; - 3B86B3DC148C66AE0082ACCF /* test-wave-1.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3D5148C66AE0082ACCF /* test-wave-1.svg */; }; - 3B86B3DD148C66AE0082ACCF /* Text.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3D6148C66AE0082ACCF /* Text.svg */; }; - 3B86B3E1148C66B50082ACCF /* Monkey.png in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3DF148C66B50082ACCF /* Monkey.png */; }; - 3B86B3E2148C66B50082ACCF /* Note.png in Resources */ = {isa = PBXBuildFile; fileRef = 3B86B3E0148C66B50082ACCF /* Note.png */; }; - C9A1718013477A440048E122 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9A1717F13477A440048E122 /* Cocoa.framework */; }; - C9FC228F1347924600A91703 /* ComparisonView.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FC228A1347924600A91703 /* ComparisonView.m */; }; - C9FC22901347924600A91703 /* MainWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FC228C1347924600A91703 /* MainWindowController.m */; }; - C9FC22911347924600A91703 /* SVGTesterAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FC228E1347924600A91703 /* SVGTesterAppDelegate.m */; }; - C9FC22971347928C00A91703 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9FC22931347928C00A91703 /* MainMenu.xib */; }; - C9FC22981347928C00A91703 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9FC22951347928C00A91703 /* MainWindow.xib */; }; - C9FC229D134792A800A91703 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FC229A134792A800A91703 /* main.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 3B86B3C9148C66030082ACCF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3B86B3C1148C66030082ACCF /* SVGKit.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = SVGKit; - }; - 3B86B3CB148C66030082ACCF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3B86B3C1148C66030082ACCF /* SVGKit.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 66213432148AF2CF006881E1; - remoteInfo = SVGKitLibrary; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - C9A171BB13477B6A0048E122 /* Copy Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Copy Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 3B86B3C1148C66030082ACCF /* SVGKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SVGKit.xcodeproj; path = ../SVGKit/SVGKit.xcodeproj; sourceTree = ""; }; - 3B86B3D0148C66AE0082ACCF /* CurvedDiamond.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CurvedDiamond.svg; sourceTree = ""; }; - 3B86B3D1148C66AE0082ACCF /* Lion.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Lion.svg; sourceTree = ""; }; - 3B86B3D2148C66AE0082ACCF /* Map.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Map.svg; sourceTree = ""; }; - 3B86B3D3148C66AE0082ACCF /* Monkey.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Monkey.svg; sourceTree = ""; }; - 3B86B3D4148C66AE0082ACCF /* Note.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Note.svg; sourceTree = ""; }; - 3B86B3D5148C66AE0082ACCF /* test-wave-1.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test-wave-1.svg"; sourceTree = ""; }; - 3B86B3D6148C66AE0082ACCF /* Text.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Text.svg; sourceTree = ""; }; - 3B86B3DF148C66B50082ACCF /* Monkey.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Monkey.png; sourceTree = ""; }; - 3B86B3E0148C66B50082ACCF /* Note.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Note.png; sourceTree = ""; }; - C9A1717B13477A440048E122 /* SVGTester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SVGTester.app; sourceTree = BUILT_PRODUCTS_DIR; }; - C9A1717F13477A440048E122 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; - C9A1718213477A440048E122 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; - C9A1718313477A440048E122 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; - C9A1718413477A440048E122 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - C9FC22891347924600A91703 /* ComparisonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComparisonView.h; sourceTree = ""; }; - C9FC228A1347924600A91703 /* ComparisonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ComparisonView.m; sourceTree = ""; }; - C9FC228B1347924600A91703 /* MainWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainWindowController.h; sourceTree = ""; }; - C9FC228C1347924600A91703 /* MainWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainWindowController.m; sourceTree = ""; }; - C9FC228D1347924600A91703 /* SVGTesterAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTesterAppDelegate.h; sourceTree = ""; }; - C9FC228E1347924600A91703 /* SVGTesterAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTesterAppDelegate.m; sourceTree = ""; }; - C9FC22941347928C00A91703 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; - C9FC22961347928C00A91703 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; - C9FC229A134792A800A91703 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - C9FC229B134792A800A91703 /* SVGTester-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SVGTester-Info.plist"; sourceTree = ""; }; - C9FC229C134792A800A91703 /* SVGTester-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVGTester-Prefix.pch"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - C9A1717813477A440048E122 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 3B86B3CD148C661C0082ACCF /* SVGKit.framework in Frameworks */, - C9A1718013477A440048E122 /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 3B86B3C2148C66030082ACCF /* Products */ = { - isa = PBXGroup; - children = ( - 3B86B3CA148C66030082ACCF /* SVGKit.framework */, - 3B86B3CC148C66030082ACCF /* libSVGKitLibrary.a */, - ); - name = Products; - sourceTree = ""; - }; - 3B86B3CF148C66AE0082ACCF /* Samples */ = { - isa = PBXGroup; - children = ( - 3B86B3D0148C66AE0082ACCF /* CurvedDiamond.svg */, - 3B86B3D1148C66AE0082ACCF /* Lion.svg */, - 3B86B3D2148C66AE0082ACCF /* Map.svg */, - 3B86B3D3148C66AE0082ACCF /* Monkey.svg */, - 3B86B3D4148C66AE0082ACCF /* Note.svg */, - 3B86B3D5148C66AE0082ACCF /* test-wave-1.svg */, - 3B86B3D6148C66AE0082ACCF /* Text.svg */, - ); - name = Samples; - path = ../../Samples; - sourceTree = ""; - }; - 3B86B3DE148C66B50082ACCF /* RenderedSamples */ = { - isa = PBXGroup; - children = ( - 3B86B3DF148C66B50082ACCF /* Monkey.png */, - 3B86B3E0148C66B50082ACCF /* Note.png */, - ); - name = RenderedSamples; - path = ../../RenderedSamples; - sourceTree = ""; - }; - C9A1717013477A440048E122 = { - isa = PBXGroup; - children = ( - 3B86B3C1148C66030082ACCF /* SVGKit.xcodeproj */, - C9FC22881347924600A91703 /* Classes */, - C9FC22921347926E00A91703 /* Resources */, - C9FC22991347929600A91703 /* Support Files */, - C9A1717E13477A440048E122 /* Frameworks */, - C9A1717C13477A440048E122 /* Products */, - ); - sourceTree = ""; - }; - C9A1717C13477A440048E122 /* Products */ = { - isa = PBXGroup; - children = ( - C9A1717B13477A440048E122 /* SVGTester.app */, - ); - name = Products; - sourceTree = ""; - }; - C9A1717E13477A440048E122 /* Frameworks */ = { - isa = PBXGroup; - children = ( - C9A1717F13477A440048E122 /* Cocoa.framework */, - C9A1718113477A440048E122 /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; - C9A1718113477A440048E122 /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - C9A1718213477A440048E122 /* AppKit.framework */, - C9A1718313477A440048E122 /* CoreData.framework */, - C9A1718413477A440048E122 /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - C9FC22881347924600A91703 /* Classes */ = { - isa = PBXGroup; - children = ( - C9FC22891347924600A91703 /* ComparisonView.h */, - C9FC228A1347924600A91703 /* ComparisonView.m */, - C9FC228B1347924600A91703 /* MainWindowController.h */, - C9FC228C1347924600A91703 /* MainWindowController.m */, - C9FC228D1347924600A91703 /* SVGTesterAppDelegate.h */, - C9FC228E1347924600A91703 /* SVGTesterAppDelegate.m */, - ); - path = Classes; - sourceTree = ""; - }; - C9FC22921347926E00A91703 /* Resources */ = { - isa = PBXGroup; - children = ( - 3B86B3DE148C66B50082ACCF /* RenderedSamples */, - 3B86B3CF148C66AE0082ACCF /* Samples */, - C9FC22931347928C00A91703 /* MainMenu.xib */, - C9FC22951347928C00A91703 /* MainWindow.xib */, - ); - name = Resources; - sourceTree = ""; - }; - C9FC22991347929600A91703 /* Support Files */ = { - isa = PBXGroup; - children = ( - C9FC229A134792A800A91703 /* main.m */, - C9FC229B134792A800A91703 /* SVGTester-Info.plist */, - C9FC229C134792A800A91703 /* SVGTester-Prefix.pch */, - ); - name = "Support Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - C9A1717A13477A440048E122 /* SVGTester */ = { - isa = PBXNativeTarget; - buildConfigurationList = C9A1719913477A450048E122 /* Build configuration list for PBXNativeTarget "SVGTester" */; - buildPhases = ( - C9A1717713477A440048E122 /* Sources */, - C9A1717813477A440048E122 /* Frameworks */, - C9A1717913477A440048E122 /* Resources */, - C9A171BB13477B6A0048E122 /* Copy Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SVGTester; - productName = SVGTester; - productReference = C9A1717B13477A440048E122 /* SVGTester.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - C9A1717213477A440048E122 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0420; - ORGANIZATIONNAME = "Matt Rajca"; - }; - buildConfigurationList = C9A1717513477A440048E122 /* Build configuration list for PBXProject "SVGTester" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = C9A1717013477A440048E122; - productRefGroup = C9A1717C13477A440048E122 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 3B86B3C2148C66030082ACCF /* Products */; - ProjectRef = 3B86B3C1148C66030082ACCF /* SVGKit.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - C9A1717A13477A440048E122 /* SVGTester */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 3B86B3CA148C66030082ACCF /* SVGKit.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SVGKit.framework; - remoteRef = 3B86B3C9148C66030082ACCF /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3B86B3CC148C66030082ACCF /* libSVGKitLibrary.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libSVGKitLibrary.a; - remoteRef = 3B86B3CB148C66030082ACCF /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - C9A1717913477A440048E122 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C9FC22971347928C00A91703 /* MainMenu.xib in Resources */, - C9FC22981347928C00A91703 /* MainWindow.xib in Resources */, - 3B86B3D7148C66AE0082ACCF /* CurvedDiamond.svg in Resources */, - 3B86B3D8148C66AE0082ACCF /* Lion.svg in Resources */, - 3B86B3D9148C66AE0082ACCF /* Map.svg in Resources */, - 3B86B3DA148C66AE0082ACCF /* Monkey.svg in Resources */, - 3B86B3DB148C66AE0082ACCF /* Note.svg in Resources */, - 3B86B3DC148C66AE0082ACCF /* test-wave-1.svg in Resources */, - 3B86B3DD148C66AE0082ACCF /* Text.svg in Resources */, - 3B86B3E1148C66B50082ACCF /* Monkey.png in Resources */, - 3B86B3E2148C66B50082ACCF /* Note.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - C9A1717713477A440048E122 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C9FC228F1347924600A91703 /* ComparisonView.m in Sources */, - C9FC22901347924600A91703 /* MainWindowController.m in Sources */, - C9FC22911347924600A91703 /* SVGTesterAppDelegate.m in Sources */, - C9FC229D134792A800A91703 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - C9FC22931347928C00A91703 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - C9FC22941347928C00A91703 /* en */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; - C9FC22951347928C00A91703 /* MainWindow.xib */ = { - isa = PBXVariantGroup; - children = ( - C9FC22961347928C00A91703 /* en */, - ); - name = MainWindow.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C9A1719713477A450048E122 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = DEBUG; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.6; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - C9A1719813477A450048E122 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = macosx; - }; - name = Release; - }; - C9A1719A13477A450048E122 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_ENABLE_OBJC_GC = required; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SVGTester-Prefix.pch"; - HEADER_SEARCH_PATHS = ( - ../../Core, - ../../Mac, - ); - INFOPLIST_FILE = "SVGTester-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - C9A1719B13477A450048E122 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_ENABLE_OBJC_GC = required; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SVGTester-Prefix.pch"; - HEADER_SEARCH_PATHS = ( - ../../Core, - ../../Mac, - ); - INFOPLIST_FILE = "SVGTester-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C9A1717513477A440048E122 /* Build configuration list for PBXProject "SVGTester" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C9A1719713477A450048E122 /* Debug */, - C9A1719813477A450048E122 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C9A1719913477A450048E122 /* Build configuration list for PBXNativeTarget "SVGTester" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C9A1719A13477A450048E122 /* Debug */, - C9A1719B13477A450048E122 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = C9A1717213477A440048E122 /* Project object */; -} diff --git a/XCodeProjects/SVGTesterDemo/en.lproj/MainMenu.xib b/XCodeProjects/SVGTesterDemo/en.lproj/MainMenu.xib deleted file mode 100644 index dfaf42fe4..000000000 --- a/XCodeProjects/SVGTesterDemo/en.lproj/MainMenu.xib +++ /dev/null @@ -1,3292 +0,0 @@ - - - - 1060 - 11A419 - 1530 - 1115.2 - 549.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1530 - - - YES - NSMenu - NSMenuItem - NSCustomObject - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - YES - - YES - - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - SVGTester - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - SVGTester - - YES - - - About SVGTester - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide SVGTester - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit SVGTester - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - File - - 1048576 - 2147483647 - - - submenuAction: - - File - - YES - - - Close - w - 1048576 - 2147483647 - - - - - - - - - Edit - - 1048576 - 2147483647 - - - submenuAction: - - Edit - - YES - - - Undo - z - 1048576 - 2147483647 - - - - - - Redo - Z - 1179648 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Cut - x - 1048576 - 2147483647 - - - - - - Copy - c - 1048576 - 2147483647 - - - - - - Paste - v - 1048576 - 2147483647 - - - - - - Paste and Match Style - V - 1572864 - 2147483647 - - - - - - Delete - - 1048576 - 2147483647 - - - - - - Select All - a - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Find - - 1048576 - 2147483647 - - - submenuAction: - - Find - - YES - - - Find… - f - 1048576 - 2147483647 - - - 1 - - - - Find Next - g - 1048576 - 2147483647 - - - 2 - - - - Find Previous - G - 1179648 - 2147483647 - - - 3 - - - - Use Selection for Find - e - 1048576 - 2147483647 - - - 7 - - - - Jump to Selection - j - 1048576 - 2147483647 - - - - - - - - - Spelling and Grammar - - 1048576 - 2147483647 - - - submenuAction: - - Spelling and Grammar - - YES - - - Show Spelling and Grammar - : - 1048576 - 2147483647 - - - - - - Check Document Now - ; - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Check Spelling While Typing - - 1048576 - 2147483647 - - - - - - Check Grammar With Spelling - - 1048576 - 2147483647 - - - - - - Correct Spelling Automatically - - 2147483647 - - - - - - - - - Substitutions - - 1048576 - 2147483647 - - - submenuAction: - - Substitutions - - YES - - - Show Substitutions - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Smart Copy/Paste - f - 1048576 - 2147483647 - - - 1 - - - - Smart Quotes - g - 1048576 - 2147483647 - - - 2 - - - - Smart Dashes - - 2147483647 - - - - - - Smart Links - G - 1179648 - 2147483647 - - - 3 - - - - Text Replacement - - 2147483647 - - - - - - - - - Transformations - - 2147483647 - - - submenuAction: - - Transformations - - YES - - - Make Upper Case - - 2147483647 - - - - - - Make Lower Case - - 2147483647 - - - - - - Capitalize - - 2147483647 - - - - - - - - - Speech - - 1048576 - 2147483647 - - - submenuAction: - - Speech - - YES - - - Start Speaking - - 1048576 - 2147483647 - - - - - - Stop Speaking - - 1048576 - 2147483647 - - - - - - - - - - - - Format - - 2147483647 - - - submenuAction: - - Format - - YES - - - Font - - 2147483647 - - - submenuAction: - - Font - - YES - - - Show Fonts - t - 1048576 - 2147483647 - - - - - - Bold - b - 1048576 - 2147483647 - - - 2 - - - - Italic - i - 1048576 - 2147483647 - - - 1 - - - - Underline - u - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Bigger - + - 1048576 - 2147483647 - - - 3 - - - - Smaller - - - 1048576 - 2147483647 - - - 4 - - - - YES - YES - - - 2147483647 - - - - - - Kern - - 2147483647 - - - submenuAction: - - Kern - - YES - - - Use Default - - 2147483647 - - - - - - Use None - - 2147483647 - - - - - - Tighten - - 2147483647 - - - - - - Loosen - - 2147483647 - - - - - - - - - Ligature - - 2147483647 - - - submenuAction: - - Ligature - - YES - - - Use Default - - 2147483647 - - - - - - Use None - - 2147483647 - - - - - - Use All - - 2147483647 - - - - - - - - - Baseline - - 2147483647 - - - submenuAction: - - Baseline - - YES - - - Use Default - - 2147483647 - - - - - - Superscript - - 2147483647 - - - - - - Subscript - - 2147483647 - - - - - - Raise - - 2147483647 - - - - - - Lower - - 2147483647 - - - - - - - - - YES - YES - - - 2147483647 - - - - - - Show Colors - C - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Copy Style - c - 1572864 - 2147483647 - - - - - - Paste Style - v - 1572864 - 2147483647 - - - - - _NSFontMenu - - - - - Text - - 2147483647 - - - submenuAction: - - Text - - YES - - - Align Left - { - 1048576 - 2147483647 - - - - - - Center - | - 1048576 - 2147483647 - - - - - - Justify - - 2147483647 - - - - - - Align Right - } - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Writing Direction - - 2147483647 - - - submenuAction: - - Writing Direction - - YES - - - YES - Paragraph - - 2147483647 - - - - - - CURlZmF1bHQ - - 2147483647 - - - - - - CUxlZnQgdG8gUmlnaHQ - - 2147483647 - - - - - - CVJpZ2h0IHRvIExlZnQ - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - YES - Selection - - 2147483647 - - - - - - CURlZmF1bHQ - - 2147483647 - - - - - - CUxlZnQgdG8gUmlnaHQ - - 2147483647 - - - - - - CVJpZ2h0IHRvIExlZnQ - - 2147483647 - - - - - - - - - YES - YES - - - 2147483647 - - - - - - Show Ruler - - 2147483647 - - - - - - Copy Ruler - c - 1310720 - 2147483647 - - - - - - Paste Ruler - v - 1310720 - 2147483647 - - - - - - - - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Show Toolbar - t - 1572864 - 2147483647 - - - - - - Customize Toolbar… - - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - SVGTester Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - SVGTesterAppDelegate - - - NSFontManager - - - - - YES - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - performClose: - - - - 193 - - - - toggleContinuousSpellChecking: - - - - 222 - - - - undo: - - - - 223 - - - - copy: - - - - 224 - - - - checkSpelling: - - - - 225 - - - - paste: - - - - 226 - - - - stopSpeaking: - - - - 227 - - - - cut: - - - - 228 - - - - showGuessPanel: - - - - 230 - - - - redo: - - - - 231 - - - - selectAll: - - - - 232 - - - - startSpeaking: - - - - 233 - - - - delete: - - - - 235 - - - - performZoom: - - - - 240 - - - - performFindPanelAction: - - - - 241 - - - - centerSelectionInVisibleArea: - - - - 245 - - - - toggleGrammarChecking: - - - - 347 - - - - toggleSmartInsertDelete: - - - - 355 - - - - toggleAutomaticQuoteSubstitution: - - - - 356 - - - - toggleAutomaticLinkDetection: - - - - 357 - - - - runToolbarCustomizationPalette: - - - - 365 - - - - toggleToolbarShown: - - - - 366 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - addFontTrait: - - - - 421 - - - - addFontTrait: - - - - 422 - - - - modifyFont: - - - - 423 - - - - orderFrontFontPanel: - - - - 424 - - - - modifyFont: - - - - 425 - - - - raiseBaseline: - - - - 426 - - - - lowerBaseline: - - - - 427 - - - - copyFont: - - - - 428 - - - - subscript: - - - - 429 - - - - superscript: - - - - 430 - - - - tightenKerning: - - - - 431 - - - - underline: - - - - 432 - - - - orderFrontColorPanel: - - - - 433 - - - - useAllLigatures: - - - - 434 - - - - loosenKerning: - - - - 435 - - - - pasteFont: - - - - 436 - - - - unscript: - - - - 437 - - - - useStandardKerning: - - - - 438 - - - - useStandardLigatures: - - - - 439 - - - - turnOffLigatures: - - - - 440 - - - - turnOffKerning: - - - - 441 - - - - terminate: - - - - 449 - - - - toggleAutomaticSpellingCorrection: - - - - 456 - - - - orderFrontSubstitutionsPanel: - - - - 458 - - - - toggleAutomaticDashSubstitution: - - - - 461 - - - - toggleAutomaticTextReplacement: - - - - 463 - - - - uppercaseWord: - - - - 464 - - - - capitalizeWord: - - - - 467 - - - - lowercaseWord: - - - - 468 - - - - pasteAsPlainText: - - - - 486 - - - - performFindPanelAction: - - - - 487 - - - - performFindPanelAction: - - - - 488 - - - - performFindPanelAction: - - - - 489 - - - - showHelp: - - - - 493 - - - - delegate - - - - 495 - - - - alignCenter: - - - - 518 - - - - pasteRuler: - - - - 519 - - - - toggleRuler: - - - - 520 - - - - alignRight: - - - - 521 - - - - copyRuler: - - - - 522 - - - - alignJustified: - - - - 523 - - - - alignLeft: - - - - 524 - - - - makeBaseWritingDirectionNatural: - - - - 525 - - - - makeBaseWritingDirectionLeftToRight: - - - - 526 - - - - makeBaseWritingDirectionRightToLeft: - - - - 527 - - - - makeTextWritingDirectionNatural: - - - - 528 - - - - makeTextWritingDirectionLeftToRight: - - - - 529 - - - - makeTextWritingDirectionRightToLeft: - - - - 530 - - - - - YES - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 217 - - - YES - - - - - - 83 - - - YES - - - - - - 81 - - - YES - - - - - - 73 - - - - - 205 - - - YES - - - - - - - - - - - - - - - - - - - - 202 - - - - - 198 - - - - - 207 - - - - - 214 - - - - - 199 - - - - - 203 - - - - - 197 - - - - - 206 - - - - - 215 - - - - - 218 - - - YES - - - - - - 216 - - - YES - - - - - - 200 - - - YES - - - - - - - - - - - 219 - - - - - 201 - - - - - 204 - - - - - 220 - - - YES - - - - - - - - - - 213 - - - - - 210 - - - - - 221 - - - - - 208 - - - - - 209 - - - - - 57 - - - YES - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - - 297 - - - - - 298 - - - - - 211 - - - YES - - - - - - 212 - - - YES - - - - - - - 195 - - - - - 196 - - - - - 346 - - - - - 348 - - - YES - - - - - - 349 - - - YES - - - - - - - - - - - - 350 - - - - - 351 - - - - - 354 - - - - - 375 - - - YES - - - - - - 376 - - - YES - - - - - - - 377 - - - YES - - - - - - 388 - - - YES - - - - - - - - - - - - - - - - - - - - - 389 - - - - - 390 - - - - - 391 - - - - - 392 - - - - - 393 - - - - - 394 - - - - - 395 - - - - - 396 - - - - - 397 - - - YES - - - - - - 398 - - - YES - - - - - - 399 - - - YES - - - - - - 400 - - - - - 401 - - - - - 402 - - - - - 403 - - - - - 404 - - - - - 405 - - - YES - - - - - - - - - - 406 - - - - - 407 - - - - - 408 - - - - - 409 - - - - - 410 - - - - - 411 - - - YES - - - - - - - - 412 - - - - - 413 - - - - - 414 - - - - - 415 - - - YES - - - - - - - - - 416 - - - - - 417 - - - - - 418 - - - - - 419 - - - - - 420 - - - - - 450 - - - YES - - - - - - 451 - - - YES - - - - - - - - 452 - - - - - 453 - - - - - 454 - - - - - 457 - - - - - 459 - - - - - 460 - - - - - 462 - - - - - 465 - - - - - 466 - - - - - 485 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 496 - - - YES - - - - - - 497 - - - YES - - - - - - - - - - - - - - - 498 - - - - - 499 - - - - - 500 - - - - - 501 - - - - - 502 - - - - - 503 - - - YES - - - - - - 504 - - - - - 505 - - - - - 506 - - - - - 507 - - - - - 508 - - - YES - - - - - - - - - - - - - - 509 - - - - - 510 - - - - - 511 - - - - - 512 - - - - - 513 - - - - - 514 - - - - - 515 - - - - - 516 - - - - - 517 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 130.IBPluginDependency - 130.ImportedFromIB2 - 130.editorWindowContentRectSynchronizationRect - 131.IBPluginDependency - 131.ImportedFromIB2 - 134.IBPluginDependency - 134.ImportedFromIB2 - 136.IBPluginDependency - 136.ImportedFromIB2 - 144.IBPluginDependency - 144.ImportedFromIB2 - 145.IBPluginDependency - 145.ImportedFromIB2 - 149.IBPluginDependency - 149.ImportedFromIB2 - 150.IBPluginDependency - 150.ImportedFromIB2 - 19.IBPluginDependency - 19.ImportedFromIB2 - 195.IBPluginDependency - 195.ImportedFromIB2 - 196.IBPluginDependency - 196.ImportedFromIB2 - 197.IBPluginDependency - 197.ImportedFromIB2 - 198.IBPluginDependency - 198.ImportedFromIB2 - 199.IBPluginDependency - 199.ImportedFromIB2 - 200.IBEditorWindowLastContentRect - 200.IBPluginDependency - 200.ImportedFromIB2 - 200.editorWindowContentRectSynchronizationRect - 201.IBPluginDependency - 201.ImportedFromIB2 - 202.IBPluginDependency - 202.ImportedFromIB2 - 203.IBPluginDependency - 203.ImportedFromIB2 - 204.IBPluginDependency - 204.ImportedFromIB2 - 205.IBEditorWindowLastContentRect - 205.IBPluginDependency - 205.ImportedFromIB2 - 205.editorWindowContentRectSynchronizationRect - 206.IBPluginDependency - 206.ImportedFromIB2 - 207.IBPluginDependency - 207.ImportedFromIB2 - 208.IBPluginDependency - 208.ImportedFromIB2 - 209.IBPluginDependency - 209.ImportedFromIB2 - 210.IBPluginDependency - 210.ImportedFromIB2 - 211.IBPluginDependency - 211.ImportedFromIB2 - 212.IBPluginDependency - 212.ImportedFromIB2 - 212.editorWindowContentRectSynchronizationRect - 213.IBPluginDependency - 213.ImportedFromIB2 - 214.IBPluginDependency - 214.ImportedFromIB2 - 215.IBPluginDependency - 215.ImportedFromIB2 - 216.IBPluginDependency - 216.ImportedFromIB2 - 217.IBPluginDependency - 217.ImportedFromIB2 - 218.IBPluginDependency - 218.ImportedFromIB2 - 219.IBPluginDependency - 219.ImportedFromIB2 - 220.IBEditorWindowLastContentRect - 220.IBPluginDependency - 220.ImportedFromIB2 - 220.editorWindowContentRectSynchronizationRect - 221.IBPluginDependency - 221.ImportedFromIB2 - 23.IBPluginDependency - 23.ImportedFromIB2 - 236.IBPluginDependency - 236.ImportedFromIB2 - 239.IBPluginDependency - 239.ImportedFromIB2 - 24.IBEditorWindowLastContentRect - 24.IBPluginDependency - 24.ImportedFromIB2 - 24.editorWindowContentRectSynchronizationRect - 29.IBEditorWindowLastContentRect - 29.IBPluginDependency - 29.ImportedFromIB2 - 29.WindowOrigin - 29.editorWindowContentRectSynchronizationRect - 295.IBPluginDependency - 296.IBEditorWindowLastContentRect - 296.IBPluginDependency - 296.editorWindowContentRectSynchronizationRect - 297.IBPluginDependency - 298.IBPluginDependency - 346.IBPluginDependency - 346.ImportedFromIB2 - 348.IBPluginDependency - 348.ImportedFromIB2 - 349.IBEditorWindowLastContentRect - 349.IBPluginDependency - 349.ImportedFromIB2 - 349.editorWindowContentRectSynchronizationRect - 350.IBPluginDependency - 350.ImportedFromIB2 - 351.IBPluginDependency - 351.ImportedFromIB2 - 354.IBPluginDependency - 354.ImportedFromIB2 - 375.IBPluginDependency - 376.IBEditorWindowLastContentRect - 376.IBPluginDependency - 377.IBPluginDependency - 388.IBEditorWindowLastContentRect - 388.IBPluginDependency - 389.IBPluginDependency - 390.IBPluginDependency - 391.IBPluginDependency - 392.IBPluginDependency - 393.IBPluginDependency - 394.IBPluginDependency - 395.IBPluginDependency - 396.IBPluginDependency - 397.IBPluginDependency - 398.IBPluginDependency - 399.IBPluginDependency - 400.IBPluginDependency - 401.IBPluginDependency - 402.IBPluginDependency - 403.IBPluginDependency - 404.IBPluginDependency - 405.IBPluginDependency - 406.IBPluginDependency - 407.IBPluginDependency - 408.IBPluginDependency - 409.IBPluginDependency - 410.IBPluginDependency - 411.IBPluginDependency - 412.IBPluginDependency - 413.IBPluginDependency - 414.IBPluginDependency - 415.IBPluginDependency - 416.IBPluginDependency - 417.IBPluginDependency - 418.IBPluginDependency - 419.IBPluginDependency - 420.IBPluginDependency - 450.IBPluginDependency - 451.IBEditorWindowLastContentRect - 451.IBPluginDependency - 452.IBPluginDependency - 453.IBPluginDependency - 454.IBPluginDependency - 457.IBPluginDependency - 459.IBPluginDependency - 460.IBPluginDependency - 462.IBPluginDependency - 465.IBPluginDependency - 466.IBPluginDependency - 485.IBPluginDependency - 490.IBPluginDependency - 491.IBEditorWindowLastContentRect - 491.IBPluginDependency - 492.IBPluginDependency - 494.IBPluginDependency - 496.IBPluginDependency - 497.IBEditorWindowLastContentRect - 497.IBPluginDependency - 498.IBPluginDependency - 499.IBPluginDependency - 5.IBPluginDependency - 5.ImportedFromIB2 - 500.IBPluginDependency - 501.IBPluginDependency - 502.IBPluginDependency - 503.IBPluginDependency - 504.IBPluginDependency - 505.IBPluginDependency - 506.IBPluginDependency - 507.IBPluginDependency - 508.IBEditorWindowLastContentRect - 508.IBPluginDependency - 509.IBPluginDependency - 510.IBPluginDependency - 511.IBPluginDependency - 512.IBPluginDependency - 513.IBPluginDependency - 514.IBPluginDependency - 515.IBPluginDependency - 516.IBPluginDependency - 517.IBPluginDependency - 56.IBPluginDependency - 56.ImportedFromIB2 - 57.IBEditorWindowLastContentRect - 57.IBPluginDependency - 57.ImportedFromIB2 - 57.editorWindowContentRectSynchronizationRect - 58.IBPluginDependency - 58.ImportedFromIB2 - 73.IBPluginDependency - 73.ImportedFromIB2 - 81.IBEditorWindowLastContentRect - 81.IBPluginDependency - 81.ImportedFromIB2 - 81.editorWindowContentRectSynchronizationRect - 83.IBPluginDependency - 83.ImportedFromIB2 - 92.IBPluginDependency - 92.ImportedFromIB2 - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{436, 809}, {64, 6}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{753, 187}, {275, 113}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {275, 83}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{547, 180}, {254, 283}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{187, 434}, {243, 243}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {167, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{753, 217}, {238, 103}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {241, 103}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{654, 239}, {194, 73}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{525, 802}, {197, 73}} - {{380, 836}, {512, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 978}, {478, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - {{604, 269}, {231, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - {{475, 832}, {234, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{746, 287}, {220, 133}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {215, 63}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - {{591, 420}, {83, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{523, 2}, {178, 283}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{753, 197}, {170, 63}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{725, 289}, {246, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{674, 260}, {204, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{878, 180}, {164, 173}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{286, 129}, {275, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{23, 794}, {245, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{452, 109}, {196, 203}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{145, 474}, {199, 203}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - YES - - - - - - YES - - - - - 532 - - - - YES - - NSPopover - NSResponder - - performClose: - id - - - performClose: - - performClose: - id - - - - YES - - YES - contentViewController - delegate - - - YES - NSViewController - id - - - - YES - - YES - contentViewController - delegate - - - YES - - contentViewController - NSViewController - - - delegate - id - - - - - IBProjectSource - ./Classes/NSPopover.h - - - - SVGTesterAppDelegate - NSObject - - IBProjectSource - ./Classes/SVGTesterAppDelegate.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - diff --git a/XCodeProjects/SVGTesterDemo/en.lproj/MainWindow.xib b/XCodeProjects/SVGTesterDemo/en.lproj/MainWindow.xib deleted file mode 100644 index 08e996170..000000000 --- a/XCodeProjects/SVGTesterDemo/en.lproj/MainWindow.xib +++ /dev/null @@ -1,291 +0,0 @@ - - - - 1070 - 11A419 - 1530 - 1115.2 - 549.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1530 - - - YES - NSCustomView - NSWindowTemplate - NSView - NSButtonCell - NSCustomObject - NSButton - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - YES - - YES - - - - - YES - - MainWindowController - - - FirstResponder - - - NSApplication - - - 15 - 2 - {{196, 240}, {800, 560}} - 544735232 - Window - NSWindow - - - - - 256 - - YES - - - 274 - {{20, 52}, {760, 488}} - - - - ComparisonView - - - - 289 - {{690, 12}, {96, 32}} - - - YES - - 67239424 - 134217728 - Next - - LucidaGrande - 13 - 1044 - - - -2038284033 - 129 - - - 200 - 25 - - - - {{7, 11}, {800, 560}} - - - - - {{0, 0}, {2560, 1418}} - {10000000000000, 10000000000000} - - - - - YES - - - view - - - - 9 - - - - next: - - - - 10 - - - - - YES - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 1 - - - YES - - - - - - 2 - - - YES - - - - - - - 3 - - - YES - - - - - 7 - - - YES - - - - - - 8 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 1.IBPluginDependency - 1.IBWindowTemplateEditedContentRect - 1.NSWindowTemplate.visibleAtLaunch - 1.WindowOrigin - 1.editorWindowContentRectSynchronizationRect - 2.IBPluginDependency - 3.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{357, 418}, {480, 270}} - - {196, 240} - {{357, 418}, {480, 270}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 10 - - - - YES - - ComparisonView - NSView - - IBProjectSource - ./Classes/ComparisonView.h - - - - MainWindowController - NSWindowController - - next: - id - - - next: - - next: - id - - - - view - ComparisonView - - - view - - view - ComparisonView - - - - IBProjectSource - ./Classes/MainWindowController.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - diff --git a/XCodeProjects/SVGTesterDemo/main.m b/XCodeProjects/SVGTesterDemo/main.m deleted file mode 100644 index 3eeccf398..000000000 --- a/XCodeProjects/SVGTesterDemo/main.m +++ /dev/null @@ -1,10 +0,0 @@ -// -// main.m -// SVGTester -// -// Copyright Matt Rajca 2011. All rights reserved. -// - -int main(int argc, char *argv[]) { - return NSApplicationMain(argc, (const char **) argv); -} diff --git a/calayer-exporter b/calayer-exporter deleted file mode 160000 index 6d029ac06..000000000 --- a/calayer-exporter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6d029ac06080bee403c3a97bddd9569e4ecb6b51 diff --git a/iOS/SVGDocumentView.h b/iOS/SVGDocumentView.h deleted file mode 100644 index 70bed23b3..000000000 --- a/iOS/SVGDocumentView.h +++ /dev/null @@ -1,22 +0,0 @@ -#import - -#import "SVGDocument.h" - -/*! - * CALayer can't be stored in NSDictionary as a key. Instead, the SVGParser stores the - * returned layer has - as its "name" property - the "identifier" property of the SVGElement that created it - */ -@interface SVGDocumentView : NSObject -{ - -} - -+(SVGDocumentView*) documentViewWithDocument:(SVGDocument*) d; - --(id) initWithDocument:(SVGDocument*) d; - -@property(nonatomic, retain, readonly) SVGDocument* svg; -@property(nonatomic, retain, readonly) CALayer* rootLayer; -@property(nonatomic, retain, readonly) NSMutableDictionary* layersByElementId; - -@end diff --git a/iOS/SVGDocumentView.m b/iOS/SVGDocumentView.m deleted file mode 100644 index 1427797b0..000000000 --- a/iOS/SVGDocumentView.m +++ /dev/null @@ -1,86 +0,0 @@ -#import "SVGDocumentView.h" - - -#import "SVGElement.h" - -@interface SVGDocumentView() -- (CALayer *)layerWithElement:(SVGElement *)element; - -@property(nonatomic, retain, readwrite) SVGDocument* svg; -@property(nonatomic, retain, readwrite) CALayer* rootLayer; -@property(nonatomic, retain, readwrite) NSMutableDictionary* layersByElementId; - -@end - -@implementation SVGDocumentView - -@synthesize svg; -@synthesize rootLayer; -@synthesize layersByElementId; - -+(SVGDocumentView*) documentViewWithDocument:(SVGDocument*) d -{ - SVGDocumentView* result = [[[SVGDocumentView alloc] initWithDocument:d] autorelease]; - return result; -} - --(id) initWithDocument:(SVGDocument*) d -{ - NSAssert( d != nil, @"Attempted to init with a nil SVGDocument" ); - - self = [super init]; - if (self) { - self.svg = d; - self.rootLayer = [svg newLayer]; - - self.layersByElementId = [NSMutableDictionary dictionary]; - - self.rootLayer = [self layerWithElement:self.svg]; - - [layersByElementId setObject:self.rootLayer forKey:svg.identifier]; - NSLog(@"[%@] ROOT element id: %@ => layer: %@", [self class], svg.identifier, self.rootLayer); - } - return self; -} - -- (void) dealloc -{ - self.svg = nil; - self.rootLayer = nil; - self.layersByElementId = nil; - - [super dealloc]; -} - -- (CALayer *)layerWithElement:(SVGElement *)element { - CALayer *layer = [element newLayer]; - - if (![element.children count]) { - return layer; - } - - for (SVGElement *child in element.children) { - if ([child conformsToProtocol:@protocol(SVGLayeredElement)]) { - CALayer *sublayer = [self layerWithElement:(id)child]; - - if (!sublayer) { - continue; - } - - [layer addSublayer:sublayer]; - [layersByElementId setObject:sublayer forKey:child.identifier]; - NSLog(@"[%@] element id: %@ => layer: %@", [self class], child.identifier, sublayer); - } - } - - if (element != self.svg) { - [element layoutLayer:layer]; - } - - [layer setNeedsDisplay]; - - return layer; -} - - -@end diff --git a/iOS/SVGPathView.h b/iOS/SVGPathView.h deleted file mode 100644 index 4fb8236d2..000000000 --- a/iOS/SVGPathView.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// SVGPathView.h -// SVGKit -// - -#import -#import - -#import "SVGView.h" - - -#if NS_BLOCKS_AVAILABLE - -typedef void (^layerTreeEnumerator)(CALayer* child); - -#endif - -@class SVGPathElement; - -@protocol SVGPathViewDelegate; - -@interface SVGPathView : SVGView -{ - -} - -/** Initializes the view with a copy of the path element selected. - @param pathElement a path element either manually created or extracted from another document - @param shouldTranslate if YES, will translate the path existing in the other document to match toward the origin so that the drawing will have an origin at 0,0 rather than where it was in the original document - */ -- (id)initWithPathElement:(SVGPathElement*)pathElement translateTowardOrigin:(BOOL)shouldTranslate; - -- (CAShapeLayer*) pathElementLayer; - -@property (readwrite,nonatomic,assign) id delegate; -@property (readonly) SVGPathElement* pathElement; - -#if NS_BLOCKS_AVAILABLE - -- (void) enumerateChildLayersUsingBlock:(layerTreeEnumerator)callback; - -#endif - - -@end - - -@protocol SVGPathViewDelegate - -@optional - -- (void) pathView:(SVGPathView*)v path:(SVGPathElement*)path touch:(UITouch*)touch; - -@end \ No newline at end of file diff --git a/iOS/SVGPathView.m b/iOS/SVGPathView.m deleted file mode 100755 index 7da3027b0..000000000 --- a/iOS/SVGPathView.m +++ /dev/null @@ -1,108 +0,0 @@ -// -// SVGPathView.m -// SVGKit -// - -#import "SVGPathView.h" - -#import "SVGElement+Private.h" -#import "SVGDocument.h" -#import "SVGPathElement.h" -#import "SVGShapeElement+Private.h" -#import "CGPathAdditions.h" -#import "SVGDocument+CA.h" - -@implementation SVGPathView - -@synthesize delegate; -@synthesize pathElement=_pathElement; - -- (id)initWithPathElement:(SVGPathElement*)pathElement translateTowardOrigin:(BOOL)shouldTranslate -{ - CGPathRef originalPath = [pathElement path]; - CGRect pathRect = CGRectIntegral(CGPathGetBoundingBox(originalPath)); - CGRect viewRect = CGRectMake(0, 0, CGRectGetWidth(pathRect), CGRectGetHeight(pathRect)); - - self = [super initWithFrame:viewRect]; - if (self) { - SVGPathElement* newPathElement = [[SVGPathElement alloc] init]; - - if (!shouldTranslate) { - [newPathElement loadPath:originalPath]; - } else { - CGPathRef translatedPath = CGPathCreateByOffsettingPath(originalPath, pathRect.origin.x, pathRect.origin.y); - [newPathElement loadPath:translatedPath]; - CGPathRelease(translatedPath); - } - - [newPathElement setIdentifier:pathElement.identifier]; - [newPathElement setOpacity:pathElement.opacity]; - [newPathElement setStrokeColor:pathElement.strokeColor]; - [newPathElement setStrokeWidth:pathElement.strokeWidth]; - [newPathElement setFillType:pathElement.fillType]; - [newPathElement setFillColor:pathElement.fillColor]; - [newPathElement setFillPattern:pathElement.fillPattern]; - - _pathElement = newPathElement; - - SVGDocument* doc = [[SVGDocument alloc] initWithFrame:viewRect]; - [doc addChild:newPathElement]; - - [self setDocument:doc]; - - [newPathElement release]; // retained by doc - [doc release]; // retained by super - } - return self; -} - -- (void) handleElement:(SVGPathElement*)pathElem touched:(UITouch*)touch -{ - if ([self.delegate respondsToSelector:@selector(pathView:path:touch:)]) { - [self.delegate pathView:self path:pathElem touch:touch]; - } -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - UITouch* t = [touches anyObject]; - CGPoint touchPoint = [t locationInView:self]; - - [self.document applyAggregator:^(SVGElement *e) { - if ([e isKindOfClass:[SVGPathElement class]]) { - SVGPathElement* pathElem = (SVGPathElement*)e; - CGPathRef path = pathElem.path; - if (CGPathContainsPoint(path, NULL, touchPoint, NO)) { - [self handleElement:pathElem touched:t]; - } - } - }]; -} - -- (CAShapeLayer*) pathElementLayer -{ - return (CAShapeLayer*) [[self document] layerWithIdentifier:self.pathElement.identifier]; -} - - -#if NS_BLOCKS_AVAILABLE - -- (void) enumerateChildLayersUsingBlock:(layerTreeEnumerator)callback givenParent:(CALayer*)parentLayer -{ - callback(parentLayer); - - for (CALayer* sublayer in [parentLayer sublayers]) { - [self enumerateChildLayersUsingBlock:callback - givenParent:sublayer]; - } -} - -- (void)enumerateChildLayersUsingBlock:(layerTreeEnumerator)callback -{ - [self enumerateChildLayersUsingBlock:callback - givenParent:self.layer]; -} - -#endif - -@end diff --git a/iOS/SVGView.h b/iOS/SVGView.h deleted file mode 100644 index 43e7a75ef..000000000 --- a/iOS/SVGView.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// SVGView.h -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import - -@class SVGDocument; - -@interface SVGView : UIView { } - -@property (nonatomic, retain) SVGDocument *document; - -- (id)initWithDocument:(SVGDocument *)document; // set frame to position - -@end diff --git a/iOS/SVGView.m b/iOS/SVGView.m deleted file mode 100644 index 2d403c3b5..000000000 --- a/iOS/SVGView.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// SVGView.m -// SVGKit -// -// Copyright Matt Rajca 2010-2011. All rights reserved. -// - -#import "SVGView.h" - -#import "SVGDocument.h" -#import "SVGDocument+CA.h" - -@implementation SVGView - -@synthesize document = _document; - -- (id)initWithDocument:(SVGDocument *)document { - NSParameterAssert(document != nil); - - self = [self initWithFrame:CGRectMake(0.0f, 0.0f, document.width, document.height)]; - if (self) { - self.document = document; - } - return self; -} - -- (void)dealloc { - [_document release]; - - [super dealloc]; -} - -- (void)setDocument:(SVGDocument *)aDocument { - if (_document != aDocument) { - [_document release]; - _document = [aDocument retain]; - - for (NSInteger i = [self.layer.sublayers count] - 1; i >= 0; i--) { - CALayer *sublayer = [self.layer.sublayers objectAtIndex:i]; - [sublayer removeFromSuperlayer]; - } - - [self.layer addSublayer:[_document layerTree]]; - } -} - -@end diff --git a/iOSDemo.xcodeproj/project.pbxproj b/iOSDemo.xcodeproj/project.pbxproj new file mode 100644 index 000000000..6fb72caec --- /dev/null +++ b/iOSDemo.xcodeproj/project.pbxproj @@ -0,0 +1,523 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 661008971632ED5B00DD3C38 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 661008961632ED5B00DD3C38 /* Default-568h@2x.png */; }; + 661A0DCF161727CF008D5FBE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 661A0DCE161727CF008D5FBE /* UIKit.framework */; }; + 661A0DD1161727CF008D5FBE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 661A0DD0161727CF008D5FBE /* Foundation.framework */; }; + 661A0DD3161727CF008D5FBE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 661A0DD2161727CF008D5FBE /* CoreGraphics.framework */; }; + 661D721016177537005899EA /* Monkey.png in Resources */ = {isa = PBXBuildFile; fileRef = 661D71FE16177537005899EA /* Monkey.png */; }; + 661D721116177537005899EA /* Note.png in Resources */ = {isa = PBXBuildFile; fileRef = 661D71FF16177537005899EA /* Note.png */; }; + 661D721216177537005899EA /* Sample Licenses.txt in Resources */ = {isa = PBXBuildFile; fileRef = 661D720016177537005899EA /* Sample Licenses.txt */; }; + 661D721316177537005899EA /* australia_states_blank.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720216177537005899EA /* australia_states_blank.svg */; }; + 661D721416177537005899EA /* Blank_Map-Africa.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720316177537005899EA /* Blank_Map-Africa.svg */; }; + 661D721516177537005899EA /* breaking-1.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720416177537005899EA /* breaking-1.svg */; }; + 661D721616177537005899EA /* CurvedDiamond.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720516177537005899EA /* CurvedDiamond.svg */; }; + 661D721716177537005899EA /* Europe_states_reduced.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720616177537005899EA /* Europe_states_reduced.svg */; }; + 661D721816177537005899EA /* Lion.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720716177537005899EA /* Lion.svg */; }; + 661D721916177537005899EA /* Location_European_nation_states.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720816177537005899EA /* Location_European_nation_states.svg */; }; + 661D721A16177537005899EA /* Map.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720916177537005899EA /* Map.svg */; }; + 661D721B16177537005899EA /* Monkey.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720A16177537005899EA /* Monkey.svg */; }; + 661D721C16177537005899EA /* Note.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720B16177537005899EA /* Note.svg */; }; + 661D721E16177537005899EA /* test-wave-1.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720D16177537005899EA /* test-wave-1.svg */; }; + 661D721F16177537005899EA /* Text.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720E16177537005899EA /* Text.svg */; }; + 661D722016177537005899EA /* uk-only.svg in Resources */ = {isa = PBXBuildFile; fileRef = 661D720F16177537005899EA /* uk-only.svg */; }; + 661D722916177655005899EA /* iPadDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 661D722116177655005899EA /* iPadDetailViewController.xib */; }; + 661D722A16177655005899EA /* iPhoneDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 661D722316177655005899EA /* iPhoneDetailViewController.xib */; }; + 661D722B16177655005899EA /* MasterViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 661D722516177655005899EA /* MasterViewController_iPad.xib */; }; + 661D722C16177655005899EA /* MasterViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 661D722716177655005899EA /* MasterViewController_iPhone.xib */; }; + 6623D29A1678DEAC002D37AB /* voies.svg in Resources */ = {isa = PBXBuildFile; fileRef = 6623D2991678DEAC002D37AB /* voies.svg */; }; + 6649E07B16172D4200AFE92A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649E06916172D4200AFE92A /* AppDelegate.m */; }; + 6649E07C16172D4200AFE92A /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649E06B16172D4200AFE92A /* DetailViewController.m */; }; + 6649E07F16172D4200AFE92A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6649E07016172D4200AFE92A /* InfoPlist.strings */; }; + 6649E08316172D4200AFE92A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649E07816172D4200AFE92A /* main.m */; }; + 6649E0AB1617472900AFE92A /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6649E0AA1617472900AFE92A /* MasterViewController.m */; }; + 6649E0AD1617479200AFE92A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6649E0AC1617479200AFE92A /* QuartzCore.framework */; }; + 6649E10D1617577000AFE92A /* libSVGKit-iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6649E10A1617574700AFE92A /* libSVGKit-iOS.a */; }; + 6649E10F1617578500AFE92A /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 6649E10E1617578500AFE92A /* libxml2.dylib */; }; + 6649F5001617CF2900F1A064 /* Reinel_compass_rose.svg in Resources */ = {isa = PBXBuildFile; fileRef = 6649F4FF1617CF2900F1A064 /* Reinel_compass_rose.svg */; }; + 665E4A7F16355C4000DDA751 /* imageWithASinglePointPath.svg in Resources */ = {isa = PBXBuildFile; fileRef = 665E4A7E16355C4000DDA751 /* imageWithASinglePointPath.svg */; }; + 88BD39131670A9270055678F /* MathCurve.svg in Resources */ = {isa = PBXBuildFile; fileRef = 88BD39121670A9270055678F /* MathCurve.svg */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 6649E1091617574700AFE92A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6649E1021617574600AFE92A /* SVGKit-iOS.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 6639618E16145D0400E58CCA; + remoteInfo = "SVGKit-iOS"; + }; + 6649E10B1617575500AFE92A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6649E1021617574600AFE92A /* SVGKit-iOS.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 6639618D16145D0400E58CCA; + remoteInfo = "SVGKit-iOS"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 661008961632ED5B00DD3C38 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + 661A0DCA161727CF008D5FBE /* iOSDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 661A0DCE161727CF008D5FBE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 661A0DD0161727CF008D5FBE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 661A0DD2161727CF008D5FBE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 661D71FE16177537005899EA /* Monkey.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Monkey.png; sourceTree = ""; }; + 661D71FF16177537005899EA /* Note.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Note.png; sourceTree = ""; }; + 661D720016177537005899EA /* Sample Licenses.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Sample Licenses.txt"; sourceTree = ""; }; + 661D720216177537005899EA /* australia_states_blank.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = australia_states_blank.svg; sourceTree = ""; }; + 661D720316177537005899EA /* Blank_Map-Africa.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Blank_Map-Africa.svg"; sourceTree = ""; }; + 661D720416177537005899EA /* breaking-1.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "breaking-1.svg"; sourceTree = ""; }; + 661D720516177537005899EA /* CurvedDiamond.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CurvedDiamond.svg; sourceTree = ""; }; + 661D720616177537005899EA /* Europe_states_reduced.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Europe_states_reduced.svg; sourceTree = ""; }; + 661D720716177537005899EA /* Lion.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Lion.svg; sourceTree = ""; }; + 661D720816177537005899EA /* Location_European_nation_states.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Location_European_nation_states.svg; sourceTree = ""; }; + 661D720916177537005899EA /* Map.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Map.svg; sourceTree = ""; }; + 661D720A16177537005899EA /* Monkey.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Monkey.svg; sourceTree = ""; }; + 661D720B16177537005899EA /* Note.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Note.svg; sourceTree = ""; }; + 661D720C16177537005899EA /* Reinel_compass_rose-ADAM.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Reinel_compass_rose-ADAM.svg"; sourceTree = ""; }; + 661D720D16177537005899EA /* test-wave-1.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test-wave-1.svg"; sourceTree = ""; }; + 661D720E16177537005899EA /* Text.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Text.svg; sourceTree = ""; }; + 661D720F16177537005899EA /* uk-only.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "uk-only.svg"; sourceTree = ""; }; + 661D722216177655005899EA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iPadDetailViewController.xib; sourceTree = ""; }; + 661D722416177655005899EA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iPhoneDetailViewController.xib; sourceTree = ""; }; + 661D722616177655005899EA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MasterViewController_iPad.xib; sourceTree = ""; }; + 661D722816177655005899EA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MasterViewController_iPhone.xib; sourceTree = ""; }; + 6623D2991678DEAC002D37AB /* voies.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = voies.svg; sourceTree = ""; }; + 6649E06816172D4200AFE92A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 6649E06916172D4200AFE92A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 6649E06A16172D4200AFE92A /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; + 6649E06B16172D4200AFE92A /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; + 6649E07116172D4200AFE92A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 6649E07616172D4200AFE92A /* iOSDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iOSDemo-Info.plist"; sourceTree = ""; }; + 6649E07716172D4200AFE92A /* iOSDemo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iOSDemo-Prefix.pch"; sourceTree = ""; }; + 6649E07816172D4200AFE92A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 6649E0A91617472900AFE92A /* MasterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = ""; }; + 6649E0AA1617472900AFE92A /* MasterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = ""; }; + 6649E0AC1617479200AFE92A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 6649E1021617574600AFE92A /* SVGKit-iOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "SVGKit-iOS.xcodeproj"; sourceTree = ""; }; + 6649E10E1617578500AFE92A /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; + 6649F4FF1617CF2900F1A064 /* Reinel_compass_rose.svg */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = Reinel_compass_rose.svg; path = Samples/SVG/Reinel_compass_rose.svg; sourceTree = ""; }; + 665E4A7E16355C4000DDA751 /* imageWithASinglePointPath.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = imageWithASinglePointPath.svg; sourceTree = ""; }; + 88BD39121670A9270055678F /* MathCurve.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = MathCurve.svg; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 661A0DC7161727CF008D5FBE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6649E10F1617578500AFE92A /* libxml2.dylib in Frameworks */, + 6649E10D1617577000AFE92A /* libSVGKit-iOS.a in Frameworks */, + 6649E0AD1617479200AFE92A /* QuartzCore.framework in Frameworks */, + 661A0DCF161727CF008D5FBE /* UIKit.framework in Frameworks */, + 661A0DD1161727CF008D5FBE /* Foundation.framework in Frameworks */, + 661A0DD3161727CF008D5FBE /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 661A0DBF161727CF008D5FBE = { + isa = PBXGroup; + children = ( + 661008961632ED5B00DD3C38 /* Default-568h@2x.png */, + 6649F4FF1617CF2900F1A064 /* Reinel_compass_rose.svg */, + 6649E1021617574600AFE92A /* SVGKit-iOS.xcodeproj */, + 6649E0AC1617479200AFE92A /* QuartzCore.framework */, + 6649E06716172D4200AFE92A /* iOSDemo */, + 661D71FC16177537005899EA /* Samples */, + 661A0DCD161727CF008D5FBE /* Frameworks */, + 661A0DCB161727CF008D5FBE /* Products */, + ); + sourceTree = ""; + }; + 661A0DCB161727CF008D5FBE /* Products */ = { + isa = PBXGroup; + children = ( + 661A0DCA161727CF008D5FBE /* iOSDemo.app */, + ); + name = Products; + sourceTree = ""; + }; + 661A0DCD161727CF008D5FBE /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6649E10E1617578500AFE92A /* libxml2.dylib */, + 661A0DCE161727CF008D5FBE /* UIKit.framework */, + 661A0DD0161727CF008D5FBE /* Foundation.framework */, + 661A0DD2161727CF008D5FBE /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 661D71FC16177537005899EA /* Samples */ = { + isa = PBXGroup; + children = ( + 661D71FD16177537005899EA /* Bitmap */, + 661D720016177537005899EA /* Sample Licenses.txt */, + 661D720116177537005899EA /* SVG */, + ); + path = Samples; + sourceTree = ""; + }; + 661D71FD16177537005899EA /* Bitmap */ = { + isa = PBXGroup; + children = ( + 661D71FE16177537005899EA /* Monkey.png */, + 661D71FF16177537005899EA /* Note.png */, + ); + path = Bitmap; + sourceTree = ""; + }; + 661D720116177537005899EA /* SVG */ = { + isa = PBXGroup; + children = ( + 6623D2991678DEAC002D37AB /* voies.svg */, + 88BD39121670A9270055678F /* MathCurve.svg */, + 661D720216177537005899EA /* australia_states_blank.svg */, + 661D720316177537005899EA /* Blank_Map-Africa.svg */, + 661D720416177537005899EA /* breaking-1.svg */, + 661D720516177537005899EA /* CurvedDiamond.svg */, + 661D720616177537005899EA /* Europe_states_reduced.svg */, + 665E4A7E16355C4000DDA751 /* imageWithASinglePointPath.svg */, + 661D720716177537005899EA /* Lion.svg */, + 661D720816177537005899EA /* Location_European_nation_states.svg */, + 661D720916177537005899EA /* Map.svg */, + 661D720A16177537005899EA /* Monkey.svg */, + 661D720B16177537005899EA /* Note.svg */, + 661D720C16177537005899EA /* Reinel_compass_rose-ADAM.svg */, + 661D720D16177537005899EA /* test-wave-1.svg */, + 661D720E16177537005899EA /* Text.svg */, + 661D720F16177537005899EA /* uk-only.svg */, + ); + path = SVG; + sourceTree = ""; + }; + 6649E06716172D4200AFE92A /* iOSDemo */ = { + isa = PBXGroup; + children = ( + 661D722116177655005899EA /* iPadDetailViewController.xib */, + 661D722316177655005899EA /* iPhoneDetailViewController.xib */, + 661D722516177655005899EA /* MasterViewController_iPad.xib */, + 661D722716177655005899EA /* MasterViewController_iPhone.xib */, + 6649E06816172D4200AFE92A /* AppDelegate.h */, + 6649E06916172D4200AFE92A /* AppDelegate.m */, + 6649E06A16172D4200AFE92A /* DetailViewController.h */, + 6649E06B16172D4200AFE92A /* DetailViewController.m */, + 6649E0A91617472900AFE92A /* MasterViewController.h */, + 6649E0AA1617472900AFE92A /* MasterViewController.m */, + 6649E07016172D4200AFE92A /* InfoPlist.strings */, + 6649E07616172D4200AFE92A /* iOSDemo-Info.plist */, + 6649E07716172D4200AFE92A /* iOSDemo-Prefix.pch */, + 6649E07816172D4200AFE92A /* main.m */, + ); + name = iOSDemo; + path = XCodeProjectData/iOSDemo; + sourceTree = ""; + }; + 6649E1031617574600AFE92A /* Products */ = { + isa = PBXGroup; + children = ( + 6649E10A1617574700AFE92A /* libSVGKit-iOS.a */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 661A0DC9161727CF008D5FBE /* iOSDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = 661A0DF4161727D0008D5FBE /* Build configuration list for PBXNativeTarget "iOSDemo" */; + buildPhases = ( + 661A0DC6161727CF008D5FBE /* Sources */, + 661A0DC7161727CF008D5FBE /* Frameworks */, + 661A0DC8161727CF008D5FBE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 6649E10C1617575500AFE92A /* PBXTargetDependency */, + ); + name = iOSDemo; + productName = iOSDemo; + productReference = 661A0DCA161727CF008D5FBE /* iOSDemo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 661A0DC1161727CF008D5FBE /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0440; + ORGANIZATIONNAME = na; + }; + buildConfigurationList = 661A0DC4161727CF008D5FBE /* Build configuration list for PBXProject "iOSDemo" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 661A0DBF161727CF008D5FBE; + productRefGroup = 661A0DCB161727CF008D5FBE /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 6649E1031617574600AFE92A /* Products */; + ProjectRef = 6649E1021617574600AFE92A /* SVGKit-iOS.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 661A0DC9161727CF008D5FBE /* iOSDemo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 6649E10A1617574700AFE92A /* libSVGKit-iOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libSVGKit-iOS.a"; + remoteRef = 6649E1091617574700AFE92A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 661A0DC8161727CF008D5FBE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6649F5001617CF2900F1A064 /* Reinel_compass_rose.svg in Resources */, + 6649E07F16172D4200AFE92A /* InfoPlist.strings in Resources */, + 661D721016177537005899EA /* Monkey.png in Resources */, + 661D721116177537005899EA /* Note.png in Resources */, + 661D721216177537005899EA /* Sample Licenses.txt in Resources */, + 661D721316177537005899EA /* australia_states_blank.svg in Resources */, + 661D721416177537005899EA /* Blank_Map-Africa.svg in Resources */, + 661D721516177537005899EA /* breaking-1.svg in Resources */, + 661D721616177537005899EA /* CurvedDiamond.svg in Resources */, + 661D721716177537005899EA /* Europe_states_reduced.svg in Resources */, + 661D721816177537005899EA /* Lion.svg in Resources */, + 661D721916177537005899EA /* Location_European_nation_states.svg in Resources */, + 661D721A16177537005899EA /* Map.svg in Resources */, + 661D721B16177537005899EA /* Monkey.svg in Resources */, + 661D721C16177537005899EA /* Note.svg in Resources */, + 661D721E16177537005899EA /* test-wave-1.svg in Resources */, + 661D721F16177537005899EA /* Text.svg in Resources */, + 661D722016177537005899EA /* uk-only.svg in Resources */, + 661D722916177655005899EA /* iPadDetailViewController.xib in Resources */, + 661D722A16177655005899EA /* iPhoneDetailViewController.xib in Resources */, + 661D722B16177655005899EA /* MasterViewController_iPad.xib in Resources */, + 661D722C16177655005899EA /* MasterViewController_iPhone.xib in Resources */, + 661008971632ED5B00DD3C38 /* Default-568h@2x.png in Resources */, + 665E4A7F16355C4000DDA751 /* imageWithASinglePointPath.svg in Resources */, + 88BD39131670A9270055678F /* MathCurve.svg in Resources */, + 6623D29A1678DEAC002D37AB /* voies.svg in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 661A0DC6161727CF008D5FBE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6649E07B16172D4200AFE92A /* AppDelegate.m in Sources */, + 6649E07C16172D4200AFE92A /* DetailViewController.m in Sources */, + 6649E08316172D4200AFE92A /* main.m in Sources */, + 6649E0AB1617472900AFE92A /* MasterViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 6649E10C1617575500AFE92A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SVGKit-iOS"; + targetProxy = 6649E10B1617575500AFE92A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 661D722116177655005899EA /* iPadDetailViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + 661D722216177655005899EA /* en */, + ); + name = iPadDetailViewController.xib; + sourceTree = ""; + }; + 661D722316177655005899EA /* iPhoneDetailViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + 661D722416177655005899EA /* en */, + ); + name = iPhoneDetailViewController.xib; + sourceTree = ""; + }; + 661D722516177655005899EA /* MasterViewController_iPad.xib */ = { + isa = PBXVariantGroup; + children = ( + 661D722616177655005899EA /* en */, + ); + name = MasterViewController_iPad.xib; + sourceTree = ""; + }; + 661D722716177655005899EA /* MasterViewController_iPhone.xib */ = { + isa = PBXVariantGroup; + children = ( + 661D722816177655005899EA /* en */, + ); + name = MasterViewController_iPhone.xib; + sourceTree = ""; + }; + 6649E07016172D4200AFE92A /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 6649E07116172D4200AFE92A /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 661A0DF2161727D0008D5FBE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "../../iOS/**", + "../../Core/**", + ); + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + PROVISIONING_PROFILE = ""; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 661A0DF3161727D0008D5FBE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "../../iOS/**", + "../../Core/**", + ); + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 661A0DF5161727D0008D5FBE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "XCodeProjectData/iOSDemo/iOSDemo-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "Source/**", + "calayer-exporter", + ); + INFOPLIST_FILE = "XCodeProjectData/iOSDemo/iOSDemo-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../Library/Developer/Xcode/DerivedData/SVGKit-iOS-fdaumrdvswucxfexyosnvlgswvey/Build/Products/Debug-universal\"", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 661A0DF6161727D0008D5FBE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "XCodeProjectData/iOSDemo/iOSDemo-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "Source/**", + "calayer-exporter", + ); + INFOPLIST_FILE = "XCodeProjectData/iOSDemo/iOSDemo-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../Library/Developer/Xcode/DerivedData/SVGKit-iOS-fdaumrdvswucxfexyosnvlgswvey/Build/Products/Debug-universal\"", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 661A0DC4161727CF008D5FBE /* Build configuration list for PBXProject "iOSDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 661A0DF2161727D0008D5FBE /* Debug */, + 661A0DF3161727D0008D5FBE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 661A0DF4161727D0008D5FBE /* Build configuration list for PBXNativeTarget "iOSDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 661A0DF5161727D0008D5FBE /* Debug */, + 661A0DF6161727D0008D5FBE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 661A0DC1161727CF008D5FBE /* Project object */; +}