Metodi ID2D1RenderTarget::CreateCompatibleRenderTarget

Crea una nuova destinazione di rendering bitmap da usare durante il disegno intermedio fuori schermo compatibile con la destinazione di rendering corrente.

Elenco di overload

metodo Description
CreateCompatibleRenderTarget(D2D1_SIZE_F,D2D1_SIZE_U,D2D1_PIXEL_FORMAT,D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS,ID2D1BitmapRenderTarget**) Crea una destinazione di rendering bitmap da utilizzare durante il disegno intermedio fuori schermo compatibile con la destinazione di rendering corrente.
CreateCompatibleRenderTarget(D2D1_SIZE_F*,D2D1_SIZE_U*,D2D1_PIXEL_FORMAT*,D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS,ID2D1BitmapRenderTarget**) Crea una destinazione di rendering bitmap da utilizzare durante il disegno intermedio fuori schermo compatibile con la destinazione di rendering corrente.
CreateCompatibleRenderTarget(ID2D1BitmapRenderTarget**) Crea una nuova destinazione di rendering bitmap da usare durante il disegno intermedio fuori schermo compatibile con la destinazione di rendering corrente e ha le stesse dimensioni, DPI e formato pixel (ma non la modalità alfa) della destinazione di rendering corrente.
CreateCompatibleRenderTarget(D2D1_SIZE_F,ID2D1BitmapRenderTarget**) Crea una nuova destinazione di rendering bitmap da usare durante il disegno intermedio fuori schermo compatibile con la destinazione di rendering corrente e ha lo stesso formato pixel (ma non la modalità alfa) della destinazione di rendering corrente.
CreateCompatibleRenderTarget(D2D1_SIZE_F,D2D1_SIZE_U,ID2D1BitmapRenderTarget**) Crea una destinazione di rendering bitmap da usare durante il disegno intermedio fuori schermo compatibile con la destinazione di rendering corrente. La nuova destinazione di rendering bitmap ha lo stesso formato pixel (ma non la modalità alfa) della destinazione di rendering corrente.
CreateCompatibleRenderTarget(D2D1_SIZE_F,D2D1_SIZE_U,D2D1_PIXEL_FORMAT,ID2D1BitmapRenderTarget**) Crea una destinazione di rendering bitmap da utilizzare durante il disegno intermedio fuori schermo compatibile con la destinazione di rendering corrente.

Examples

Nell'esempio seguente viene usato il metodo CreateCompatibleRenderTarget per creare un OGGETTO ID2D1BitmapRenderTarget e usarlo per disegnare un motivo griglia. Il modello di griglia viene usato come origine di un ID2D1BitmapBrush.

HRESULT DemoApp::CreateGridPatternBrush(
    ID2D1RenderTarget *pRenderTarget,
    ID2D1BitmapBrush **ppBitmapBrush
    )
{
    // Create a compatible render target.
    ID2D1BitmapRenderTarget *pCompatibleRenderTarget = NULL;
    HRESULT hr = pRenderTarget->CreateCompatibleRenderTarget(
        D2D1::SizeF(10.0f, 10.0f),
        &pCompatibleRenderTarget
        );
    if (SUCCEEDED(hr))
    {
        // Draw a pattern.
        ID2D1SolidColorBrush *pGridBrush = NULL;
        hr = pCompatibleRenderTarget->CreateSolidColorBrush(
            D2D1::ColorF(D2D1::ColorF(0.93f, 0.94f, 0.96f, 1.0f)),
            &pGridBrush
            );
        if (SUCCEEDED(hr))
        {
            pCompatibleRenderTarget->BeginDraw();
            pCompatibleRenderTarget->FillRectangle(D2D1::RectF(0.0f, 0.0f, 10.0f, 1.0f), pGridBrush);
            pCompatibleRenderTarget->FillRectangle(D2D1::RectF(0.0f, 0.1f, 1.0f, 10.0f), pGridBrush);
            pCompatibleRenderTarget->EndDraw();

            // Retrieve the bitmap from the render target.
            ID2D1Bitmap *pGridBitmap = NULL;
            hr = pCompatibleRenderTarget->GetBitmap(&pGridBitmap);
            if (SUCCEEDED(hr))
            {
                // Choose the tiling mode for the bitmap brush.
                D2D1_BITMAP_BRUSH_PROPERTIES brushProperties =
                    D2D1::BitmapBrushProperties(D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_WRAP);

                // Create the bitmap brush.
                hr = m_pRenderTarget->CreateBitmapBrush(pGridBitmap, brushProperties, ppBitmapBrush);

                pGridBitmap->Release();
            }

            pGridBrush->Release();
        }

        pCompatibleRenderTarget->Release();
    }

    return hr;
}

Nell'esempio di codice seguente viene utilizzato il pennello per disegnare un motivo.

// Paint a grid background.
m_pRenderTarget->FillRectangle(
    D2D1::RectF(0.0f, 0.0f, renderTargetSize.width, renderTargetSize.height),
    m_pGridPatternBitmapBrush
    );

Il codice è stato omesso da questo esempio.

Requirements

Requisito Value
Intestazione
D2d1.h
Library
D2d1.lib
DLL
D2d1.dll

Vedere anche

ID2D1RenderTarget