41 if (sides.length != grays.length)
42 [
CPException raise:CPInvalidArgumentException
reason:@"sides (length: " + sides.length + ") and grays (length: " + grays.length + ") must have the same length."];
44 var colors = [grays arrayByApplyingBlock:function(gray)
58 if (sides.length != colors.length)
59 [
CPException raise:CPInvalidArgumentException
reason:@"sides (length: " + sides.length + ") and colors (length: " + colors.length + ") must have the same length."];
61 var resultRect = CGRectMakeCopy(boundsRect),
62 slice = CGRectMakeZero(),
63 remainder = CGRectMakeZero(),
69 for (var sideIndex = 0; sideIndex < sides.length; ++sideIndex)
71 var side = sides[sideIndex];
73 CGRectDivide(resultRect, slice, remainder, 1.0, side);
74 resultRect = remainder;
75 slice = CGRectIntersection(slice, clipRect);
78 if (CGRectIsEmpty(slice))
89 if (CGRectGetWidth(slice) < 1.0)
92 minX = CGRectGetMinX(slice) + 0.5;
94 minY = CGRectGetMinY(slice);
95 maxY = CGRectGetMaxY(slice);
100 if (CGRectGetHeight(slice) < 1.0)
103 minX = CGRectGetMinX(slice);
104 maxX = CGRectGetMaxX(slice);
105 minY = CGRectGetMinY(slice) + 0.5;
Used to implement exception handling (creating & raising).
CPCalibratedRGBColorSpace
CPGraphicsContext currentContext()
function CGContextSetStrokeColor(aContext, aColor)
function CGContextRestoreGState(aContext)
function CPDrawColorTiledRects(boundsRect, clipRect, sides, colors)
void raise:reason:(CPString aName, [reason] CPString aReason)
function CGContextAddLineToPoint(aContext, x, y)
function CGContextStrokePath(aContext)
function CGContextSetLineWidth(aContext, aLineWidth)
CPColor colorWithCalibratedWhite:alpha:(float white, [alpha] float alpha)
CPCalibratedBlackColorSpace
function CPDrawTiledRects(boundsRect, clipRect, sides, grays)
function CGContextBeginPath(aContext)
function CGContextSaveGState(aContext)
CPCalibratedWhiteColorSpace
function CGContextMoveToPoint(aContext, x, y)