ID2D1Geometry::CombineWithGeometry methods
Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink.
Overload list
Method | Description |
---|---|
CombineWithGeometry(ID2D1Geometry*,D2D1_COMBINE_MODE,D2D1_MATRIX_3X2_F&,ID2D1SimplifiedGeometrySink*) | Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. |
CombineWithGeometry(ID2D1Geometry*,D2D1_COMBINE_MODE,D2D1_MATRIX_3X2_F*,ID2D1SimplifiedGeometrySink*) | Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. |
CombineWithGeometry(ID2D1Geometry*,D2D1_COMBINE_MODE,D2D1_MATRIX_3X2_F&,FLOAT,ID2D1SimplifiedGeometrySink*) | Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. |
CombineWithGeometry(ID2D1Geometry*,D2D1_COMBINE_MODE,D2D1_MATRIX_3X2_F*,FLOAT,ID2D1SimplifiedGeometrySink*) | Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. |
Examples
The following code uses each of the different combine modes to combine two ID2D1EllipseGeometry objects.
HRESULT DemoApp::CreateGeometryResources()
{
HRESULT hr = S_OK;
ID2D1GeometrySink *pGeometrySink = NULL;
// Create the first ellipse geometry to merge.
const D2D1_ELLIPSE circle1 = D2D1::Ellipse(
D2D1::Point2F(75.0f, 75.0f),
50.0f,
50.0f
);
hr = m_pD2DFactory->CreateEllipseGeometry(
circle1,
&m_pCircleGeometry1
);
if (SUCCEEDED(hr))
{
// Create the second ellipse geometry to merge.
const D2D1_ELLIPSE circle2 = D2D1::Ellipse(
D2D1::Point2F(125.0f, 75.0f),
50.0f,
50.0f
);
hr = m_pD2DFactory->CreateEllipseGeometry(circle2, &m_pCircleGeometry2);
}
if (SUCCEEDED(hr))
{
//
// Use D2D1_COMBINE_MODE_UNION to combine the geometries.
//
hr = m_pD2DFactory->CreatePathGeometry(&m_pPathGeometryUnion);
if (SUCCEEDED(hr))
{
hr = m_pPathGeometryUnion->Open(&pGeometrySink);
if (SUCCEEDED(hr))
{
hr = m_pCircleGeometry1->CombineWithGeometry(
m_pCircleGeometry2,
D2D1_COMBINE_MODE_UNION,
NULL,
NULL,
pGeometrySink
);
}
if (SUCCEEDED(hr))
{
hr = pGeometrySink->Close();
}
SafeRelease(&pGeometrySink);
}
}
if (SUCCEEDED(hr))
{
//
// Use D2D1_COMBINE_MODE_INTERSECT to combine the geometries.
//
hr = m_pD2DFactory->CreatePathGeometry(&m_pPathGeometryIntersect);
if (SUCCEEDED(hr))
{
hr = m_pPathGeometryIntersect->Open(&pGeometrySink);
if (SUCCEEDED(hr))
{
hr = m_pCircleGeometry1->CombineWithGeometry(
m_pCircleGeometry2,
D2D1_COMBINE_MODE_INTERSECT,
NULL,
NULL,
pGeometrySink
);
}
if (SUCCEEDED(hr))
{
hr = pGeometrySink->Close();
}
SafeRelease(&pGeometrySink);
}
}
if (SUCCEEDED(hr))
{
//
// Use D2D1_COMBINE_MODE_XOR to combine the geometries.
//
hr = m_pD2DFactory->CreatePathGeometry(&m_pPathGeometryXOR);
if (SUCCEEDED(hr))
{
hr = m_pPathGeometryXOR->Open(&pGeometrySink);
if (SUCCEEDED(hr))
{
hr = m_pCircleGeometry1->CombineWithGeometry(
m_pCircleGeometry2,
D2D1_COMBINE_MODE_XOR,
NULL,
NULL,
pGeometrySink
);
}
if (SUCCEEDED(hr))
{
hr = pGeometrySink->Close();
}
SafeRelease(&pGeometrySink);
}
}
if (SUCCEEDED(hr))
{
//
// Use D2D1_COMBINE_MODE_EXCLUDE to combine the geometries.
//
hr = m_pD2DFactory->CreatePathGeometry(&m_pPathGeometryExclude);
if (SUCCEEDED(hr))
{
hr = m_pPathGeometryExclude->Open(&pGeometrySink);
if (SUCCEEDED(hr))
{
hr = m_pCircleGeometry1->CombineWithGeometry(
m_pCircleGeometry2,
D2D1_COMBINE_MODE_EXCLUDE,
NULL,
NULL,
pGeometrySink
);
}
if (SUCCEEDED(hr))
{
hr = pGeometrySink->Close();
}
SafeRelease(&pGeometrySink);
}
}
return hr;
}
This code produces the output shown in the following illustration.
Requirements
Requirement | Value |
---|---|
Library |
|
DLL |
|