forked from pocketsvg/PocketSVG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SVGLayer.h
81 lines (62 loc) · 2 KB
/
SVGLayer.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* 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 <QuartzCore/QuartzCore.h>
NS_ASSUME_NONNULL_BEGIN
/// A CALayer subclass that renders an SVG file.
@interface SVGLayer : CALayer
/*!
* @discussion Initialises a layer that renders the provided SVG data.
*
* @param svgSource The entire string of the XML document representing the SVG.
*/
- (instancetype)initWithSVGSource:(NSString *)svgSource;
/*!
* @discussion Initialises a layer that renders the SVG file at the URL.
*
* @param url The URL of the SVG file.
*/
- (instancetype)initWithContentsOfURL:(NSURL *)url;
/*!
* @discussion Clears contents and renders a new SVG given the XML string of the SVG.
*
* @param svgSource The XML string of an SVG.
*/
- (void)setSvgSource:(NSString *)svgSource;
/*!
* @discussion Clears contents and renders a new SVG given the file name of the SVG.
* When build in Debug mode, the layer will automatically update if the
* file changes.
*
* @param svgName The name of the SVG file (without the .svg suffix).
*/
@property (nonatomic, copy) NSString *svgName;
/*!
* @discussion Renders a new SVG given the URL of an SVG file.
*
* @param svgURL The XML string of an SVG.
*/
@property (nonatomic, copy) NSURL *svgURL;
/*!
* @discussion Solidly fills the shape formed by the SVG path with the given color.
*
* @param fillColor A color to fill the SVG shape with.
*/
@property(nonatomic) CGColorRef fillColor;
/*!
* @discussion Solidly colors the path generated by the SVG file.
*
* @param strokeColor The color to stroke the path with.
*/
@property(nonatomic) CGColorRef strokeColor;
/*!
* @discussion Specifies whether or not line thickness should be scaled
when scaling paths.
*/
@property(nonatomic) BOOL scaleLineWidth;
@end
NS_ASSUME_NONNULL_END