Visual.IsPixelSnappingEnabled プロパティ

定義

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

public:
 property bool IsPixelSnappingEnabled { bool get(); void set(bool value); };
bool IsPixelSnappingEnabled();

void IsPixelSnappingEnabled(bool value);
public bool IsPixelSnappingEnabled { get; set; }
var boolean = visual.isPixelSnappingEnabled;
visual.isPixelSnappingEnabled = boolean;
Public Property IsPixelSnappingEnabled As Boolean

プロパティ値

Boolean

bool

true 合成エンジンがレンダリングされたビジュアルをピクセル境界に合わせる場合は 。それ以外の場合は false。 既定値は、false です。

public Visual CreateVisualTree(Compositor compositor)
{
    // Say we have two visuals, one containing an image and one containing text.
    // The image can be resampled and still look fine, but the text looks bad if
    // it doesn't land perfectly on pixel boundaries.
    var root = compositor.CreateContainerVisual();

    var imageVisual = compositor.CreateSpriteVisual();
    ImageLoadingHelper(imageVisual);

    var textVisual = compositor.CreateSpriteVisual();
    TextLoadingHelper(textVisual);

    textVisual.Offset = new Vector3(50, 0, 0);
    textVisual.IsPixelSnappingEnabled = true;

    root.Children.Add(imageVisual);
    root.Children.Add(textVisual);

    return root;
}

注釈

ピクセル スナップを使用すると、合成エンジンがレンダリング時にビジュアル ツリーの位置を少し調整して、原点がピクセル境界と完全に一致するように要求できます。 これにより、テクスチャのサンプリング アーティファクトの削減と引き換えに位置精度が低下します。

適用対象