mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-02 14:50:43 +00:00
finish gradients refactor
This commit is contained in:
@@ -7,13 +7,14 @@
|
||||
*/
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import "RNSVGBrush.h"
|
||||
#import "RCTConvert+RNSVG.h"
|
||||
#import "RNSVGCGFloatArray.h"
|
||||
#import "RNSVGTextFrame.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RNSVGCGFCRule.h"
|
||||
|
||||
@class RNSVGBrush;
|
||||
|
||||
@interface RCTConvert (RNSVG)
|
||||
|
||||
+ (CGPathRef)CGPath:(id)json;
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
|
||||
#import "RCTConvert+RNSVG.h"
|
||||
|
||||
#import "RNSVGLinearGradient.h"
|
||||
#import "RNSVGBaseBrush.h"
|
||||
#import "RNSVGPattern.h"
|
||||
#import "RNSVGRadialGradient.h"
|
||||
#import "RNSVGSolidColor.h"
|
||||
#import "RNSVGSolidColorBrush.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RNSVGCGFCRule.h"
|
||||
|
||||
@@ -155,15 +154,9 @@ RCT_ENUM_CONVERTER(RNSVGCGFCRule, (@{
|
||||
case 0: // solid color
|
||||
// These are probably expensive allocations since it's often the same value.
|
||||
// We should memoize colors but look ups may be just as expensive.
|
||||
return [[RNSVGSolidColor alloc] initWithArray:arr];
|
||||
case 1: // linear gradient
|
||||
return [[RNSVGLinearGradient alloc] initWithArray:arr];
|
||||
case 2: // radial gradient
|
||||
return [[RNSVGRadialGradient alloc] initWithArray:arr];
|
||||
case 3: // pattern
|
||||
// TODO:
|
||||
return nil;
|
||||
return [[RNSVGPattern alloc] initWithArray:arr];
|
||||
return [[RNSVGSolidColorBrush alloc] initWithArray:arr];
|
||||
case 1: // brush
|
||||
return [[RNSVGBaseBrush alloc] initWithArray:arr];
|
||||
default:
|
||||
RCTLogError(@"Unknown brush type: %zd", type);
|
||||
return nil;
|
||||
|
||||
Reference in New Issue
Block a user