ID2D1RenderTarget::CreateGradientStopCollection-Methoden

Erstellt eine ID2D1GradientStopCollection aus dem angegebenen Array von D2D1_GRADIENT_STOP-Strukturen .

Überladeliste

Methode Beschreibung
CreateGradientStopCollection(D2D1_GRADIENT_STOP*,D2D1_GAMMA,D2D1_EXTEND_MODE,ID2D1GradientStopCollection**) Erstellt eine ID2D1GradientStopCollection aus den angegebenen Farbverlaufsstopps, Farbinterpolations-Gamma und Erweiterungsmodus.
CreateGradientStopCollection(D2D1_GRADIENT_STOP*,ID2D1GradientStopCollection**) Erstellt eine ID2D1GradientStopCollection aus den angegebenen Farbverlaufsstopps, die die D2D1_GAMMA_2_2 Farbinterpolations-Gamma und den Clamp-Erweiterungsmodus verwendet.

Beispiele

Im folgenden Beispiel wird ein Array von Farbverlaufsstopps erstellt und dann verwendet, um eine ID2D1GradientStopCollection zu erstellen.

// Create an array of gradient stops to put in the gradient stop
// collection that will be used in the gradient brush.
ID2D1GradientStopCollection *pGradientStops = NULL;

D2D1_GRADIENT_STOP gradientStops[2];
gradientStops[0].color = D2D1::ColorF(D2D1::ColorF::Yellow, 1);
gradientStops[0].position = 0.0f;
gradientStops[1].color = D2D1::ColorF(D2D1::ColorF::ForestGreen, 1);
gradientStops[1].position = 1.0f;
// Create the ID2D1GradientStopCollection from a previously
// declared array of D2D1_GRADIENT_STOP structs.
hr = m_pRenderTarget->CreateGradientStopCollection(
    gradientStops,
    2,
    D2D1_GAMMA_2_2,
    D2D1_EXTEND_MODE_CLAMP,
    &pGradientStops
    );

Im nächsten Codebeispiel wird die ID2D1GradientStopCollection verwendet, um einen ID2D1LinearGradientBrush zu erstellen.

// The line that determines the direction of the gradient starts at
// the upper-left corner of the square and ends at the lower-right corner.

if (SUCCEEDED(hr))
{
    hr = m_pRenderTarget->CreateLinearGradientBrush(
        D2D1::LinearGradientBrushProperties(
            D2D1::Point2F(0, 0),
            D2D1::Point2F(150, 150)),
        pGradientStops,
        &m_pLinearGradientBrush
        );
}

Anforderungen

Anforderung Wert
Header
D2d1_1.h (einschließlich D2d1.h)
Bibliothek
D2d1.lib
DLL
D2d1.dll

Siehe auch

ID2D1RenderTarget

D2D1_GRADIENT_STOP

Erstellen eines linearen Farbverlaufspinsels

Erstellen eines radialen Farbverlaufspinsels

Übersicht über Pinsel