Windows phone 7 在WP7中创建用于背景渲染的GraphicDevice
是否可以创建一个单独的GraphicDevice用于WP7中的背景渲染 我尝试做的是偶尔使用XNA渲染图像,并在silverlight应用程序中使用它。目前,我可以使用SharedGraphicsDeviceManager来实现这一点,它可以让用户访问当前的GraphicsDevice。缺点是我不得不为每个图像打开和关闭共享模式SetShareingMode,这确实需要100-200毫秒的时间。我宁愿使用一个单独的设备来实现这一点 另一种选择是对整个页面使用纯XNA渲染模式,但这会给手机带来不必要的压力,因为它会保持每秒30次渲染大部分静态图像Windows phone 7 在WP7中创建用于背景渲染的GraphicDevice,windows-phone-7,xna,Windows Phone 7,Xna,是否可以创建一个单独的GraphicDevice用于WP7中的背景渲染 我尝试做的是偶尔使用XNA渲染图像,并在silverlight应用程序中使用它。目前,我可以使用SharedGraphicsDeviceManager来实现这一点,它可以让用户访问当前的GraphicsDevice。缺点是我不得不为每个图像打开和关闭共享模式SetShareingMode,这确实需要100-200毫秒的时间。我宁愿使用一个单独的设备来实现这一点 另一种选择是对整个页面使用纯XNA渲染模式,但这会给手机带来不必
如果您有任何想法,我们将不胜感激。如何将图像绑定到页面背景
<Grid x:Name="LayoutRoot" Background="{Binding BackgroundImage}">
<!-- other content for the page -->
</Grid>
谢谢你的回答,但是你能重读这个问题吗?问题不是让图像显示在UI中,而是如何使用GraphicDevice渲染图像而不使用共享模式。
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};
}
}