-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for svg stroke width change and viewBox dimension #181
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,6 @@ FOUNDATION_EXTERN void SVGDrawPathsWithBlock(NSArray<SVGBezierPath*> * const pat | |
@property(nonatomic, readonly) NSString *SVGRepresentation; | ||
|
||
|
||
|
||
/*! | ||
* @brief Returns an array of SVGBezierPaths given an SVG's URL. | ||
* | ||
|
@@ -51,11 +50,22 @@ FOUNDATION_EXTERN void SVGDrawPathsWithBlock(NSArray<SVGBezierPath*> * const pat | |
+ (NSArray<SVGBezierPath*> *)pathsFromSVGAtURL:(NSURL *)aURL; | ||
|
||
|
||
/*! | ||
* @brief Returns an array of SVGBezierPaths given an SVG's URL. | ||
* | ||
* @param aURL The URL from which to load an SVG. | ||
* @param viewBox The SVG viewBox tag rect. | ||
* | ||
*/ | ||
+ (NSArray<SVGBezierPath*> *)pathsFromSVGAtURL:(NSURL *)aURL viewBox:(CGRect *)viewBox; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens if the SVG already contains a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this question. Do you mean if the SVGBezierPath class? This code read the viewBox tag from the SVG file and return to the caller (by the viewBox pointer) these values in a CGRect struct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah ok now I understand the intention of your code and why you pass a pointer to a CGRect (I initially thought you wanted the caller to pass a CGRect as the viewBox to render the SVG in). If the caller wants to read the @property(nonatomic, readonly) CGrect viewBox; This way, no need to pass a pointer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, you are right, but I use the SVGBezierPath static function to get the viewBox information so I can't store the value in a class property. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ciao Alessio, sorry for the delay, I'll be able to take a look at this soon. |
||
|
||
|
||
/*! | ||
* @brief Returns an array of paths given the XML string of an SVG. | ||
* | ||
*/ | ||
+ (NSArray<SVGBezierPath*> *)pathsFromSVGString:(NSString *)svgString; | ||
+ (NSArray<SVGBezierPath*> *)pathsFromSVGString:(NSString *)svgString viewBox:(CGRect *)viewBox; | ||
|
||
/*! | ||
* @brief Returns a new path with the values of `attributes` added to `svgAttributes` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why a pointer to a CGRect? This creates the need to pass in an
UnsafeMutablePointer<CGRect>
in Swift.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this pointer to get the viewBox info and put this value in the _svg_viewBoxCache variable. I don't know if this part can be write in a better way :)