Authored by Justin R. Miller

added shape properties to RMShape like in RMPath

@@ -60,6 +60,9 @@ @@ -60,6 +60,9 @@
60 @property (nonatomic, assign) BOOL scaleLineDash; 60 @property (nonatomic, assign) BOOL scaleLineDash;
61 @property (nonatomic, assign) float lineWidth; 61 @property (nonatomic, assign) float lineWidth;
62 @property (nonatomic, assign) BOOL scaleLineWidth; 62 @property (nonatomic, assign) BOOL scaleLineWidth;
  63 +@property (nonatomic, assign) CGFloat shadowBlur;
  64 +@property (nonatomic, assign) CGSize shadowOffset;
  65 +@property (nonatomic, assign) BOOL enableShadow;
63 66
64 @property (nonatomic, readonly) CGRect pathBoundingBox; 67 @property (nonatomic, readonly) CGRect pathBoundingBox;
65 68
@@ -48,6 +48,9 @@ @@ -48,6 +48,9 @@
48 @synthesize scaleLineWidth; 48 @synthesize scaleLineWidth;
49 @synthesize lineDashLengths; 49 @synthesize lineDashLengths;
50 @synthesize scaleLineDash; 50 @synthesize scaleLineDash;
  51 +@synthesize shadowBlur;
  52 +@synthesize shadowOffset;
  53 +@synthesize enableShadow;
51 @synthesize pathBoundingBox; 54 @synthesize pathBoundingBox;
52 55
53 #define kDefaultLineWidth 2.0 56 #define kDefaultLineWidth 2.0
@@ -70,6 +73,9 @@ @@ -70,6 +73,9 @@
70 shapeLayer.lineJoin = kCALineJoinMiter; 73 shapeLayer.lineJoin = kCALineJoinMiter;
71 shapeLayer.strokeColor = [UIColor blackColor].CGColor; 74 shapeLayer.strokeColor = [UIColor blackColor].CGColor;
72 shapeLayer.fillColor = [UIColor clearColor].CGColor; 75 shapeLayer.fillColor = [UIColor clearColor].CGColor;
  76 + shapeLayer.shadowRadius = 0.0;
  77 + shapeLayer.shadowOpacity = 0.0;
  78 + shapeLayer.shadowOffset = CGSizeMake(0, 0);
73 [self addSublayer:shapeLayer]; 79 [self addSublayer:shapeLayer];
74 80
75 pathBoundingBox = CGRectZero; 81 pathBoundingBox = CGRectZero;
@@ -413,6 +419,40 @@ @@ -413,6 +419,40 @@
413 } 419 }
414 } 420 }
415 421
  422 +- (CGFloat)shadowBlur
  423 +{
  424 + return shapeLayer.shadowRadius;
  425 +}
  426 +
  427 +- (void)setShadowBlur:(CGFloat)blur
  428 +{
  429 + shapeLayer.shadowRadius = blur;
  430 + [self setNeedsDisplay];
  431 +}
  432 +
  433 +- (CGSize)shadowOffset
  434 +{
  435 + return shapeLayer.shadowOffset;
  436 +}
  437 +
  438 +- (void)setShadowOffset:(CGSize)offset
  439 +{
  440 + shapeLayer.shadowOffset = offset;
  441 + [self setNeedsDisplay];
  442 +}
  443 +
  444 +- (BOOL)enableShadow
  445 +{
  446 + return (shapeLayer.shadowOpacity > 0);
  447 +}
  448 +
  449 +- (void)setEnableShadow:(BOOL)flag
  450 +{
  451 + shapeLayer.shadowOpacity = (flag ? 1.0 : 0.0);
  452 + shapeLayer.shouldRasterize = ! flag;
  453 + [self setNeedsDisplay];
  454 +}
  455 +
416 - (NSString *)fillRule 456 - (NSString *)fillRule
417 { 457 {
418 return shapeLayer.fillRule; 458 return shapeLayer.fillRule;