0

WP7のバックグラウンドレンダリングに使用する別のGraphicDeviceを作成することは可能ですか?

私がやろうとしているのは、XNAを使用して画像をレンダリングし、Silverlightアプリケーションで使用することです。現在、現在のGraphicDeviceにアクセスできるSharedGraphicsDeviceManagerを使用してこれを実現できます。欠点は、画像ごとに共有モードのオンとオフ(SetSharingMode)を切り替える必要があることです。これには時間がかかります(100〜200ミリ秒)。これには別のデバイスを使用したいと思います。

もう1つのオプションは、ページ全体に純粋なXNAレンダリングモードを使用することですが、これにより、ほとんど静止した画像が1秒間に30回レンダリングされ続けるため、電話に不必要な負担がかかります。

任意のアイデアをいただければ幸いです。

4

1 に答える 1

0

画像をページの背景にバインドするのはどうですか?

<Grid x:Name="LayoutRoot" Background="{Binding BackgroundImage}">
    <!-- other content for the page -->
</Grid>

その後、ViewModelのコードビハインドで必要なときにいつでも画像を変更できます

public class ViewModel
{
    private ImageBrush _backgroundImage;

    public ImageBrush BackgroundImage
    {
        get { return _backgroundImage; }
        set
        {
            _backgroundImage = value;
            OnPropertyChanged("BackgroundImage");
        }
    }

    // pass the uri of the newly saved image. Even if it's the same location
    // firing the PropertyChanged event will make the page get the new image
    public void ChangeImage(Uri newImageLocation)
    {
        BitmapImage source = new BitmapImage(newImageLocation);
        BackgroundImage = new ImageBrush { ImageSource = source}; 
    }
}
于 2012-05-27T20:33:41.627 に答える