ID2D1RenderTarget ::P opLayer, méthode (d2d1.h)
Arrête la redirection des opérations de dessin vers la couche spécifiée par le dernier appel PushLayer .
Syntaxe
void PopLayer();
Valeur de retour
None
Remarques
Un PopLayer doit correspondre à un appel PushLayer précédent.
Cette méthode ne retourne pas de code d’erreur en cas d’échec. Pour déterminer si une opération de dessin (telle que PopLayer) a échoué, case activée le résultat retourné par les méthodes ID2D1RenderTarget ::EndDraw ou ID2D1RenderTarget ::Flush.
Exemples
L’exemple suivant utilise une couche pour couper une image bitmap en masque géométrique. Pour obtenir l’exemple complet, consultez Comment cliper un masque géométrique.
HRESULT DemoApp::RenderWithLayer(ID2D1RenderTarget *pRT)
{
HRESULT hr = S_OK;
// Create a layer.
ID2D1Layer *pLayer = NULL;
hr = pRT->CreateLayer(NULL, &pLayer);
if (SUCCEEDED(hr))
{
pRT->SetTransform(D2D1::Matrix3x2F::Translation(350, 50));
// Push the layer with the geometric mask.
pRT->PushLayer(
D2D1::LayerParameters(D2D1::InfiniteRect(), m_pPathGeometry),
pLayer
);
pRT->DrawBitmap(m_pOrigBitmap, D2D1::RectF(0, 0, 200, 133));
pRT->FillRectangle(D2D1::RectF(0.f, 0.f, 25.f, 25.f), m_pSolidColorBrush);
pRT->FillRectangle(D2D1::RectF(25.f, 25.f, 50.f, 50.f), m_pSolidColorBrush);
pRT->FillRectangle(D2D1::RectF(50.f, 50.f, 75.f, 75.f), m_pSolidColorBrush);
pRT->FillRectangle(D2D1::RectF(75.f, 75.f, 100.f, 100.f), m_pSolidColorBrush);
pRT->FillRectangle(D2D1::RectF(100.f, 100.f, 125.f, 125.f), m_pSolidColorBrush);
pRT->FillRectangle(D2D1::RectF(125.f, 125.f, 150.f, 150.f), m_pSolidColorBrush);
pRT->PopLayer();
}
SafeRelease(&pLayer);
return hr;
}
Configuration requise
Condition requise | Valeur |
---|---|
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 Mise à jour de plateforme pour Windows Server 2008 [applications de bureau | Applications UWP] |
Plateforme cible | Windows |
En-tête | d2d1.h |
Bibliothèque | D2d1.lib |
DLL | D2d1.dll |
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour