forked from pocketsvg/PocketSVG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SVGEngine.h
executable file
·65 lines (55 loc) · 1.94 KB
/
SVGEngine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* This file is part of the PocketSVG package.
* Copyright (c) Ponderwell, Ariel Elkin, Fjölnir Ásgeirsson, and Contributors
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#ifdef __cplusplus
extern "C" {
#endif
@class SVGAttributeSet;
/*!
* @brief Returns an array of CGPathRefs contained within the passed SVG string.
*
* @param svgString The string containing the SVG formatted path.
* @param attributes An optional pointer for storing a map table containing SVG attributes for the paths
*
* @return An array of CGPathRef objects or nil if none are found
*
*/
NSArray *CGPathsFromSVGString(NSString *svgString, SVGAttributeSet **attributes);
/*!
* @brief Returns a single CGPathRef parsed from the contents of a single string formatted like the d attribute inside a path element
*
* @param svgString The string containing the SVG formatted path, this is just the path string from the d attribute and no xml
*
* @return A single CGPathRef object
*
*/
CGPathRef CGPathFromSVGPathString(NSString *svgString);
/*!
* @brief Returns SVG representing `paths`
*
* @param paths An array of CGPathRefs to construct the SVG from
* @param attributes An optional map table of SVG attributes for the paths
*
* @return SVG representing `paths`
*
*/
NSString *SVGStringFromCGPaths(NSArray *paths, SVGAttributeSet *attributes);
@interface SVGAttributeSet : NSObject <NSCopying, NSMutableCopying>
- (NSDictionary<NSString*,id> *)attributesForPath:(CGPathRef)path;
@end
@interface SVGMutableAttributeSet : SVGAttributeSet
- (void)setAttributes:(NSDictionary<NSString*,id> *)attributes forPath:(CGPathRef)path;
@end
@interface NSValue (PocketSVG)
+ (instancetype)svg_valueWithCGAffineTransform:(CGAffineTransform)aTransform;
- (CGAffineTransform)svg_CGAffineTransformValue;
@end
#ifdef __cplusplus
};
#endif