예제 #1
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);
        }
    }
}
예제 #2
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);
	}
}