mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-15 11:13:50 +00:00
Some documentation enhancements.
This commit is contained in:
1 parent
3b0feec801
commit
e05816419e
3 files changed
+216
-120
No files matched your search
@@ -592,18 +592,27 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
|
||||
|
||||
@implementation CPColor (CoreGraphicsExtensions)
|
||||
|
||||
/*!
|
||||
Set's the receiver to be the fill and stroke color in the current graphics context
|
||||
*/
|
||||
- (void)set
|
||||
{
|
||||
[self setFill];
|
||||
[self setStroke];
|
||||
}
|
||||
|
||||
/*!
|
||||
Set's the receiver to be the fill color in the current graphics context
|
||||
*/
|
||||
- (void)setFill
|
||||
{
|
||||
var ctx = [[CPGraphicsContext currentContext] graphicsPort];
|
||||
CGContextSetFillColor(ctx, self);
|
||||
}
|
||||
|
||||
/*!
|
||||
Set's the receiver to be the stroke color in the current graphics context
|
||||
*/
|
||||
- (void)setStroke
|
||||
{
|
||||
var ctx = [[CPGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
+196
-120
@@ -41,145 +41,37 @@ kCGPathStroke = 2;
|
||||
kCGPathFillStroke = 3;
|
||||
kCGPathEOFillStroke = 4;
|
||||
|
||||
/*
|
||||
@global
|
||||
/*!
|
||||
@group CGBlendMode
|
||||
*/
|
||||
|
||||
kCGBlendModeNormal = 0;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeMultiply = 1;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeScreen = 2;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeOverlay = 3;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeDarken = 4;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeLighten = 5;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeColorDodge = 6;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeColorBurn = 7;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeSoftLight = 8;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeHardLight = 9;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeDifference = 10;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeExclusion = 11;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeHue = 12;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeSaturation = 13;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeColor = 14;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeLuminosity = 15;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeClear = 16;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeCopy = 17;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeSourceIn = 18;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeSourceOut = 19;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeSourceAtop = 20;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeDestinationOver = 21;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeDestinationIn = 22;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeDestinationOut = 23;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeDestinationAtop = 24;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModeXOR = 25;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModePlusDarker = 26;
|
||||
/*
|
||||
@global
|
||||
@group CGBlendMode
|
||||
*/
|
||||
kCGBlendModePlusLighter = 27;
|
||||
|
||||
/*!
|
||||
@@ -206,6 +98,10 @@ function CGContextRetain(aContext)
|
||||
if (!CPFeatureIsCompatible(CPHTMLCanvasFeature))
|
||||
{
|
||||
|
||||
/*!
|
||||
Creates a new graphics state, which describes all the current values for drawing.
|
||||
@return a graphics state
|
||||
*/
|
||||
function CGGStateCreate()
|
||||
{
|
||||
return { alpha:1.0, strokeStyle:"#000", fillStyle:"#ccc", lineWidth:1.0, lineJoin:kCGLineJoinMiter, lineCap:kCGLineCapButt, miterLimit:10.0, globalAlpha:1.0,
|
||||
@@ -213,6 +109,11 @@ function CGGStateCreate()
|
||||
shadowOffset:_CGSizeMakeZero(), shadowBlur:0.0, shadowColor:NULL, CTM:_CGAffineTransformMakeIdentity() };
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a copy of the given graphics state.
|
||||
@param aGState the graphics state to copy
|
||||
@return a copy of the given graphics state
|
||||
*/
|
||||
function CGGStateCreateCopy(aGState)
|
||||
{
|
||||
return { alpha:aGState.alpha, strokeStyle:aGState.strokeStyle, fillStyle:aGState.fillStyle, lineWidth:aGState.lineWidth,
|
||||
@@ -221,16 +122,30 @@ function CGGStateCreateCopy(aGState)
|
||||
shadowOffset:aGState.shadowOffset, shadowBlur:aGState.shadowBlur, shadowColor:aGState.shadowColor, CTM:_CGAffineTransformMakeCopy(aGState.CTM) };
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a new graphics context.
|
||||
@return CGContext a new graphics context which can be drawn into
|
||||
*/
|
||||
function CGBitmapGraphicsContextCreate()
|
||||
{
|
||||
return { DOMElement:document.createElement("div"), path:NULL, gState:CGGStateCreate(), gStateStack:[] };
|
||||
}
|
||||
|
||||
/*!
|
||||
Pushes the current graphics state of aContext onto the top of a stack.
|
||||
@param aContext the CGContext to edit
|
||||
@return void
|
||||
*/
|
||||
function CGContextSaveGState(aContext)
|
||||
{
|
||||
aContext.gStateStack.push(CGGStateCreateCopy(aContext.gState));
|
||||
}
|
||||
|
||||
/*!
|
||||
Pops the most recent graphics state of the top of the graphics stack and restores it.
|
||||
@param aContext the CGContext to edit
|
||||
@return void
|
||||
*/
|
||||
function CGContextRestoreGState(aContext)
|
||||
{
|
||||
aContext.gState = aContext.gStateStack.pop();
|
||||
@@ -266,26 +181,67 @@ function CGContextAddArc(aContext, x, y, radius, startAngle, endAngle, clockwise
|
||||
CGPathAddArc(aContext.path, aContext.gState.CTM, x, y, radius, startAngle, endAngle, clockwise);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds an arc to the current context that ends in the specified point.
|
||||
@param aContext the CGContext to edit
|
||||
@param x1 the x coordinate of the beginning of the arc
|
||||
@param y1 the y coordinate of the beginning of the arc
|
||||
@param x2 the x coordinate of the end of the arc
|
||||
@param y2 the y coordinate of the end of the arc
|
||||
@param radius the radius of the arc to be drawn
|
||||
@return void
|
||||
*/
|
||||
function CGContextAddArcToPoint(aContext, x1, y1, x2, y2, radius)
|
||||
{
|
||||
CGPathAddArcToPoint(aContext.path, aContext.gState.CTM, x1, y1, x2, y2, radius);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a cubic curve to the current context
|
||||
@param aContext the CGContext to edit
|
||||
@param cp1x the x coordinate of the first control point
|
||||
@param cp1y the y coordinate of the first control point
|
||||
@param cp2x the x coordinate of the second control point
|
||||
@param cp2y the y coordinate of the second control point
|
||||
@param x the x coordinate of the end of the curve
|
||||
@param y the y coordinate of the end of the curve
|
||||
@return void
|
||||
*/
|
||||
function CGContextAddCurveToPoint(aContext, cp1x, cp1y, cp2x, cp2y, x, y)
|
||||
{
|
||||
CGPathAddCurveToPoint(aContext.path, aContext.gState.CTM, cp1x, cp1y, cp2x, cp2y, x, y);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a line to each element in the points array
|
||||
@param aContext the CGContext to move
|
||||
@param points an array of points that are to be consecutively executed as if they were individual addToPoint calls
|
||||
@param count an upper bound on the number of points to use
|
||||
@return void
|
||||
*/
|
||||
function CGContextAddLines(aContext, points, count)
|
||||
{
|
||||
CGPathAddLines(aContext.path, aContext.gState.CTM, points, count);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a line from the current point to the x/y
|
||||
@param aContext the CGContext to move
|
||||
@param x the x coordinate of the end point of the line
|
||||
@param y the y coordinate of the end point of the line
|
||||
@return void
|
||||
*/
|
||||
function CGContextAddLineToPoint(aContext, x, y)
|
||||
{
|
||||
CGPathAddLineToPoint(aContext.path, aContext.gState.CTM, x, y);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds aPath to the current path in aContext
|
||||
@param aContext the CGContext to add to
|
||||
@param aPath the path to be added
|
||||
@return void
|
||||
*/
|
||||
function CGContextAddPath(aContext, aPath)
|
||||
{
|
||||
if (!aContext || CGPathIsEmpty(aPath))
|
||||
@@ -297,32 +253,71 @@ function CGContextAddPath(aContext, aPath)
|
||||
CGPathAddPath(aContext.path, aContext.gState.CTM, aPath);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a quadratic curve from the current point to the point specified by x/y, using the control point specified by cpx/cpy
|
||||
@param aContext the CGContext to add the curve to
|
||||
@param cpx the x coordinate for the curve's control point
|
||||
@param cpy the y coordinate for the curve's control point
|
||||
@param x the x coordinate for the end point of the curve
|
||||
@param y the y coordinate for the end point of the curve
|
||||
@return void
|
||||
*/
|
||||
function CGContextAddQuadCurveToPoint(aContext, cpx, cpy, x, y)
|
||||
{
|
||||
CGPathAddQuadCurveToPoint(aContext.path, aContext.gState.CTM, cpx, cpy, x, y);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds aRect to the current path in the given context
|
||||
@param aContext the CGContext to add to
|
||||
@param aRect the dimensions of the rectangle to add
|
||||
@return void
|
||||
*/
|
||||
function CGContextAddRect(aContext, aRect)
|
||||
{
|
||||
CGPathAddRect(aContext.path, aContext.gState.CTM, aRect);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds up to count elements from rects to the current path in aContext
|
||||
@param aContext the CGContext to add to
|
||||
@param rects an array of CGRects to be added to the context's path
|
||||
@param the upper bound of elements to be added
|
||||
@return void
|
||||
*/
|
||||
function CGContextAddRects(aContext, rects, count)
|
||||
{
|
||||
CGPathAddRects(aContext.path, aContext.gState.CTM, rects, count);
|
||||
}
|
||||
|
||||
/*!
|
||||
Begins a new subpath in the given context
|
||||
@param aContext the CGContext to create a new path in
|
||||
@return void
|
||||
*/
|
||||
function CGContextBeginPath(aContext)
|
||||
{
|
||||
// This clears any previous path.
|
||||
aContext.path = CGPathCreateMutable();
|
||||
}
|
||||
|
||||
/*!
|
||||
Closes the currently open subpath, if any, in aContext
|
||||
@param aContext the CGContext to close a path in
|
||||
@return void
|
||||
*/
|
||||
function CGContextClosePath(aContext)
|
||||
{
|
||||
CGPathCloseSubpath(aContext.path);
|
||||
}
|
||||
|
||||
/*!
|
||||
Moves the current location of aContext to the given x and y coordinates
|
||||
@param aContext the CGContext to move
|
||||
@param x the x location to move the context to
|
||||
@param y the y location to move the context to
|
||||
@return void
|
||||
*/
|
||||
function CGContextMoveToPoint(aContext, x, y)
|
||||
{
|
||||
if (!aContext.path)
|
||||
@@ -331,11 +326,24 @@ function CGContextMoveToPoint(aContext, x, y)
|
||||
CGPathMoveToPoint(aContext.path, aContext.gState.CTM, x, y);
|
||||
}
|
||||
|
||||
/*!
|
||||
Fills a rectangle in the given context with aRect dimensions, using the context's current fill color
|
||||
@param aContext the CGContext to draw into
|
||||
@param aRect the dimensions of the rectangle to fill
|
||||
@return void
|
||||
*/
|
||||
function CGContextFillRect(aContext, aRect)
|
||||
{
|
||||
CGContextFillRects(aContext, [aRect], 1);
|
||||
}
|
||||
|
||||
/*!
|
||||
Fills a rectangle in the given context for each CGRect in the given array, up to a total of count rects
|
||||
@param aContext the CGContext to draw into
|
||||
@param rects an array of rects to fill
|
||||
@param count the maximum number of rects from the given array to fill
|
||||
@return void
|
||||
*/
|
||||
function CGContextFillRects(aContext, rects, count)
|
||||
{
|
||||
if (arguments[2] === undefined)
|
||||
@@ -348,6 +356,12 @@ function CGContextFillRects(aContext, rects, count)
|
||||
CGContextDrawPath(aContext, kCGPathFill);
|
||||
}
|
||||
|
||||
/*!
|
||||
Strokes a rectangle with the given location into the given context, using the context's current width and color
|
||||
@param aContext the CGContext to draw into
|
||||
@param aRect a CGRect indicating the dimensions of the rectangle to be drawn
|
||||
@return void
|
||||
*/
|
||||
function CGContextStrokeRect(aContext, aRect)
|
||||
{
|
||||
CGContextBeginPath(aContext);
|
||||
@@ -357,6 +371,13 @@ function CGContextStrokeRect(aContext, aRect)
|
||||
CGContextDrawPath(aContext, kCGPathStroke);
|
||||
}
|
||||
|
||||
/*!
|
||||
Strokes a rectangle with the given dimensions and the given stroke width
|
||||
@param aContext the CGContext to draw into
|
||||
@param aRect the CGRect indicating the bounds of the rect to be drawn
|
||||
@param aWidth the width with which to stroke the rect
|
||||
@return void
|
||||
*/
|
||||
function CGContextStrokeRectWithWidth(aContext, aRect, aWidth)
|
||||
{
|
||||
CGContextSaveGState(aContext);
|
||||
@@ -367,6 +388,12 @@ function CGContextStrokeRectWithWidth(aContext, aRect, aWidth)
|
||||
CGContextRestoreGState(aContext);
|
||||
}
|
||||
|
||||
/*!
|
||||
Concatenates the given transformation matrix onto the current transformation matrix in aContext
|
||||
@param aContext the CGContext to transform
|
||||
@param aTransform the CGAffineTransform to apply to the given context
|
||||
@return void
|
||||
*/
|
||||
function CGContextConcatCTM(aContext, aTransform)
|
||||
{
|
||||
var CTM = aContext.gState.CTM;
|
||||
@@ -374,11 +401,23 @@ function CGContextConcatCTM(aContext, aTransform)
|
||||
_CGAffineTransformConcatTo(CTM, aTransform, CTM);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the current transformation matrix for the given context
|
||||
@param aContext the CGContext for which we are asking for the transform
|
||||
@return CGAffineTransform the current transformation matrix of the given context
|
||||
*/
|
||||
function CGContextGetCTM(aContext)
|
||||
{
|
||||
return aContext.gState.CTM;
|
||||
}
|
||||
|
||||
/*!
|
||||
Rotates the current context by anAngle radians
|
||||
@param aContext the CGContext to rotate
|
||||
@param anAngle the amount to rotate, in radians
|
||||
@return void
|
||||
*/
|
||||
|
||||
function CGContextRotateCTM(aContext, anAngle)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
@@ -386,6 +425,13 @@ function CGContextRotateCTM(aContext, anAngle)
|
||||
gState.CTM = CGAffineTransformRotate(gState.CTM, anAngle);
|
||||
}
|
||||
|
||||
/*!
|
||||
Scales the current context by sx/sy
|
||||
@param aContext the CGContext to scale
|
||||
@param sx the amount to scale in the x direction
|
||||
@param sy the amount to scale in the y direction
|
||||
@return void
|
||||
*/
|
||||
function CGContextScaleCTM(aContext, sx, sy)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
@@ -393,6 +439,13 @@ function CGContextScaleCTM(aContext, sx, sy)
|
||||
gState.CTM = _CGAffineTransformScale(gState.CTM, sx, sy);
|
||||
}
|
||||
|
||||
/*!
|
||||
Translates the given context by tx in the x direction and ty in the y direction
|
||||
@param aContext the CGContext to translate
|
||||
@param tx the amount to move in the x direction
|
||||
@param ty the amount to move in the y direction
|
||||
@return void
|
||||
*/
|
||||
function CGContextTranslateCTM(aContext, tx, ty)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
@@ -400,6 +453,14 @@ function CGContextTranslateCTM(aContext, tx, ty)
|
||||
gState.CTM = _CGAffineTransformTranslate(gState.CTM, tx, ty);
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the current offset, and blur for shadows in core graphics drawing operations
|
||||
@param aContext the CGContext of the shadow
|
||||
@param aSize a CGSize indicating the offset of the shaodw
|
||||
@param aBlur a float indicating the blur radius
|
||||
@return void
|
||||
*/
|
||||
|
||||
function CGContextSetShadow(aContext, aSize, aBlur)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
@@ -409,6 +470,14 @@ function CGContextSetShadow(aContext, aSize, aBlur)
|
||||
gState.shadowColor = [CPColor shadowColor];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the current offset, blur, and color for shadows in core graphics drawing operations
|
||||
@param aContext the CGContext of the shadow
|
||||
@param aSize a CGSize indicating the offset of the shaodw
|
||||
@param aBlur a float indicating the blur radius
|
||||
@param aColor a CPColor object indicating the color of the shadow
|
||||
@return void
|
||||
*/
|
||||
function CGContextSetShadowWithColor(aContext, aSize, aBlur, aColor)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
@@ -418,6 +487,12 @@ function CGContextSetShadowWithColor(aContext, aSize, aBlur, aColor)
|
||||
gState.shadowColor = aColor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the current alpha value for core graphics drawing operations in the given context .
|
||||
@param aContext the CGContext who's alpha value should be updated
|
||||
@param anAlpha the new alpha value. 1.0 is completely opaque, 0.0 is completely transparent.
|
||||
@return void
|
||||
*/
|
||||
function CGContextSetAlpha(aContext, anAlpha)
|
||||
{
|
||||
aContext.gState.alpha = MAX(MIN(anAlpha, 1.0), 0.0);
|
||||
@@ -430,7 +505,6 @@ function CGContextSetAlpha(aContext, anAlpha)
|
||||
Fills in the area of the current path, using the even-odd fill rule.
|
||||
@param aContext the CGContext of the path
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextEOFillPath(aContext)
|
||||
{
|
||||
@@ -441,7 +515,6 @@ function CGContextEOFillPath(aContext)
|
||||
Fills in the area of the current path, using the non-zero winding number rule.
|
||||
@param aContext the CGContext of the path
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextFillPath(aContext)
|
||||
{
|
||||
@@ -455,7 +528,6 @@ var KAPPA = 4.0 * ((SQRT2 - 1.0) / 3.0);
|
||||
@param aContext CGContext to draw on
|
||||
@param aRect the rectangle bounding the ellipse
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextAddEllipseInRect(aContext, aRect)
|
||||
{
|
||||
@@ -467,7 +539,6 @@ function CGContextAddEllipseInRect(aContext, aRect)
|
||||
@param aContext CGContext to draw on
|
||||
@param aRect the rectangle bounding the ellipse
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextFillEllipseInRect(aContext, aRect)
|
||||
{
|
||||
@@ -480,7 +551,6 @@ function CGContextFillEllipseInRect(aContext, aRect)
|
||||
@param aContext CGContext to draw on
|
||||
@param aRect the rectangle bounding the ellipse
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextStrokeEllipseInRect(aContext, aRect)
|
||||
{
|
||||
@@ -492,7 +562,6 @@ function CGContextStrokeEllipseInRect(aContext, aRect)
|
||||
Paints a line in the current path of the current context.
|
||||
@param aContext CGContext to draw on
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextStrokePath(aContext)
|
||||
{
|
||||
@@ -508,7 +577,6 @@ function CGContextStrokePath(aContext)
|
||||
the beginning of second line segment, etc.
|
||||
@param count the number of points in the array
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextStrokeLineSegments(aContext, points, count)
|
||||
{
|
||||
@@ -536,7 +604,6 @@ function CGContextStrokeLineSegments(aContext, points, count)
|
||||
@param aContext the CGContext
|
||||
@param aColor the new color for the fill
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
|
||||
function CGContextSetFillColor(aContext, aColor)
|
||||
@@ -550,7 +617,6 @@ function CGContextSetFillColor(aContext, aColor)
|
||||
@param aContext the CGContext
|
||||
@param aColor the new color for the stroke
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextSetStrokeColor(aContext, aColor)
|
||||
{
|
||||
@@ -568,7 +634,6 @@ function CGContextSetStrokeColor(aContext, aColor)
|
||||
@param sw set it to <code>YES</code> for a rounded southwest corner
|
||||
@param nw set it to <code>YES</code> for a rounded northwest corner
|
||||
@return void
|
||||
@group CGContext
|
||||
*/
|
||||
function CGContextFillRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, sw, nw)
|
||||
{
|
||||
@@ -576,6 +641,17 @@ function CGContextFillRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, s
|
||||
CGContextFillPath(aContext);
|
||||
}
|
||||
|
||||
/*!
|
||||
Strokes a rounded rectangle.
|
||||
@param aContext the CGContext to draw into
|
||||
@param aRect the base rectangle
|
||||
@param aRadius the distance from the rectange corner to the rounded corner
|
||||
@param ne set it to <code>YES</code> for a rounded northeast corner
|
||||
@param se set it to <code>YES</code> for a rounded southeast corner
|
||||
@param sw set it to <code>YES</code> for a rounded southwest corner
|
||||
@param nw set it to <code>YES</code> for a rounded northwest corner
|
||||
@return void
|
||||
*/
|
||||
function CGContextStrokeRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, sw, nw)
|
||||
{
|
||||
CGContextAddPath(aContext, CGPathWithRoundedRectangleInRect(aRect, aRadius, aRadius, ne, se, sw, nw));
|
||||
|
||||
@@ -36,11 +36,18 @@ kCGPathElementCloseSubpath = 4;
|
||||
kCGPathElementAddArc = 5;
|
||||
kCGPathElementAddArcToPoint = 6;
|
||||
|
||||
/*!
|
||||
Returns a new CGPath object.
|
||||
*/
|
||||
function CGPathCreateMutable()
|
||||
{
|
||||
return { count:0, start:NULL, current:NULL, elements:[] };
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a copy of the given path object.
|
||||
*/
|
||||
|
||||
function CGPathCreateMutableCopy(aPath)
|
||||
{
|
||||
var path = CGPathCreateMutable();
|
||||
@@ -50,6 +57,10 @@ function CGPathCreateMutableCopy(aPath)
|
||||
return path;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a copy of the given path object.
|
||||
*/
|
||||
|
||||
function CGPathCreateCopy(aPath)
|
||||
{
|
||||
return CGPathCreateMutableCopy(aPath);
|
||||
|
||||
Reference in new issue
Block a user