DrawingContext.PushOpacity 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정한 불투명도 설정을 그리기 컨텍스트에 푸시합니다.
오버로드
PushOpacity(Double) |
지정한 불투명도 설정을 그리기 컨텍스트에 푸시합니다. |
PushOpacity(Double, AnimationClock) |
지정한 불투명도 설정을 그리기 컨텍스트에 푸시한 다음 지정한 애니메이션 Clock을 적용합니다. |
PushOpacity(Double)
지정한 불투명도 설정을 그리기 컨텍스트에 푸시합니다.
public:
abstract void PushOpacity(double opacity);
public abstract void PushOpacity (double opacity);
abstract member PushOpacity : double -> unit
Public MustOverride Sub PushOpacity (opacity As Double)
매개 변수
- opacity
- Double
이후 그리기 명령에 적용할 불투명도 인수입니다. 이 인수는 이전 PushOpacity(Double) 작업과 누적됩니다.
예제
다음 예제에서는 PushOpacity, PushEffect및 Pop 명령을 보여 줍니다.
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
설명
불투명도는 명령에 의해 Pop 제거될 때까지 모든 후속 그리기 명령으로 혼합됩니다.
적용 대상
PushOpacity(Double, AnimationClock)
지정한 불투명도 설정을 그리기 컨텍스트에 푸시한 다음 지정한 애니메이션 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)
매개 변수
- opacity
- Double
이후 그리기 명령에 적용할 불투명도 인수입니다. 이 인수는 이전 PushOpacity(Double) 작업과 누적됩니다.
- opacityAnimations
- AnimationClock
불투명도 값에 애니메이션 효과를 주는 데 사용할 Clock이며 애니메이션이 없는 경우 null
입니다. 이 Clock은 AnimationTimeline 값에 애니메이션 효과를 줄 수 있는 Double에서 만들어야 합니다.
설명
불투명도는 명령에 의해 Pop 제거될 때까지 모든 후속 그리기 명령으로 혼합됩니다.
적용 대상
.NET