Share via


Interface ID2D1GradientStopCollection (d2d1.h)

Représente une collection d’objets D2D1_GRADIENT_STOP pour les pinceaux de dégradé linéaire et radial.

Héritage

L’interface ID2D1GradientStopCollection hérite de ID2D1Resource. ID2D1GradientStopCollection a également les types de membres suivants :

Méthodes

L’interface ID2D1GradientStopCollection utilise ces méthodes.

 
ID2D1GradientStopCollection::GetColorInterpolationGamma

Indique l’espace gamma dans lequel les points de dégradé sont interpolés.
ID2D1GradientStopCollection::GetExtendMode

Indique le comportement du dégradé en dehors de la plage de dégradés normalisée.
ID2D1GradientStopCollection::GetGradientStopCount

Récupère le nombre de points de dégradé dans la collection.
ID2D1GradientStopCollection::GetGradientStops

Copie les points de dégradé de la collection dans un tableau de structures D2D1_GRADIENT_STOP.

Remarques

Création d’objets ID2D1GradientStopCollection

Pour créer un ID2D1GradientStopCollection, utilisez la méthode ID2D1RenderTarget::CreateGradientStopCollection .

Une collection d’arrêt de dégradé est une ressource dépendante de l’appareil : votre application doit créer des collections d’arrêt de dégradé après avoir initialisé la cible de rendu avec laquelle la collection d’arrêt de dégradé sera utilisée, et recréer la collection d’arrêt de dégradé chaque fois que la cible de rendu doit être recréée. (Pour plus d’informations sur les ressources, consultez Vue d’ensemble des ressources.)

Exemples

L’exemple suivant crée un tableau de points de dégradé, puis les utilise pour créer un ID2D1GradientStopCollection.

// 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
    );

L’exemple de code suivant utilise id2D1GradientStopCollection pour créer un OBJET ID2D1LinearGradientBrush.

// 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
        );
}

Configuration requise

   
Client minimal pris en charge Windows 7, Windows Vista avec SP2 et Mise à jour de plateforme pour Windows Vista [applications de bureau | Applications UWP]
Serveur minimal pris en charge Windows Server 2008 R2, Windows Server 2008 avec SP2 et Platform Update pour Windows Server 2008 [applications de bureau | Applications UWP]
Plateforme cible Windows
En-tête d2d1.h

Voir aussi

ID2D1Resource