本文整理汇总了C++中gdiplus::GraphicsPath::AddEllipse方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsPath::AddEllipse方法的具体用法?C++ GraphicsPath::AddEllipse怎么用?C++ GraphicsPath::AddEllipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdiplus::GraphicsPath
的用法示例。
在下文中一共展示了GraphicsPath::AddEllipse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillRadialGradient
//-----------------------------------------------------------------------------
void GdiplusDrawContext::fillRadialGradient (CGraphicsPath* _path, const CGradient& gradient, const CPoint& center, CCoord radius, const CPoint& originOffset, bool evenOdd, CGraphicsTransform* t)
{
#if DEBUG
DebugPrint ("WARNING: GdiplusDrawContext::fillRadialGradient is not working as expected ! FIXME\n");
#endif
GdiplusGraphicsPath* gdiPlusPath = dynamic_cast<GdiplusGraphicsPath*> (_path);
if (gdiPlusPath && pGraphics)
{
GdiplusDrawScope drawScope (pGraphics, currentState.clipRect, getCurrentTransform ());
Gdiplus::GraphicsPath* path = gdiPlusPath->getGraphicsPath ();
if (t)
{
Gdiplus::Matrix matrix;
convert (matrix, *t);
path = path->Clone ();
path->Transform (&matrix);
}
path->SetFillMode (evenOdd ? Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding);
Gdiplus::PointF c1p ((Gdiplus::REAL)(center.x + originOffset.x), (Gdiplus::REAL)(center.y + originOffset.y));
CRect boundingBox = gdiPlusPath->getBoundingBox ();
Gdiplus::GraphicsPath brushPath;
brushPath.AddEllipse ((Gdiplus::REAL)boundingBox.left, (Gdiplus::REAL)boundingBox.top, (Gdiplus::REAL)boundingBox.getWidth (), (Gdiplus::REAL)boundingBox.getHeight ());
Gdiplus::Matrix graphicsMatrix;
pGraphics->GetTransform (&graphicsMatrix);
brushPath.Transform (&graphicsMatrix);
Gdiplus::PathGradientBrush brush (&brushPath);
// set center
brush.SetCenterPoint (c1p);
// set the colors
Gdiplus::Color* colors = new Gdiplus::Color [gradient.getColorStops ().size ()];
Gdiplus::REAL* positions = new Gdiplus::REAL [gradient.getColorStops ().size ()];
uint32_t index = 0;
for (CGradient::ColorStopMap::const_iterator it = gradient.getColorStops ().begin (); it != gradient.getColorStops ().end (); ++it, ++index)
{
CColor color = it->second;
color.alpha = (int8_t)((float)color.alpha * currentState.globalAlpha);
colors[index] = createGdiPlusColor (color);
positions[index] = (Gdiplus::REAL)it->first;
}
brush.SetCenterColor (colors[0]);
INT count = static_cast<INT> (gradient.getColorStops ().size ()) - 1;
brush.SetSurroundColors (colors+1, &count);
pGraphics->FillPath (&brush, path);
if (path != gdiPlusPath->getGraphicsPath ())
delete path;
delete [] colors;
delete [] positions;
}
}
示例2: AddEllipse
void GraphicsPath::AddEllipse(const RectF& rc) {
Gdiplus::GraphicsPath* gp = reinterpret_cast<Gdiplus::GraphicsPath*>(_private);
gp->AddEllipse(ToGDIRect<RectF, Gdiplus::RectF>(rc));
}
示例3: Draw
void CControlArrowStyleSelector::Draw(CDC* pDC)
{
CRect rc(m_rcControl);
int nCount = sizeof(arrowStyles) / sizeof(arrowStyles[0]);
for (int i = 0; i < nCount; i++)
{
CRect rcButton = GetRect(i);
if (i == m_nSelected || arrowStyles[i].iArrowStyle == m_iArrowStyle)
{
BOOL bPressed = GetPressed() && i == m_nSelected;
//GetPaintManager()->DrawControlEntry(pDC, &rcButton, m_bEnabled, i == m_nSelected, bPressed, arrowStyles[i].iArrowStyle == m_iArrowStyle, FALSE, GetParent()->GetPosition());
GetPaintManager()->DrawRectangle(pDC, &rcButton, i == m_nSelected, bPressed, m_bEnabled, arrowStyles[i].iArrowStyle == m_iArrowStyle, FALSE, GetParent()->GetType(), GetParent()->GetPosition());
}
Gdiplus::Graphics gdipGraphics(pDC->m_hDC);
Gdiplus::Pen pen(Gdiplus::Color(255, 0, 0, 0), 1);
Gdiplus::SolidBrush brush(Gdiplus::Color(255, 0, 0, 0));
/* if (arrowStyles[i].iArrowStyle == msoLineRoundDot)
pen.SetDashCap(Gdiplus::DashCapTriangle);
else
pen.SetDashCap(Gdiplus::DashCapFlat);
pen.SetDashPattern(arrowStyles[i].dashValues, arrowStyles[i].iDashValueCount);
pen.SetDashStyle(Gdiplus::DashStyleCustom);*/
// Gdiplus::Point points[3] = {Gdiplus::Point(0, 0), Gdiplus::Point(0, 0), Gdiplus::Point(0, 0)};
Gdiplus::GraphicsPath startCapPath;
Gdiplus::GraphicsPath endCapPath;
// Create a CustomLineCap object with capPath as the stroke path.
int yPos = rcButton.top + XTP_AS_SELECTOR_HEIGHT / 2;
switch(arrowStyles[i].startCap)
{
case Gdiplus::LineCapArrowAnchor:
{
Gdiplus::AdjustableArrowCap capStart(9, 9, false);
pen.SetCustomStartCap(&capStart);
break;
}
case Gdiplus::LineCapTriangle:
{
Gdiplus::AdjustableArrowCap capStart(6, 5, true);
pen.SetCustomStartCap(&capStart);
break;
}
case Gdiplus::LineCapDiamondAnchor:
{
Gdiplus::Point points[4] = {Gdiplus::Point(rcButton.left , yPos ), Gdiplus::Point(rcButton.left + 5, yPos + 5), Gdiplus::Point(rcButton.left + 10, yPos), Gdiplus::Point(rcButton.left + 5, yPos - 5)};
startCapPath.AddPolygon(points, 4);
break;
}
case Gdiplus::LineCapRoundAnchor:
{
Gdiplus::Rect rect(rcButton.left, yPos - 5, 10, 10);
startCapPath.AddEllipse(rect);
break;
}
default:
break;
}
switch(arrowStyles[i].endCap)
{
case Gdiplus::LineCapArrowAnchor:
{
Gdiplus::AdjustableArrowCap capEnd(9, 9, false);
pen.SetCustomEndCap(&capEnd);
break;
}
case Gdiplus::LineCapTriangle:
{
Gdiplus::AdjustableArrowCap capEnd(6, 5, true);
pen.SetCustomEndCap(&capEnd);
break;
}
case Gdiplus::LineCapDiamondAnchor:
{
Gdiplus::Point points[4] = {Gdiplus::Point(rcButton.right - 10 , yPos ), Gdiplus::Point(rcButton.right - 5, yPos + 5), Gdiplus::Point(rcButton.right, yPos), Gdiplus::Point(rcButton.right - 5, yPos - 5)};
endCapPath.AddPolygon(points, 4);
break;
}
case Gdiplus::LineCapRoundAnchor:
{
Gdiplus::Rect rect(rcButton.right - 10, yPos - 5, 10, 10);
endCapPath.AddEllipse(rect);
break;
}
default:
break;
}
//.........这里部分代码省略.........