refactor Use and Defs element with native code support(iOS)

This commit is contained in:
Horcrux
2016-07-19 23:09:51 +08:00
parent 4eddfc6885
commit dd6cb80e84
37 changed files with 535 additions and 282 deletions
+28 -6
View File
@@ -11,21 +11,22 @@
#import "RNSVGSvgView.h"
/**
* RNSVG nodes are implemented as empty UIViews but this is just an implementation detail to fit
* into the existing view management. They should also be shadow views and painted on a background
* thread.
* RNSVG nodes are implemented as base UIViews. They should be implementation for all basic
interfaces for all non-defination nodes.
*/
@interface RNSVGNode : UIView
@property (nonatomic, assign) CGRect rect;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) CGFloat opacity;
@property (nonatomic, assign) RNSVGCGFCRule clipRule;
@property (nonatomic, assign) CGPathRef clipPath; // convert clipPath="M0,0 L0,10 L10,10z" into path
@property (nonatomic, strong) NSString *clipPathRef; // use clipPath="url(#clip)" as ClipPath
@property (nonatomic, assign) BOOL responsible;
- (void)invalidate;
- (void)renderTo:(CGContextRef)context;
/**
@@ -36,20 +37,41 @@
- (void)renderLayerTo:(CGContextRef)context;
/**
* clip node by clipPath or clipPathId.
* clip node by clipPath or clipPathRef.
*/
- (void)clip:(CGContextRef)context;
/**
* get clip path for current node.
*/
- (CGPathRef)getClipPath;
/**
* getPath will return the path inside node as a ClipPath.
*/
- (CGPathRef)getPath: (CGContextRef) context;
- (CGPathRef)getPath:(CGContextRef) context;
/**
* run hitTest
*/
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;
- (RNSVGSvgView *)getSvgView;
/**
* save element`s defination into svg element.
*/
- (void)saveDefination:(CGContextRef)context;
/**
* remove element`s defination from svg element.
*/
- (void)removeDefination;
/**
* merge owned properties into target element`s properties
*/
- (void)mergeProperties:(__kindof RNSVGNode *)target;
@end