DrawingContext.PushOpacity メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定した不透明度の設定を描画コンテキストにプッシュします。
オーバーロード
| 名前 | 説明 |
|---|---|
| PushOpacity(Double) |
指定した不透明度の設定を描画コンテキストにプッシュします。 |
| PushOpacity(Double, AnimationClock) |
指定した不透明度の設定を描画コンテキストにプッシュし、指定したアニメーション クロックを適用します。 |
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.Windows;
using System.Windows.Controls;
using System.Windows.Media;
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));
}
// 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))
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)
指定した不透明度の設定を描画コンテキストにプッシュし、指定したアニメーション クロックを適用します。
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
不透明度の値をアニメーション化するクロック。アニメーションがない場合は null 。 このクロックは、AnimationTimeline値をアニメーション化できるDoubleから作成する必要があります。
注釈
不透明度は、 Pop コマンドによって削除されるまで、後続のすべての描画コマンドにブレンドされます。