本文整理汇总了C++中CComPtr::AddArc方法的典型用法代码示例。如果您正苦于以下问题:C++ CComPtr::AddArc方法的具体用法?C++ CComPtr::AddArc怎么用?C++ CComPtr::AddArc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComPtr
的用法示例。
在下文中一共展示了CComPtr::AddArc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegenerateGeometry
void CWedgeDrawer::RegenerateGeometry()
{
// Points on horizontal line:
// x^2 + y^2 = r^2 and y = m
// => x^2 = r^2 - m^2
D2D1_POINT_2F p0 = D2D1::Point2F(
(FLOAT)sqrt(mInnerRadius*mInnerRadius - mMarginThickness*mMarginThickness),
(FLOAT)mMarginThickness);
D2D1_POINT_2F p3 = D2D1::Point2F(
(FLOAT)sqrt(mOuterRadius*mOuterRadius - mMarginThickness*mMarginThickness),
(FLOAT)mMarginThickness);
D2D1::Matrix3x2F rotation = D2D1::Matrix3x2F::Rotation((FLOAT)mSweep);
D2D1_POINT_2F p1 = rotation.TransformPoint(
D2D1::Point2F((FLOAT)mInnerRadius, -(FLOAT)mMarginThickness));
D2D1_POINT_2F p2 = rotation.TransformPoint(
D2D1::Point2F((FLOAT)mOuterRadius, -(FLOAT)mMarginThickness));
// Points on other line:
// x^2 + y^2 = r^2 & y = mx + b
// => m^2+1!=0 (i.e. angles not equal to 90 degrees)
// x = (-sqrt(-b^2+m^2 r^2+r^2)-b m)/(m^2+1)
// y = (b-m sqrt(-b^2+m^2 r^2+r^2))/(m^2+1)
// Create the figure
mGeometry.Release();
mFactory->CreatePathGeometry(&mGeometry);
{
CComPtr<ID2D1GeometrySink> sink;
mGeometry->Open(&sink);
sink->BeginFigure(p0, D2D1_FIGURE_BEGIN_FILLED);
sink->AddArc(D2D1::ArcSegment(p1,
D2D1::SizeF((FLOAT)mInnerRadius, (FLOAT)mInnerRadius), 0,
D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));
sink->AddLine(p2);
sink->AddArc(D2D1::ArcSegment(p3,
D2D1::SizeF((FLOAT)mOuterRadius, (FLOAT)mOuterRadius), 0,
D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE, D2D1_ARC_SIZE_SMALL));
sink->EndFigure(D2D1_FIGURE_END_CLOSED);
sink->Close();
}
}