Created
September 17, 2008 17:58
-
-
Save boucher/11268 to your computer and use it in GitHub Desktop.
This file contains 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)drawInContext:(CGContext)aContext | |
{ | |
var bounds = CGRectInset([self bounds], 5.0, 5.0), | |
theClass = [self class]; | |
bounds.origin.x -= 1.0; | |
if(TransformControlNeedsManualShadow) | |
{ | |
CGContextSetStrokeColor(aContext, [theClass shadowColor]); | |
CGContextSetLineWidth(aContext, 1.0); | |
var minX = CGRectGetMinX(bounds), midX = CGRectGetMidX(bounds), maxX = CGRectGetMaxX(bounds), | |
minY = CGRectGetMinY(bounds), midY = CGRectGetMidY(bounds), maxY = CGRectGetMaxY(bounds); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(minX+1, minY+1, 0, 0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(midX+1, minY+1, 0, 0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(maxX+1, minY+1, 0, 0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(minX+1, midY+1, 0, 0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(maxX+1, midY+1, 0, 0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(minX+1, maxY+1, 0, 0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(midX+1, maxY+1, 0, 0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(maxX+1, maxY+1, 0, 0), -3.0, -3.0)); | |
CGContextStrokeLineSegments(aContext, [ | |
CGPointMake(minX + 8.0, minY+1), CGPointMake(midX - 6.0, minY+1), | |
CGPointMake(midX + 8.0, minY+1), CGPointMake(maxX - 6.0, minY+1), | |
CGPointMake(minX+1, minY + 8.0), CGPointMake(minX+1, midY - 6.0), | |
CGPointMake(minX+1, midY + 8.0), CGPointMake(minX+1, maxY - 6.0), | |
CGPointMake(maxX+1, minY + 8.0), CGPointMake(maxX+1, midY - 6.0), | |
CGPointMake(maxX+1, midY + 8.0), CGPointMake(maxX+1, maxY - 6.0), | |
CGPointMake(minX + 8.0, maxY+1), CGPointMake(midX - 6.0, maxY+1), | |
CGPointMake(midX + 8.0, maxY+1), CGPointMake(maxX - 6.0, maxY+1) | |
]); | |
} | |
CGContextSetShadowWithColor(aContext, CGSizeMake(1.01, 1.01), 1.0, [theClass shadowColor]); | |
CGContextSetStrokeColor(aContext, [theClass controlColor]); | |
CGContextSetLineWidth(aContext, 1.5); | |
var minX = CGRectGetMinX(bounds), midX = CGRectGetMidX(bounds), maxX = CGRectGetMaxX(bounds), | |
minY = CGRectGetMinY(bounds), midY = CGRectGetMidY(bounds), maxY = CGRectGetMaxY(bounds); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(minX, minY, 0.0, 0.0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(midX, minY, 0.0, 0.0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(maxX, minY, 0.0, 0.0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(minX, midY, 0.0, 0.0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(maxX, midY, 0.0, 0.0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(minX, maxY, 0.0, 0.0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(midX, maxY, 0.0, 0.0), -3.0, -3.0)); | |
CGContextStrokeEllipseInRect(aContext, CGRectInset(CGRectMake(maxX, maxY, 0.0, 0.0), -3.0, -3.0)); | |
CGContextStrokeLineSegments(aContext, [ | |
CGPointMake(minX + 7.0, minY), CGPointMake(midX - 7.0, minY), | |
CGPointMake(midX + 7.0, minY), CGPointMake(maxX - 7.0, minY), | |
CGPointMake(minX, minY + 7.0), CGPointMake(minX, midY - 7.0), | |
CGPointMake(minX, midY + 7.0), CGPointMake(minX, maxY - 7.0), | |
CGPointMake(maxX, minY + 7.0), CGPointMake(maxX, midY - 7.0), | |
CGPointMake(maxX, midY + 7.0), CGPointMake(maxX, maxY - 7.0), | |
CGPointMake(minX + 7.0, maxY), CGPointMake(midX - 7.0, maxY), | |
CGPointMake(midX + 7.0, maxY), CGPointMake(maxX - 7.0, maxY) | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment