SpriteVisual クラス

定義

CompositionBrush 型の 2D ボックスコンテンツをホストします。 ブラシのピクセルで覆われなかったビジュアルの任意の部分は、透明ピクセルとしてレンダリングされます。 CompositionBrush には、 CompositionBackdropBrushCompositionColorBrushCompositionSurfaceBrushCompositionEffectBrush のいずれかを指定できます。

public ref class SpriteVisual sealed : ContainerVisual
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SpriteVisual final : ContainerVisual
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class SpriteVisual : ContainerVisual
Public NotInheritable Class SpriteVisual
Inherits ContainerVisual
継承
Object Platform::Object IInspectable CompositionObject Visual ContainerVisual SpriteVisual
属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10586.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v2.0 で導入)

SpriteVisual visual = compositor.CreateSpriteVisual();
visual.Brush = compositor.CreateColorBrush  (Colors.White);
SpriteVisual visual = compositor.CreateSpriteVisual();
var surface = graphicsDevice.CreateDrawingSurface(new Size(300, 50), 
                                                  Windows.Graphics.DirectX.DirectXPixelFormat.B8G8R8A8UIntNormalized, 
                                                  CompositionAlphaMode.Ignore); 
visual.Brush = compsositor.CreateSurfaceBrush (surface);

影の追加

//Create surface brush and load in an image
CompositionSurfaceBrush surfaceBrush = compositor.CreateSurfaceBrush();
surfaceBrush.Surface = await imageLoader.LoadImageFromUriAsync(new Uri("ms-appx:///Assets/cat.jpg"));

//Create sprite visual
SpriteVisual visual = compositor.CreateSpriteVisual();
visual.Brush = surfaceBrush;
visual.Size = new Vector2(270, 200);

//Create drop shadow
DropShadow shadow = compositor.CreateDropShadow();
shadow.BlurRadius = 5;
shadow.Offset = new Vector3(15, 15, -10);
shadow.Color = Colors.DarkGray;

//Associate shadow to visual
visual.Shadow = shadow;        

注釈

バージョン履歴

Windows のバージョン SDK バージョン 追加された値
1607 14393 シャドウ

プロパティ

AnchorPoint

ビジュアルのオフセットに配置されるビジュアル上のポイント。 値は、ビジュアルのサイズに関して正規化されます。 アニメーション化可能。

(継承元 Visual)
BackfaceVisibility

3D 変換中にビジュアルの背面を表示するかどうかを指定します。

(継承元 Visual)
BorderMode

ビジュアルに関連付けられたビットマップとクリップ、またはサブツリー内のすべてのビジュアルをこのビジュアルにルート化して、ビットマップとクリップのエッジを作成する方法を指定します。 親ビジュアルで BorderMode を設定すると、サブツリー内のすべての子ビジュアルに影響し、各子ビジュアルで選択的にオフにすることができます。

(継承元 Visual)
Brush

SpriteVisual の描画方法を記述する CompositionBrush

CenterPoint

回転またはスケーリングが発生するポイント。 アニメーション化可能

(継承元 Visual)
Children

ContainerVisual の子。

(継承元 ContainerVisual)
Clip

ビジュアルのクリッピング領域を指定します。 ビジュアルをレンダリングすると、クリッピング領域の内側にあるビジュアルの部分のみが表示され、クリッピング領域の外側に広がるコンテンツはクリップされます (つまり、表示されません)。

(継承元 Visual)
Comment

CompositionObject に関連付ける文字列。

(継承元 CompositionObject)
CompositeMode

ビジュアルのビットマップを画面とブレンドする方法を指定します。

(継承元 Visual)
Compositor

この CompositionObject の作成に使用するコンポジター

(継承元 CompositionObject)
Dispatcher

CompositionObject のディスパッチャー。

(継承元 CompositionObject)
DispatcherQueue

CompostionObject の DispatcherQueue を取得します。

(継承元 CompositionObject)
ImplicitAnimations

このオブジェクトにアタッチされている暗黙的なアニメーションのコレクション。

(継承元 CompositionObject)
IsHitTestVisible

