本文整理汇总了C++中microsoft::wrl::ComPtr::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ ComPtr::Open方法的具体用法?C++ ComPtr::Open怎么用?C++ ComPtr::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类microsoft::wrl::ComPtr
的用法示例。
在下文中一共展示了ComPtr::Open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Shape
Arc::Arc(FLOAT x1, FLOAT y1, FLOAT x2, FLOAT y2, FLOAT xRadius, FLOAT yRadius, FLOAT angle,
D2D1_SWEEP_DIRECTION sweep, D2D1_ARC_SIZE size, D2D1_FIGURE_END ending) : Shape(ShapeType::Arc),
m_StartPoint(D2D1::Point2F(x1, y1)),
m_ArcSegment(D2D1::ArcSegment(
D2D1::Point2F(x2, y2),
D2D1::SizeF(xRadius, yRadius),
angle,
sweep,
size)),
m_ShapeEnding(ending)
{
Microsoft::WRL::ComPtr<ID2D1GeometrySink> sink;
Microsoft::WRL::ComPtr<ID2D1PathGeometry> path;
HRESULT hr = Canvas::c_D2DFactory->CreatePathGeometry(path.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = path->Open(sink.GetAddressOf());
if (SUCCEEDED(hr))
{
sink->BeginFigure(m_StartPoint, D2D1_FIGURE_BEGIN_FILLED);
sink->AddArc(m_ArcSegment);
sink->EndFigure(m_ShapeEnding);
sink->Close();
hr = path.CopyTo(m_Shape.GetAddressOf());
if (SUCCEEDED(hr)) return;
}
}
LogErrorF(L"Could not create arc object. X1=%i, Y1=%i, X2=%i, Y2=%i, XRadius=%i, YRadius=%i, Angle=%i",
(int)x1, (int)y1, (int)x2, (int)y2, (int)xRadius, (int)yRadius, (int)angle);
}
示例2: DrawGlyphRun
IFACEMETHODIMP CustomTextRenderer::DrawGlyphRun(
_In_opt_ void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
DWRITE_MEASURING_MODE measuringMode,
_In_ DWRITE_GLYPH_RUN const* glyphRun,
_In_ DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
IUnknown* clientDrawingEffect
)
{
HRESULT hr = S_OK;
// Create the path geometry.
Microsoft::WRL::ComPtr<ID2D1PathGeometry> pathGeometry;
hr = D2DFactory->CreatePathGeometry(&pathGeometry);
// Write to the path geometry using the geometry sink.
Microsoft::WRL::ComPtr<ID2D1GeometrySink> sink;
if (SUCCEEDED(hr))
{
hr = pathGeometry->Open(&sink);
}
// Get the glyph run outline geometries back from DirectWrite and place them within the
// geometry sink.
if (SUCCEEDED(hr))
{
hr = glyphRun->fontFace->GetGlyphRunOutline(
glyphRun->fontEmSize,
glyphRun->glyphIndices,
glyphRun->glyphAdvances,
glyphRun->glyphOffsets,
glyphRun->glyphCount,
glyphRun->isSideways,
glyphRun->bidiLevel%2,
sink.Get()
);
}
// Close the geometry sink
if (SUCCEEDED(hr))
{
hr = sink.Get()->Close();
}
/*Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> shadowBrush;
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> shadowOutlineBrush;
if(SUCCEEDED(hr))
{
hr = D2DDeviceContext->CreateSolidColorBrush(
D2D1::ColorF(0.0,0.0,0.0,0.6),
&shadowBrush
);
}
if(SUCCEEDED(hr))
{
hr = D2DDeviceContext->CreateSolidColorBrush(
D2D1::ColorF(0.0,0.0,0.0,0.6),
&shadowOutlineBrush
);
}
D2D1_RECT_F bounds;
pathGeometry->GetBounds(&D2D1::Matrix3x2F::Identity(),&bounds);*/
// Initialize a matrix to translate the origin of the glyph run.
D2D1::Matrix3x2F const matrix = D2D1::Matrix3x2F(
1.0f, 0.0f,
0.0f, 1.0f,
baselineOriginX, baselineOriginY
);
/*D2D1::Matrix3x2F const shadowMatrix = D2D1::Matrix3x2F(
1.0f, 0.0f,
0.0f, 1.0f,
-bounds.left, -bounds.top
);
*/
// Create the transformed geometry
Microsoft::WRL::ComPtr<ID2D1TransformedGeometry> transformedGeometry;
if (SUCCEEDED(hr))
{
hr = D2DFactory.Get()->CreateTransformedGeometry(
pathGeometry.Get(),
&matrix,
&transformedGeometry
);
}
// Draw the outline of the glyph run
D2DDeviceContext->DrawGeometry(
transformedGeometry.Get(),
outlineBrush.Get(),
2.0
);
// Fill in the glyph run
D2DDeviceContext->FillGeometry(
transformedGeometry.Get(),
fillBrush.Get()
//.........这里部分代码省略.........