当前位置: 首页>>代码示例>>C++>>正文


C++ GraphicsPath::AddArc方法代码示例

本文整理汇总了C++中gdiplus::GraphicsPath::AddArc方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsPath::AddArc方法的具体用法?C++ GraphicsPath::AddArc怎么用?C++ GraphicsPath::AddArc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gdiplus::GraphicsPath的用法示例。


在下文中一共展示了GraphicsPath::AddArc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FillRoundRectangle

void Graphics::FillRoundRectangle(Brush* brush, const RectF& rc, float d) {
    Gdiplus::Graphics* g = reinterpret_cast<Gdiplus::Graphics*>(_private);
    Gdiplus::Brush* gdiBrush = reinterpret_cast<Gdiplus::Brush*>(brush->_private);

    Gdiplus::GraphicsPath gp;
    Gdiplus::RectF r(rc.GetLeft()-1.0f, rc.GetTop()-1.0f, rc.GetWidth(), rc.GetHeight());

    gp.AddArc(r.X, r.Y, d, d, 180.0f, 90.0f);
    gp.AddArc(r.X + r.Width - d, r.Y, d, d, 270.0f, 90.0f);
    gp.AddArc(r.X + r.Width - d, r.Y + r.Height - d, d, d, 0.0f, 90.0f);
    gp.AddArc(r.X, r.Y + r.Height - d, d, d, 90.0f, 90.0f);
    gp.AddLine(r.X, r.Y + r.Height - d, r.X, r.Y + d / 2.0f);

    g->FillPath(gdiBrush, &gp);
}
开发者ID:pixelspark,项目名称:corespark,代码行数:15,代码来源:tjgraphics-gdiplus.cpp

示例2: DrawRoundRectangle

void Graphics::DrawRoundRectangle(Pen* pen, const RectF& rc, float d) {
    Gdiplus::Graphics* g = reinterpret_cast<Gdiplus::Graphics*>(_private);
    Gdiplus::Pen* gdiPen = reinterpret_cast<Gdiplus::Pen*>(pen->_private);

    Gdiplus::GraphicsPath gp;
    Gdiplus::RectF r(rc.GetLeft()-1.0f, rc.GetTop()-1.0f, rc.GetWidth(), rc.GetHeight());

    gp.AddArc(r.X, r.Y, d, d, 180.0f, 90.0f);
    gp.AddArc(r.X + r.Width - d, r.Y, d, d, 270.0f, 90.0f);
    gp.AddArc(r.X + r.Width - d, r.Y + r.Height - d, d, d, 0.0f, 90.0f);
    gp.AddArc(r.X, r.Y + r.Height - d, d, d, 90.0f, 90.0f);
    gp.AddLine(r.X, r.Y + r.Height - d, r.X, r.Y + d / 2.0f);

    g->DrawPath(gdiPen, &gp);
}
开发者ID:pixelspark,项目名称:corespark,代码行数:15,代码来源:tjgraphics-gdiplus.cpp

示例3: drawArc

//-----------------------------------------------------------------------------
void GdiplusDrawContext::drawArc (const CRect& rect, const float _startAngle, const float _endAngle, const CDrawStyle drawStyle)
{
	if (pGraphics)
	{
		GdiplusDrawScope drawScope (pGraphics, currentState.clipRect, getCurrentTransform ());

		float endAngle = _endAngle;
		if (endAngle < _startAngle)
			endAngle += 360.f;
		endAngle = fabs (endAngle - _startAngle);
		Gdiplus::RectF r ((Gdiplus::REAL)rect.left, (Gdiplus::REAL)rect.top, (Gdiplus::REAL)rect.getWidth (), (Gdiplus::REAL)rect.getHeight ());
		Gdiplus::GraphicsPath path;
		path.AddArc (r, _startAngle, endAngle);
		if (drawStyle == kDrawFilled || drawStyle == kDrawFilledAndStroked)
			pGraphics->FillPath (pBrush, &path);
		if (drawStyle == kDrawStroked || drawStyle == kDrawFilledAndStroked)
			pGraphics->DrawPath (pPen, &path);
	}
}
开发者ID:Piticfericit,项目名称:vstgui,代码行数:20,代码来源:gdiplusdrawcontext.cpp

示例4: GetRoundRectGraphicsPath

BOOL GdiplusUtilities::GetRoundRectGraphicsPath(Gdiplus::GraphicsPath& p, 
			int x, int y, int width, int height, int radius, RectangleCorners corners)
{
	int xw = x + width;
	int yh = y + height;
	int xwr = xw - radius;
	int yhr = yh - radius;
	int xr = x + radius;
	int yr = y + radius;
	int r2 = radius * 2;
	int xwr2 = xw - r2;
	int yhr2 = yh - r2;

	p.StartFigure();

	//Top Left Corner
	if ((TopLeft & corners)	== TopLeft)
	{
		p.AddArc(x, y, r2, r2, 180, 90);
	}
	else
	{
		p.AddLine(x, yr, x, y);
		p.AddLine(x, y, xr, y);
	}

	//Top Edge
	p.AddLine(xr, y, xwr, y);

	//Top Right Corner
	if ((TopRight & corners)
		== TopRight)
	{
		p.AddArc(xwr2, y, r2, r2, 270, 90);
	}
	else
	{
		p.AddLine(xwr, y, xw, y);
		p.AddLine(xw, y, xw, yr);
	}

	//Right Edge
	p.AddLine(xw, yr, xw, yhr);

	//Bottom Right Corner
	if ((BottomRight & corners)
		== BottomRight)
	{
		p.AddArc(xwr2, yhr2, r2, r2, 0, 90);
	}
	else
	{
		p.AddLine(xw, yhr, xw, yh);
		p.AddLine(xw, yh, xwr, yh);
	}

	//Bottom Edge
	p.AddLine(xwr, yh, xr, yh);

	//Bottom Left Corner
	if ((BottomLeft & corners)
		== BottomLeft)
	{
		p.AddArc(x, yhr2, r2, r2, 90, 90);
	}
	else
	{
		p.AddLine(xr, yh, x, yh);
		p.AddLine(x, yh, x, yhr);
	}

	//Left Edge
	p.AddLine(x, yhr, x, yr);

	p.CloseFigure();
	return TRUE;
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:77,代码来源:GdiplusUtilities.cpp


注:本文中的gdiplus::GraphicsPath::AddArc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。