Authored by Justin R. Miller

added shape properties to RMShape like in RMPath

... ... @@ -60,6 +60,9 @@
@property (nonatomic, assign) BOOL scaleLineDash;
@property (nonatomic, assign) float lineWidth;
@property (nonatomic, assign) BOOL scaleLineWidth;
@property (nonatomic, assign) CGFloat shadowBlur;
@property (nonatomic, assign) CGSize shadowOffset;
@property (nonatomic, assign) BOOL enableShadow;
@property (nonatomic, readonly) CGRect pathBoundingBox;
... ...
... ... @@ -48,6 +48,9 @@
@synthesize scaleLineWidth;
@synthesize lineDashLengths;
@synthesize scaleLineDash;
@synthesize shadowBlur;
@synthesize shadowOffset;
@synthesize enableShadow;
@synthesize pathBoundingBox;
#define kDefaultLineWidth 2.0
... ... @@ -70,6 +73,9 @@
shapeLayer.lineJoin = kCALineJoinMiter;
shapeLayer.strokeColor = [UIColor blackColor].CGColor;
shapeLayer.fillColor = [UIColor clearColor].CGColor;
shapeLayer.shadowRadius = 0.0;
shapeLayer.shadowOpacity = 0.0;
shapeLayer.shadowOffset = CGSizeMake(0, 0);
[self addSublayer:shapeLayer];
pathBoundingBox = CGRectZero;
... ... @@ -413,6 +419,40 @@
}
}
- (CGFloat)shadowBlur
{
return shapeLayer.shadowRadius;
}
- (void)setShadowBlur:(CGFloat)blur
{
shapeLayer.shadowRadius = blur;
[self setNeedsDisplay];
}
- (CGSize)shadowOffset
{
return shapeLayer.shadowOffset;
}
- (void)setShadowOffset:(CGSize)offset
{
shapeLayer.shadowOffset = offset;
[self setNeedsDisplay];
}
- (BOOL)enableShadow
{
return (shapeLayer.shadowOpacity > 0);
}
- (void)setEnableShadow:(BOOL)flag
{
shapeLayer.shadowOpacity = (flag ? 1.0 : 0.0);
shapeLayer.shouldRasterize = ! flag;
[self setNeedsDisplay];
}
- (NSString *)fillRule
{
return shapeLayer.fillRule;
... ...