Metodi ID2D1Factory::CreateTransformedGeometry

Trasforma la geometria specificata e archivia il risultato come oggetto ID2D1TransformedGeometry.

Elenco di overload

metodo Descrizione
CreateTransformedGeometry(ID2D1Geometry*,D2D_MATRIX_3X2_F*,ID2D1TransformedGeometry**) Trasforma la geometria specificata e archivia il risultato come oggetto ID2D1TransformedGeometry.
CreateTransformedGeometry(ID2D1Geometry*,D2D_MATRIX_3X2_F&,ID2D1TransformedGeometry**) Trasforma la geometria specificata e archivia il risultato come oggetto ID2D1TransformedGeometry.

Osservazioni:

Analogamente ad altre risorse, una geometria trasformata eredita lo spazio delle risorse e i criteri di threading della factory che l'ha creata. Questo oggetto non è modificabile.

Quando si crea uno strozzamento di una geometria trasformata con il metodo DrawGeometry , la larghezza del tratto non viene influenzata dalla trasformazione applicata alla geometria. La larghezza del tratto è influenzata solo dalla trasformazione globale.

Esempi

Nell'esempio seguente viene creato un OGGETTO ID2D1RectangleGeometry, quindi viene disegnato senza trasformarlo. Produce l'output illustrato nella figura seguente.

illustration of a rectangle

hr = m_pD2DFactory->CreateRectangleGeometry(
    D2D1::RectF(150.f, 150.f, 200.f, 200.f),
    &m_pRectangleGeometry
    );

Nell'esempio seguente viene utilizzata la destinazione di rendering per ridimensionare la geometria di un fattore pari a 3, quindi la disegna. La figura seguente mostra il risultato del disegno del rettangolo senza la trasformazione e con la trasformazione; nota che il tratto è più spesso dopo la trasformazione, anche se lo spessore del tratto è 1.

illustration of a smaller rectangle inside a larger rectangle with a thicker stroke

// Transform the render target, then draw the rectangle geometry again.
m_pRenderTarget->SetTransform(
    D2D1::Matrix3x2F::Scale(
        D2D1::SizeF(3.f, 3.f),
        D2D1::Point2F(175.f, 175.f))
    );

m_pRenderTarget->DrawGeometry(m_pRectangleGeometry, m_pBlackBrush, 1);

Nell'esempio seguente viene usato il metodo CreateTransformedGeometry per ridimensionare la geometria in base a un fattore pari a 3, quindi lo disegna. Produce l'output illustrato nella figura seguente. Si noti che, anche se il rettangolo è più grande, il tratto non è aumentato.

illustration of a smaller rectangle inside a larger rectangle with the same stroke

 // Create a geometry that is a scaled version
 // of m_pRectangleGeometry.
 // The new geometry is scaled by a factory of 3
 // from the center of the geometry, (35, 35).

 hr = m_pD2DFactory->CreateTransformedGeometry(
     m_pRectangleGeometry,
     D2D1::Matrix3x2F::Scale(
         D2D1::SizeF(3.f, 3.f),
         D2D1::Point2F(175.f, 175.f)),
     &m_pTransformedGeometry
     );


// Replace the previous render target transform.
m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Identity());

// Draw the transformed geometry.
m_pRenderTarget->DrawGeometry(m_pTransformedGeometry, m_pBlackBrush, 1);

Requisiti

Requisito Valore
Intestazione
D2d1.h
Libreria
D2d1.lib
DLL
D2d1.dll

Vedi anche

ID2D1Factory