Files
IJSVG/source/IJSVGNode.h
T
Curtis Hard a42ef50c95 Added support for rendering SVG sprite sheets
- Also added support for creating SVG object from a string.
2016-10-28 22:28:48 +01:00

150 lines
4.1 KiB
Objective-C

//
// IJSVGNode.h
// IconJar
//
// Created by Curtis Hard on 30/08/2014.
// Copyright (c) 2014 Curtis Hard. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "IJSVGStyle.h"
@class IJSVG;
@class IJSVGGroup;
@class IJSVGDef;
@class IJSVGGradient;
@class IJSVGGroup;
@class IJSVGPattern;
typedef NS_OPTIONS( NSInteger, IJSVGNodeType ) {
IJSVGNodeTypeGroup,
IJSVGNodeTypePath,
IJSVGNodeTypeDef,
IJSVGNodeTypePolygon,
IJSVGNodeTypePolyline,
IJSVGNodeTypeRect,
IJSVGNodeTypeLine,
IJSVGNodeTypeCircle,
IJSVGNodeTypeEllipse,
IJSVGNodeTypeUse,
IJSVGNodeTypeLinearGradient,
IJSVGNodeTypeRadialGradient,
IJSVGNodeTypeClipPath,
IJSVGNodeTypeFont,
IJSVGNodeTypeGlyph,
IJSVGNodeTypeMask,
IJSVGNodeTypeImage,
IJSVGNodeTypePattern,
IJSVGNodeTypeSVG,
IJSVGNodeTypeNotFound,
};
typedef NS_OPTIONS( NSInteger, IJSVGWindingRule ) {
IJSVGWindingRuleNonZero,
IJSVGWindingRuleEvenOdd,
IJSVGWindingRuleInherit
};
typedef NS_OPTIONS( NSInteger, IJSVGLineCapStyle ) {
IJSVGLineCapStyleButt,
IJSVGLineCapStyleRound,
IJSVGLineCapStyleSquare,
IJSVGLineCapStyleInherit
};
typedef NS_OPTIONS( NSInteger, IJSVGLineJoinStyle ) {
IJSVGLineJoinStyleMiter,
IJSVGLineJoinStyleRound,
IJSVGLineJoinStyleBevel,
IJSVGLineJoinStyleInherit
};
static CGFloat IJSVGInheritedFloatValue = -99.9999991;
@interface IJSVGNode : NSObject <NSCopying> {
IJSVGNodeType type;
NSString * name;
NSString * unicode;
NSString * className;
NSArray * classNameList;
CGFloat x;
CGFloat y;
CGFloat width;
CGFloat height;
IJSVGGradient * fillGradient;
IJSVGPattern * fillPattern;
BOOL usesDefaultFillColor;
BOOL shouldRender;
NSColor * fillColor;
NSColor * strokeColor;
CGFloat opacity;
CGFloat strokeWidth;
CGFloat fillOpacity;
CGFloat strokeOpacity;
CGFloat * strokeDashArray;
NSInteger strokeDashArrayCount;
CGFloat strokeDashOffset;
NSString * identifier;
IJSVGNode * parentNode;
IJSVGGroup * clipPath;
NSArray * transforms;
IJSVGWindingRule windingRule;
IJSVGLineCapStyle lineCapStyle;
IJSVGLineJoinStyle joinStyle;
IJSVGDef * def;
IJSVG * svg;
}
@property ( nonatomic, assign ) IJSVGNodeType type;
@property ( nonatomic, copy ) NSString * name;
@property ( nonatomic, copy ) NSString * className;
@property ( nonatomic, retain ) NSArray * classNameList;
@property ( nonatomic, copy ) NSString * unicode;
@property ( nonatomic, assign ) BOOL shouldRender;
@property ( nonatomic, assign ) BOOL usesDefaultFillColor;
@property ( nonatomic, assign ) CGFloat x;
@property ( nonatomic, assign ) CGFloat y;
@property ( nonatomic, assign ) CGFloat width;
@property ( nonatomic, assign ) CGFloat height;
@property ( nonatomic, assign ) CGFloat opacity;
@property ( nonatomic, assign ) CGFloat fillOpacity;
@property ( nonatomic, assign ) CGFloat strokeOpacity;
@property ( nonatomic, assign ) CGFloat strokeWidth;
@property ( nonatomic, retain ) NSColor * fillColor;
@property ( nonatomic, retain ) NSColor * strokeColor;
@property ( nonatomic, copy ) NSString * identifier;
@property ( nonatomic, assign ) IJSVGNode * parentNode;
@property ( nonatomic, retain ) IJSVGGroup * clipPath;
@property ( nonatomic, assign ) IJSVGWindingRule windingRule;
@property ( nonatomic, assign ) IJSVGLineCapStyle lineCapStyle;
@property ( nonatomic, assign ) IJSVGLineJoinStyle lineJoinStyle;
@property ( nonatomic, retain ) NSArray * transforms;
@property ( nonatomic, retain ) IJSVGDef * def;
@property ( nonatomic, retain ) IJSVGGradient * fillGradient;
@property ( nonatomic, retain ) IJSVGPattern * fillPattern;
@property ( nonatomic, assign ) CGFloat * strokeDashArray;
@property ( nonatomic, assign ) NSInteger strokeDashArrayCount;
@property ( nonatomic, assign ) CGFloat strokeDashOffset;
@property ( nonatomic, retain ) IJSVG * svg;
+ (IJSVGNodeType)typeForString:(NSString *)string;
- (void)applyPropertiesFromNode:(IJSVGNode *)node;
- (id)initWithDef:(BOOL)flag;
- (void)addDef:(IJSVGNode *)aDef;
- (IJSVGDef *)defForID:(NSString *)anID;
@end