本文整理汇总了C#中Surface.Map方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.Map方法的具体用法?C# Surface.Map怎么用?C# Surface.Map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surface
的用法示例。
在下文中一共展示了Surface.Map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadResources
public override void LoadResources()
{
if (m_Device != null && m_Device.ColorResolution != ImageResolution.Invalid)
{
if (Disposed == true)
{
m_Texture = new Texture2D(GameEnvironment.Device, new Texture2DDescription()
{
Format = SlimDX.DXGI.Format.R8G8B8A8_UNorm,
Width = KinectHelper.GetWidthForResolution(m_Device.ColorResolution),
Height = KinectHelper.GetHeightForResolution(m_Device.ColorResolution),
MipLevels = 1,
ArraySize = 1,
BindFlags = BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.Write,
OptionFlags = ResourceOptionFlags.None,
Usage = ResourceUsage.Dynamic,
SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0)
});
m_TextureSurface = m_Texture.AsSurface();
DataRectangle data = m_TextureSurface.Map(SlimDX.DXGI.MapFlags.Discard | SlimDX.DXGI.MapFlags.Write);
int rowSize = (m_Texture.Description.Width * 4);
int stride = data.Pitch;
for (int i = 0, ie = m_Texture.Description.Height; i < ie; i++)
{
for (int p = 0; p < stride; p++)
{
data.Data.WriteByte(0);
}
}
m_TextureSurface.Unmap();
m_TextureResourceView = new ShaderResourceView(GameEnvironment.Device, m_Texture, new ShaderResourceViewDescription()
{
Dimension = ShaderResourceViewDimension.Texture2D,
Format = SlimDX.DXGI.Format.R8G8B8A8_UNorm,
ArraySize = 1,
MipLevels = 1,
MostDetailedMip = 0,
});
m_Image.TextureView = m_TextureResourceView;
m_Image.LoadResources();
Disposed = false;
}
}
}