Class TextureExtensions
public static class TextureExtensions
- Inheritance
-
objectTextureExtensions
Methods
CreateDepthTextureCompatible(Texture)
Creates a Shader Resource View on a Depth-Stencil Texture.
public static Texture CreateDepthTextureCompatible(this Texture texture)
Parameters
textureTextureThe Texture to create a Depth-Stencil Texture View for.
Returns
EnsureRenderTarget(Texture)
Verifies that a given Texture is a Render Target.
public static Texture EnsureRenderTarget(this Texture texture)
Parameters
textureTexture
Returns
Exceptions
FromFileData(GraphicsDevice, byte[])
Creates a Texture from image file data.
public static Texture FromFileData(GraphicsDevice graphicsDevice, byte[] data)
Parameters
graphicsDeviceGraphicsDeviceThe graphics device in which to create the Texture.
databyte[]The image file data.
Returns
- Texture
The created Texture.
ToDepthStencilReadOnlyTexture(Texture)
Creates a Shader Resource View that is read-only on a Depth-Stencil Texture.
public static Texture ToDepthStencilReadOnlyTexture(this Texture texture)
Parameters
textureTextureThe Texture to create a read-only Depth-Stencil Texture View for.
Returns
ToTextureView(Texture, ViewType, int, int)
Creates a Shader Resource View for a Texture.
public static Texture ToTextureView(this Texture texture, ViewType viewType, int arraySlice, int mipLevel)
Parameters
textureTextureThe Texture to create a Shader Resource View for.
viewTypeViewTypeOne of the values of ViewType indicating which sub-resources from the Texture's mip hierarchy and array slices (if a Texture Array) the Shader Resource View can access.
arraySliceintThe index of the array slice. It is zero-based, so the first index is 0. If the Texture is not a Texture Array, specify 0.
mipLevelintThe index of the mip level. It is zero-based, so the first index is 0. If the Texture has no mip-chain, specify 0.