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


C++ ComPtr::CopyTo方法代码示例

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


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

示例1: Shape

RoundedRectangle::RoundedRectangle(FLOAT x, FLOAT y, FLOAT width, FLOAT height,
	FLOAT xRadius, FLOAT yRadius) : Shape(ShapeType::RoundedRectangle),
		m_X(x),
		m_Y(y),
		m_Width(width + x),
		m_Height(height + y),
		m_XRadius(xRadius),
		m_YRadius(yRadius)
{
	HRESULT hr = E_FAIL;
	const D2D1_ROUNDED_RECT rect = { m_X, m_Y, m_Width, m_Height, m_XRadius, m_YRadius };

	Microsoft::WRL::ComPtr<ID2D1RoundedRectangleGeometry> rectangle;
	hr = Canvas::c_D2DFactory->CreateRoundedRectangleGeometry(rect, rectangle.GetAddressOf());
	if (FAILED(hr))
	{
		LogErrorF(
			L"Could not create rounded rectangle object. X=%i, Y=%i, W=%i, H=%i, XRadius=%i, YRadius=%i",
			(int)m_X, (int)m_Y, (int)m_Width, (int)m_Height, (int)m_XRadius, (int)m_YRadius);
		return;
	}

	hr = rectangle.CopyTo(m_Shape.GetAddressOf());
	if (FAILED(hr)) LogErrorF(
		L"Could not copy rounded rectangle object to shape object. X=%i, Y=%i, W=%i, H=%i, XRadius=%i, YRadius=%i",
		(int)m_X, (int)m_Y, (int)m_Width, (int)m_Height, (int)m_XRadius, (int)m_YRadius);
}
开发者ID:NighthawkSLO,项目名称:rainmeter,代码行数:27,代码来源:RoundedRectangle.cpp

示例2: 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);
}
开发者ID:NighthawkSLO,项目名称:rainmeter,代码行数:32,代码来源:Arc.cpp

示例3: SetVideoDisplayControl

void EvrPanel::SetVideoDisplayControl(::Microsoft::WRL::ComPtr<IMFVideoDisplayControl> videoDisplayControl)
{
	videoDisplayControl.CopyTo(&videoDisplayControl_);
	if (videoDisplayControl_)
	{
		videoDisplayControl_->SetVideoWindow(hwnd());

		auto& scale_factor = root().scale_factor();
		MFVideoNormalizedRect mvnr = { 0, 0, 1, 1 };
		RECT rect = { 0, 0, 0, 0 };
		GetWindowRect(hwnd(), &rect);
		rect.top = 0;
		rect.left = 0;
		videoDisplayControl_->SetVideoPosition(&mvnr, &rect);
	}
}
开发者ID:mntone,项目名称:Monotor,代码行数:16,代码来源:EvrPanel.cpp

示例4: Shape

Ellipse::Ellipse(FLOAT x, FLOAT y, FLOAT xRadius, FLOAT yRadius) : Shape(ShapeType::Ellipse),
	m_CenterPoint(D2D1::Point2F(x, y)),
	m_RadiusX(xRadius),
	m_RadiusY(yRadius)
{
	HRESULT hr = E_FAIL;
	const D2D1_ELLIPSE ellipse = D2D1::Ellipse(m_CenterPoint, m_RadiusX, m_RadiusY);

	Microsoft::WRL::ComPtr<ID2D1EllipseGeometry> geometry;
	hr = Canvas::c_D2DFactory->CreateEllipseGeometry(ellipse, geometry.GetAddressOf());
	if (FAILED(hr))
	{
		LogErrorF(
			L"Could not create ellipse object. X=%i, Y=%i, RadiusX=%i, RadiusY=%i",
			(int)x, (int)y, (int)xRadius, (int)yRadius);
		return;
	}

	hr = geometry.CopyTo(m_Shape.GetAddressOf());
	if (FAILED(hr)) LogErrorF(
		L"Could not copy ellipse object to shape object. X=%i, Y=%i, RadiusX=%i, RadiusY=%i",
		(int)x, (int)y, (int)xRadius, (int)yRadius);
}
开发者ID:NighthawkSLO,项目名称:rainmeter,代码行数:23,代码来源:Ellipse.cpp


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