Created
March 5, 2013 14:11
-
-
Save nevyn/5090559 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)drawRect:(CGRect)dirtyRect | |
| { | |
| CGRect imageBounds = CGRectMake(0.0f, 0.0f, kMyViewWidth, kMyViewHeight); | |
| CGRect bounds = [self bounds]; | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| UIColor *color; | |
| CGFloat resolution; | |
| CGFloat alignStroke; | |
| CGFloat stroke; | |
| CGMutablePathRef path; | |
| CGPoint point; | |
| CGPoint controlPoint1; | |
| CGPoint controlPoint2; | |
| CGGradientRef gradient; | |
| NSMutableArray *colors; | |
| CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); | |
| CGPoint point2; | |
| CGAffineTransform transform; | |
| CGMutablePathRef tempPath; | |
| CGRect pathBounds; | |
| CGRect drawRect; | |
| CGFloat locations[2]; | |
| resolution = 0.5f * (bounds.size.width / imageBounds.size.width + bounds.size.height / imageBounds.size.height); | |
| CGContextSaveGState(context); | |
| CGContextTranslateCTM(context, bounds.origin.x, bounds.origin.y); | |
| CGContextScaleCTM(context, (bounds.size.width / imageBounds.size.width), (bounds.size.height / imageBounds.size.height)); | |
| // Setup for Shadow Effect | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f]; | |
| CGContextSaveGState(context); | |
| CGContextSetShadowWithColor(context, CGSizeMake(0.0f * resolution, 3.0f * resolution), 3.0f * resolution, [color CGColor]); | |
| CGContextBeginTransparencyLayer(context, NULL); | |
| // Layer 1 | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(101.034f, 73.526f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(167.28f, 113.008f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(128.235f, 74.244f); | |
| controlPoint2 = CGPointMake(153.413f, 89.802f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(137.996f, 109.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(157.718f, 110.537f); | |
| controlPoint2 = CGPointMake(147.846f, 109.633f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(61.762f, 151.477f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(111.945f, 109.762f); | |
| controlPoint2 = CGPointMake(65.931f, 119.859f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(115.871f, 198.736f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(58.044f, 179.678f); | |
| controlPoint2 = CGPointMake(93.825f, 194.729f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(126.862f, 155.963f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(168.503f, 196.734f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(165.736f, 197.507f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(98.996f, 234.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(151.38f, 220.292f); | |
| controlPoint2 = CGPointMake(125.733f, 233.943f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(19.6f, 149.884f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(54.255f, 234.567f); | |
| controlPoint2 = CGPointMake(17.382f, 194.201f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(101.034f, 73.526f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(21.738f, 107.152f); | |
| controlPoint2 = CGPointMake(58.677f, 73.51f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(101.034f, 73.526f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextSetLineWidth(context, stroke); | |
| CGContextSetLineCap(context, kCGLineCapSquare); | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(202.0f, 215.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(202.0f, 235.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(178.0f, 235.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(178.0f, 130.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(202.0f, 144.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(236.0f, 130.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(227.0f, 152.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(202.0f, 152.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(202.0f, 215.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(305.5f, 235.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(292.5f, 235.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(280.5f, 185.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(268.5f, 235.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(256.5f, 235.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(281.0f, 130.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(305.5f, 235.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(371.5f, 152.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(389.5f, 152.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(389.5f, 173.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(371.5f, 173.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(371.5f, 234.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(358.5f, 234.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(358.5f, 173.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(336.5f, 173.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(336.5f, 234.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(323.5f, 234.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(323.5f, 173.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(306.5f, 173.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(306.5f, 152.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(323.5f, 152.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(323.5f, 130.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(336.5f, 130.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(336.5f, 152.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(358.5f, 152.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(358.5f, 130.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(371.5f, 130.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(371.5f, 152.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| drawRect = CGRectMake(407.5f, 154.5f, 13.0f, 80.0f); | |
| drawRect.origin.x = (roundf(resolution * drawRect.origin.x + alignStroke) - alignStroke) / resolution; | |
| drawRect.origin.y = (roundf(resolution * drawRect.origin.y + alignStroke) - alignStroke) / resolution; | |
| drawRect.size.width = roundf(resolution * drawRect.size.width) / resolution; | |
| drawRect.size.height = roundf(resolution * drawRect.size.height) / resolution; | |
| CGPathAddRect(path, NULL, drawRect); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| drawRect = CGRectMake(407.5f, 109.5f, 13.0f, 20.0f); | |
| drawRect.origin.x = (roundf(resolution * drawRect.origin.x + alignStroke) - alignStroke) / resolution; | |
| drawRect.origin.y = (roundf(resolution * drawRect.origin.y + alignStroke) - alignStroke) / resolution; | |
| drawRect.size.width = roundf(resolution * drawRect.size.width) / resolution; | |
| drawRect.size.height = roundf(resolution * drawRect.size.height) / resolution; | |
| CGPathAddEllipseInRect(path, NULL, drawRect); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(481.65f, 109.552f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(503.459f, 121.751f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(490.39f, 110.109f); | |
| controlPoint2 = CGPointMake(498.129f, 114.974f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(495.75f, 120.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(500.979f, 120.874f); | |
| controlPoint2 = CGPointMake(498.364f, 120.578f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(490.437f, 180.413f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(462.623f, 121.573f); | |
| controlPoint2 = CGPointMake(458.928f, 172.478f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(488.571f, 181.108f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(488.985f, 180.983f); | |
| controlPoint2 = CGPointMake(489.612f, 180.764f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(479.5f, 251.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(521.421f, 192.57f); | |
| controlPoint2 = CGPointMake(515.499f, 250.15f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(456.037f, 238.921f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(470.031f, 251.532f); | |
| controlPoint2 = CGPointMake(461.714f, 246.203f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(491.297f, 217.434f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(471.709f, 244.817f); | |
| controlPoint2 = CGPointMake(487.98f, 232.933f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(469.478f, 181.456f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(494.624f, 201.888f); | |
| controlPoint2 = CGPointMake(485.348f, 185.005f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(470.917f, 180.917f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(469.949f, 181.252f); | |
| controlPoint2 = CGPointMake(470.435f, 181.089f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(481.65f, 109.552f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(436.637f, 170.033f); | |
| controlPoint2 = CGPointMake(443.976f, 107.783f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(481.65f, 109.552f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(152.0f, 420.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(137.147f, 420.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(94.5f, 376.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(51.853f, 420.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(19.5f, 420.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(85.75f, 334.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(152.0f, 420.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| drawRect = CGRectMake(169.5f, 299.5f, 8.0f, 121.0f); | |
| drawRect.origin.x = (roundf(resolution * drawRect.origin.x + alignStroke) - alignStroke) / resolution; | |
| drawRect.origin.y = (roundf(resolution * drawRect.origin.y + alignStroke) - alignStroke) / resolution; | |
| drawRect.size.width = roundf(resolution * drawRect.size.width) / resolution; | |
| drawRect.size.height = roundf(resolution * drawRect.size.height) / resolution; | |
| CGPathAddRect(path, NULL, drawRect); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| drawRect = CGRectMake(193.5f, 299.5f, 8.0f, 121.0f); | |
| drawRect.origin.x = (roundf(resolution * drawRect.origin.x + alignStroke) - alignStroke) / resolution; | |
| drawRect.origin.y = (roundf(resolution * drawRect.origin.y + alignStroke) - alignStroke) / resolution; | |
| drawRect.size.width = roundf(resolution * drawRect.size.width) / resolution; | |
| drawRect.size.height = roundf(resolution * drawRect.size.height) / resolution; | |
| CGPathAddRect(path, NULL, drawRect); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(257.756f, 307.52f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(297.206f, 334.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(275.088f, 308.116f); | |
| controlPoint2 = CGPointMake(288.905f, 320.058f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(236.5f, 334.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(236.5f, 359.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(305.007f, 359.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(304.837f, 377.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(305.763f, 365.47f); | |
| controlPoint2 = CGPointMake(305.692f, 371.543f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(236.5f, 377.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(236.5f, 405.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(294.741f, 405.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(256.5f, 428.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(286.433f, 419.079f); | |
| controlPoint2 = CGPointMake(272.494f, 427.967f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(226.99f, 319.835f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(206.298f, 426.796f); | |
| controlPoint2 = CGPointMake(191.918f, 352.631f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(257.756f, 307.52f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(235.405f, 311.966f); | |
| controlPoint2 = CGPointMake(246.208f, 307.477f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(257.756f, 307.52f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(340.299f, 329.985f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(345.174f, 406.612f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(336.149f, 354.202f); | |
| controlPoint2 = CGPointMake(335.482f, 383.529f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(358.5f, 420.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(347.417f, 411.954f); | |
| controlPoint2 = CGPointMake(351.599f, 420.5f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(371.826f, 406.612f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(365.401f, 420.5f); | |
| controlPoint2 = CGPointMake(369.583f, 411.954f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(377.321f, 333.322f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(380.781f, 385.283f); | |
| controlPoint2 = CGPointMake(381.224f, 355.811f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(379.532f, 422.129f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(393.055f, 357.404f); | |
| controlPoint2 = CGPointMake(393.693f, 397.226f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(357.5f, 438.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(374.882f, 430.307f); | |
| controlPoint2 = CGPointMake(367.538f, 438.262f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(330.16f, 409.997f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(342.736f, 437.967f); | |
| controlPoint2 = CGPointMake(334.247f, 422.342f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(340.334f, 329.815f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(322.099f, 385.641f); | |
| controlPoint2 = CGPointMake(323.398f, 350.4f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(340.299f, 329.985f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| stroke = 1.0f; | |
| stroke *= resolution; | |
| if (stroke < 1.0f) { | |
| stroke = ceilf(stroke); | |
| } else { | |
| stroke = roundf(stroke); | |
| } | |
| stroke /= resolution; | |
| alignStroke = fmodf(0.5f * stroke * resolution, 1.0f); | |
| path = CGPathCreateMutable(); | |
| point = CGPointMake(453.706f, 307.062f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathMoveToPoint(path, NULL, point.x, point.y); | |
| point = CGPointMake(482.914f, 345.655f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(472.775f, 308.522f); | |
| controlPoint2 = CGPointMake(483.696f, 328.03f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(462.061f, 318.5f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(482.279f, 333.776f); | |
| controlPoint2 = CGPointMake(475.505f, 319.221f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(459.817f, 377.824f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(434.825f, 321.187f); | |
| controlPoint2 = CGPointMake(434.028f, 372.694f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(455.069f, 378.81f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(458.275f, 378.332f); | |
| controlPoint2 = CGPointMake(456.675f, 378.607f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(482.143f, 421.894f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(473.617f, 383.763f); | |
| controlPoint2 = CGPointMake(486.836f, 402.743f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(445.061f, 450.0f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(478.04f, 438.636f); | |
| controlPoint2 = CGPointMake(461.833f, 449.602f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(407.124f, 410.853f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(423.914f, 450.153f); | |
| controlPoint2 = CGPointMake(405.924f, 432.091f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(453.585f, 431.884f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(408.741f, 433.743f); | |
| controlPoint2 = CGPointMake(435.357f, 448.272f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(441.374f, 377.673f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(471.278f, 415.976f); | |
| controlPoint2 = CGPointMake(464.819f, 383.765f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(443.364f, 377.54f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(442.812f, 377.554f); | |
| controlPoint2 = CGPointMake(442.149f, 377.594f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(453.706f, 307.062f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| controlPoint1 = CGPointMake(409.298f, 367.222f); | |
| controlPoint2 = CGPointMake(416.412f, 305.004f); | |
| CGPathAddCurveToPoint(path, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, point.x, point.y); | |
| point = CGPointMake(453.706f, 307.062f); | |
| point.x = (roundf(resolution * point.x + alignStroke) - alignStroke) / resolution; | |
| point.y = (roundf(resolution * point.y + alignStroke) - alignStroke) / resolution; | |
| CGPathAddLineToPoint(path, NULL, point.x, point.y); | |
| CGPathCloseSubpath(path); | |
| colors = [NSMutableArray arrayWithCapacity:2]; | |
| color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[0] = 0.0f; | |
| color = [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f]; | |
| [colors addObject:(id)[color CGColor]]; | |
| locations[1] = 1.0f; | |
| gradient = CGGradientCreateWithColors(space, (CFArrayRef)colors, locations); | |
| CGContextAddPath(context, path); | |
| CGContextSaveGState(context); | |
| CGContextEOClip(context); | |
| transform = CGAffineTransformMakeRotation(1.571f); | |
| tempPath = CGPathCreateMutable(); | |
| CGPathAddPath(tempPath, &transform, path); | |
| pathBounds = CGPathGetPathBoundingBox(tempPath); | |
| point = pathBounds.origin; | |
| point2 = CGPointMake(CGRectGetMaxX(pathBounds), CGRectGetMinY(pathBounds)); | |
| transform = CGAffineTransformInvert(transform); | |
| point = CGPointApplyAffineTransform(point, transform); | |
| point2 = CGPointApplyAffineTransform(point2, transform); | |
| CGPathRelease(tempPath); | |
| CGContextDrawLinearGradient(context, gradient, point, point2, (kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation)); | |
| CGContextRestoreGState(context); | |
| CGGradientRelease(gradient); | |
| color = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]; | |
| [color setStroke]; | |
| CGContextAddPath(context, path); | |
| CGContextStrokePath(context); | |
| CGPathRelease(path); | |
| // Shadow Effect | |
| CGContextEndTransparencyLayer(context); | |
| CGContextRestoreGState(context); | |
| CGContextRestoreGState(context); | |
| CGColorSpaceRelease(space); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment