Example #1
0
/*
frameOval : Draws an outline of an oval just inside the bounding rectangle that you specify.

Parameter Descriptions
context : The CG context to render to.
r :  The CG rectangle that defines the ovalÕs boundary.
*/
void frameOval(CGContextRef context, CGRect r)
{
	// Add a path for the oval to this context
	addOvalToPath(context,r);

	// Stroke the path
	CGContextStrokePath(context);
}
Example #2
0
void paintOval(CGContextRef context, CGRect r)
{
	// Add a path for the oval to this context
	addOvalToPath(context,r);

	// Fill the oval
    CGContextFillPath(context);
}
Example #3
0
//-----------------------------------------------------------------------------
void CGDrawContext::drawArc (const CRect &rect, const float _startAngle, const float _endAngle, const CDrawStyle drawStyle) // in degree
{
	CGContextRef context = beginCGContext (true, currentState.drawMode.integralMode ());
	if (context)
	{
		CGPathDrawingMode m;
		switch (drawStyle)
		{
			case kDrawFilled : m = kCGPathFill; break;
			case kDrawFilledAndStroked : m = kCGPathFillStroke; break;
			default : m = kCGPathStroke; break;
		}
		applyLineStyle (context);

		CGContextBeginPath (context);
		addOvalToPath (context, CPoint (rect.left + rect.width () / 2, rect.top + rect.height () / 2), rect.width () / 2, rect.height () / 2, -_startAngle, -_endAngle);
		if (drawStyle == kDrawFilled || kDrawFilledAndStroked)
			CGContextAddLineToPoint (context, rect.left + rect.width () / 2, rect.top + rect.height () / 2);
		CGContextDrawPath (context, m);
		releaseCGContext (context);
	}
}