このビジュアルにルート化されたビジュアル サブツリーがヒット テストに参加するかどうかを示す値を取得または設定します。

(継承元 Visual)
IsPixelSnappingEnabled

コンポジション エンジンがレンダリングされたビジュアルをピクセル境界に合わせるかどうかを示す値を取得または設定します。

(継承元 Visual)
IsVisible

ビジュアルとその子ビジュアルのサブツリー全体が表示されるかどうかを示します。

(継承元 Visual)
Offset

親に対するビジュアルのオフセット、またはルート ビジュアルの場合は、ビジュアルをホストするウィンドウの左上隅からの相対オフセット。 アニメーション化可能。

(継承元 Visual)
Opacity

ビジュアルの不透明度。 アニメーション化可能。

opacity プロパティは、Visual の透明度 (存在する場合) を決定し、0 から 1 の値です。 0 は完全に透明で、1 は完全に不透明です。 Opacity プロパティが 0 のビジュアルは、ツリーにまだ存在します。 ビジュアルの他のプロパティと同様に、Opacity は Windows、UI を使用してアニメーション化できます。コンポジション アニメーション システム。

(継承元 Visual)
Orientation

ビジュアルに適用される 3D 空間の向きと回転を表す四元数。 アニメーション化可能。

(継承元 Visual)
Parent

ビジュアルの親。

(継承元 Visual)
ParentForTransform

このビジュアルを構成する座標系を指定するビジュアル。

(継承元 Visual)
Properties

CompositionObject に関連付けられているプロパティのコレクション。

(継承元 CompositionObject)
RelativeOffsetAdjustment

親ビジュアルのサイズに関するビジュアルのオフセットを指定します。

(継承元 Visual)
RelativeSizeAdjustment

親ビジュアルのサイズに関するビジュアルのサイズを取得または設定します。

(継承元 Visual)
RotationAngle

ビジュアルの回転角度 (ラジアン)。 アニメーション化可能。

(継承元 Visual)
RotationAngleInDegrees

ビジュアルの回転角度を度単位で指定します。 アニメーション化可能。

(継承元 Visual)
RotationAxis

ビジュアルを回転させる軸。 アニメーション化可能。

(継承元 Visual)
Scale

ビジュアルに適用するスケール。

(継承元 Visual)
Shadow

SpriteVisual の影。

Size

ビジュアルの幅と高さ。 アニメーション化可能。

(継承元 Visual)
TransformMatrix

ビジュアルに適用する変換マトリックス。 アニメーション化可能。

(継承元 Visual)

メソッド

Close()

CompositionObject を閉じ、システム リソースを解放します。

(継承元 CompositionObject)
ConnectAnimation(String, CompositionAnimation)

接続とアニメーション。

(継承元 CompositionObject)
DisconnectAnimation(String)

アニメーションを切断します。

(継承元 CompositionObject)
Dispose()

アンマネージ リソースの解放またはリセットに関連付けられているアプリケーション定義のタスクを実行します。

(継承元 CompositionObject)
PopulatePropertyInfo(String, AnimationPropertyInfo)

アニメーション化できるプロパティを定義します。

(継承元 CompositionObject)
StartAnimation(String, CompositionAnimation)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

(継承元 CompositionObject)
StartAnimation(String, CompositionAnimation, AnimationController)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

(継承元 CompositionObject)
StartAnimationGroup(ICompositionAnimationBase)

アニメーション グループを開始します。

CompositionObject の StartAnimationGroup メソッドを使用すると、CompositionAnimationGroup を開始できます。 グループ内のすべてのアニメーションは、オブジェクトで同時に開始されます。

(継承元 CompositionObject)
StopAnimation(String)

指定したプロパティからアニメーションを切断し、アニメーションを停止します。

(継承元 CompositionObject)
StopAnimationGroup(ICompositionAnimationBase)

アニメーション グループを停止します。

(継承元 CompositionObject)
TryGetAnimationController(String)

指定したプロパティで実行されているアニメーションの AnimationController を返します。

(継承元 CompositionObject)

適用対象

こちらもご覧ください