Authored by Thomas Rasch

Backported from route-me: Line shadows for RMPath

... ... @@ -69,6 +69,11 @@
size_t _lineDashCount;
CGFloat lineDashPhase;
// Line shadow
CGFloat shadowBlur;
CGSize shadowOffset;
BOOL enableShadow;
BOOL scaleLineWidth;
BOOL scaleLineDash; // if YES line dashes will be scaled to keep a constant size if the layer is zoomed
... ... @@ -86,6 +91,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, retain) UIColor *lineColor;
@property (nonatomic, retain) UIColor *fillColor;
@property (nonatomic, readonly) CGRect pathBoundingBox;
... ...
... ... @@ -36,6 +36,9 @@
@synthesize scaleLineWidth;
@synthesize lineDashPhase;
@synthesize scaleLineDash;
@synthesize shadowBlur;
@synthesize shadowOffset;
@synthesize enableShadow;
@synthesize pathBoundingBox;
#define kDefaultLineWidth 2
... ... @@ -64,6 +67,10 @@
_scaledLineDashLengths = NULL;
lineDashPhase = 0.0;
self.shadowBlur = 0.0;
self.shadowOffset = CGSizeMake(0, 0);
self.enableShadow = NO;
self.masksToBounds = YES;
scaleLineWidth = NO;
... ... @@ -274,6 +281,9 @@
if (_lineDashLengths)
CGContextSetLineDash(theContext, lineDashPhase, dashLengths, _lineDashCount);
if (self.enableShadow)
CGContextSetShadow(theContext, self.shadowOffset, self.shadowBlur);
// according to Apple's documentation, DrawPath closes the path if it's a filled style, so a call to ClosePath isn't necessary
CGContextDrawPath(theContext, drawingMode);
}
... ...
... ... @@ -61,7 +61,7 @@
2BE5B5030F7AF56F00EF8CC6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
2BE5B5070F7AF58000EF8CC6 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
2BE5B5090F7AF58900EF8CC6 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
32CA4F630368D1EE00C91783 /* LayeredMap_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; path = LayeredMap_Prefix.pch; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* LayeredMap_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayeredMap_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
... ...