DrawingContext.PushOpacity DrawingContext.PushOpacity DrawingContext.PushOpacity DrawingContext.PushOpacity Method

Definición

Inserta el valor de opacidad especificado en el contexto de dibujo.Pushes the specified opacity setting onto the drawing context.

Sobrecargas

PushOpacity(Double) PushOpacity(Double) PushOpacity(Double) PushOpacity(Double)

Inserta el valor de opacidad especificado en el contexto de dibujo.Pushes the specified opacity setting onto the drawing context.

PushOpacity(Double, AnimationClock) PushOpacity(Double, AnimationClock) PushOpacity(Double, AnimationClock) PushOpacity(Double, AnimationClock)

Inserta el valor de opacidad especificado en el contexto de dibujo y aplica el reloj de animación especificado.Pushes the specified opacity setting onto the drawing context and applies the specified animation clock.

PushOpacity(Double) PushOpacity(Double) PushOpacity(Double) PushOpacity(Double)

Inserta el valor de opacidad especificado en el contexto de dibujo.Pushes the specified opacity setting onto the drawing context.

public:
 abstract void PushOpacity(double opacity);
public abstract void PushOpacity (double opacity);
abstract member PushOpacity : double -> unit
Public MustOverride Sub PushOpacity (opacity As Double)

Parámetros

opacity
Double Double Double Double

Factor de opacidad que se va a aplicar a los comandos de dibujo subsiguientes.The opacity factor to apply to subsequent drawing commands. Este factor es acumulativo con anteriores operaciones PushOpacity(Double).This factor is cumulative with previous PushOpacity(Double) operations.

Ejemplos

En el ejemplo siguiente se PushOpacitymuestran PushEffectlos comandos Pop , y.The following example demonstrates the PushOpacity, PushEffect, and Pop commands.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Media.Effects;

namespace SDKSample
{


    public class PushEffectExample : Page
    {

        public PushEffectExample()
        {
            Pen shapeOutlinePen = new Pen(Brushes.Black, 2);
            shapeOutlinePen.Freeze();

            // Create a DrawingGroup
            DrawingGroup dGroup = new DrawingGroup();

            // Obtain a DrawingContext from 
            // the DrawingGroup.
            using (DrawingContext dc = dGroup.Open())
            {
                // Draw a rectangle at full opacity.
                dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(0, 0, 25, 25));

                // Push an opacity change of 0.5. 
                // The opacity of each subsequent drawing will
                // will be multiplied by 0.5.
                dc.PushOpacity(0.5);

                // This rectangle is drawn at 50% opacity.
                dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(25, 25, 25, 25));

                // Blurs subsquent drawings. 
                dc.PushEffect(new BlurBitmapEffect(), null);

                // This rectangle is blurred and drawn at 50% opacity (0.5 x 0.5). 
                dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(50, 50, 25, 25));

                // This rectangle is also blurred and drawn at 50% opacity.
                dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(75, 75, 25, 25));

                // Stop applying the blur to subsquent drawings.
                dc.Pop();

                // This rectangle is drawn at 50% opacity with no blur effect.
                dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(100, 100, 25, 25));
            }

            // Display the drawing using an image control.
            Image theImage = new Image();
            DrawingImage dImageSource = new DrawingImage(dGroup);
            theImage.Source = dImageSource;

            this.Content = theImage;

        }




    }

}
Imports System.Windows.Media.Animation
Imports System.Windows.Media.Effects

Namespace SDKSample


	Public Class PushEffectExample
		Inherits Page

		Public Sub New()
			Dim shapeOutlinePen As New Pen(Brushes.Black, 2)
			shapeOutlinePen.Freeze()

			' Create a DrawingGroup
			Dim dGroup As New DrawingGroup()

			' Obtain a DrawingContext from 
			' the DrawingGroup.
			Using dc As DrawingContext = dGroup.Open()
				' Draw a rectangle at full opacity.
				dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, New Rect(0, 0, 25, 25))

				' Push an opacity change of 0.5. 
				' The opacity of each subsequent drawing will
				' will be multiplied by 0.5.
				dc.PushOpacity(0.5)

				' This rectangle is drawn at 50% opacity.
				dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, New Rect(25, 25, 25, 25))

				' Blurs subsquent drawings. 
                dc.PushEffect(New BlurBitmapEffect(), Nothing)

				' This rectangle is blurred and drawn at 50% opacity (0.5 x 0.5). 
				dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, New Rect(50, 50, 25, 25))

				' This rectangle is also blurred and drawn at 50% opacity.
				dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, New Rect(75, 75, 25, 25))

				' Stop applying the blur to subsquent drawings.
				dc.Pop()

				' This rectangle is drawn at 50% opacity with no blur effect.
				dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, New Rect(100, 100, 25, 25))
			End Using

			' Display the drawing using an image control.
			Dim theImage As New Image()
			Dim dImageSource As New DrawingImage(dGroup)
			theImage.Source = dImageSource

			Me.Content = theImage

		End Sub




	End Class

End Namespace

Comentarios

La opacidad se mezcla en todos los comandos de dibujo subsiguientes hasta que el Pop comando los quite.The opacity is blended into all subsequent drawing commands until it is removed by the Pop command.

PushOpacity(Double, AnimationClock) PushOpacity(Double, AnimationClock) PushOpacity(Double, AnimationClock) PushOpacity(Double, AnimationClock)

Inserta el valor de opacidad especificado en el contexto de dibujo y aplica el reloj de animación especificado.Pushes the specified opacity setting onto the drawing context and applies the specified animation clock.

public:
 abstract void PushOpacity(double opacity, System::Windows::Media::Animation::AnimationClock ^ opacityAnimations);
public abstract void PushOpacity (double opacity, System.Windows.Media.Animation.AnimationClock opacityAnimations);
abstract member PushOpacity : double * System.Windows.Media.Animation.AnimationClock -> unit
Public MustOverride Sub PushOpacity (opacity As Double, opacityAnimations As AnimationClock)

Parámetros

opacity
Double Double Double Double

Factor de opacidad que se va a aplicar a los comandos de dibujo subsiguientes.The opacity factor to apply to subsequent drawing commands. Este factor es acumulativo con anteriores operaciones PushOpacity(Double).This factor is cumulative with previous PushOpacity(Double) operations.

opacityAnimations
AnimationClock AnimationClock AnimationClock AnimationClock

Reloj con el que se va a animar el valor de opacidad, o bien, null para ninguna animación.The clock with which to animate the opacity value, or null for no animation. Este reloj debe crearse a partir de un objeto AnimationTimeline que pueda animar los valores Double.This clock must be created from an AnimationTimeline that can animate Double values.

Comentarios

La opacidad se mezcla en todos los comandos de dibujo subsiguientes hasta que el Pop comando los quite.The opacity is blended into all subsequent drawing commands until it is removed by the Pop command.

Se aplica a