コード例 #1
0
//-----------------------------------------------------------------------------
void D2DDrawContext::drawArc (const CRect& _rect, const float _startAngle, const float _endAngle, const CDrawStyle drawStyle)
{
    CGraphicsPath* path = createGraphicsPath ();
    if (path)
    {
        path->addArc (_rect, _startAngle, _endAngle, false);
        if (drawStyle == kDrawFilled || drawStyle == kDrawFilledAndStroked)
            drawGraphicsPath (path, kPathFilled);
        if (drawStyle == kDrawStroked || drawStyle == kDrawFilledAndStroked)
            drawGraphicsPath (path, kPathStroked);
        path->forget ();
    }
}
コード例 #2
0
//-----------------------------------------------------------------------------
void D2DDrawContext::drawPolygon (const CPoint *pPoints, int32_t numberOfPoints, const CDrawStyle drawStyle)
{
    if (renderTarget)
    {
        D2DApplyClip clip (this);
        D2DGraphicsPath path;
        path.beginSubpath (pPoints[0]);
        path.addLine (pPoints[1]);
        for (int32_t i = 2; i < numberOfPoints; i++)
        {
            path.addLine (pPoints[i]);
        }
        if (drawStyle == kDrawFilled || drawStyle == kDrawFilledAndStroked)
        {
            drawGraphicsPath (&path, kPathFilled);
        }
        if (drawStyle == kDrawStroked || drawStyle == kDrawFilledAndStroked)
        {
            drawGraphicsPath (&path, kPathStroked);
        }
    }
}
コード例 #3
0
//-----------------------------------------------------------------------------
void D2DDrawContext::drawPolygon (const PointList& polygonPointList, const CDrawStyle drawStyle)
{
	if (renderTarget == 0 || polygonPointList.size () == 0)
		return;
	D2DApplyClip ac (this);
	if (ac.isEmpty ())
		return;

	D2DGraphicsPath path;
	path.beginSubpath (polygonPointList[0]);
	for (uint32_t i = 1; i < polygonPointList.size (); ++i)
	{
		path.addLine (polygonPointList[i]);
	}
	if (drawStyle == kDrawFilled || drawStyle == kDrawFilledAndStroked)
	{
		drawGraphicsPath (&path, kPathFilled);
	}
	if (drawStyle == kDrawStroked || drawStyle == kDrawFilledAndStroked)
	{
		drawGraphicsPath (&path, kPathStroked);
	}
}