Texture2D

class Texture2D : Texture, System.IDisposable
readonly Rectangle Bounds

Gets the dimensions of the texture

readonly int Width
readonly int Height
float get_TexelWidth()
float get_TexelHeight()
public void SetData<T>(int level, int arraySlice, System.Nullable<Rectangle> rect, Microsoft.Xna.Framework.Graphics.T[] data, int startIndex, int elementCount)
Type Parameters:
 
  • T
Parameters:
  • level (int) –
  • arraySlice (int) –
  • rect (System.Nullable<Rectangle>) –
  • data (Microsoft.Xna.Framework.Graphics.T[]) –
  • startIndex (int) –
  • elementCount (int) –
public void SetData<T>(int level, System.Nullable<Rectangle> rect, Microsoft.Xna.Framework.Graphics.T[] data, int startIndex, int elementCount)
Type Parameters:
 
  • T
Parameters:
  • level (int) –
  • rect (System.Nullable<Rectangle>) –
  • data (Microsoft.Xna.Framework.Graphics.T[]) –
  • startIndex (int) –
  • elementCount (int) –
public void SetData<T>(Microsoft.Xna.Framework.Graphics.T[] data, int startIndex, int elementCount)
Type Parameters:
 
  • T
Parameters:
  • data (Microsoft.Xna.Framework.Graphics.T[]) –
  • startIndex (int) –
  • elementCount (int) –
public void SetData<T>(Microsoft.Xna.Framework.Graphics.T[] data)
Type Parameters:
 
  • T
Parameters:
  • data (Microsoft.Xna.Framework.Graphics.T[]) –
public void GetData<T>(int level, int arraySlice, System.Nullable<Rectangle> rect, Microsoft.Xna.Framework.Graphics.T[] data, int startIndex, int elementCount)
Type Parameters:
 
  • T
Parameters:
  • level (int) –
  • arraySlice (int) –
  • rect (System.Nullable<Rectangle>) –
  • data (Microsoft.Xna.Framework.Graphics.T[]) –
  • startIndex (int) –
  • elementCount (int) –
public void GetData<T>(int level, System.Nullable<Rectangle> rect, Microsoft.Xna.Framework.Graphics.T[] data, int startIndex, int elementCount)
Type Parameters:
 
  • T
Parameters:
  • level (int) –
  • rect (System.Nullable<Rectangle>) –
  • data (Microsoft.Xna.Framework.Graphics.T[]) –
  • startIndex (int) –
  • elementCount (int) –
public void GetData<T>(Microsoft.Xna.Framework.Graphics.T[] data, int startIndex, int elementCount)
Type Parameters:
 
  • T
Parameters:
  • data (Microsoft.Xna.Framework.Graphics.T[]) –
  • startIndex (int) –
  • elementCount (int) –
public void GetData<T>(Microsoft.Xna.Framework.Graphics.T[] data)
Type Parameters:
 
  • T
Parameters:
  • data (Microsoft.Xna.Framework.Graphics.T[]) –
public Texture2D FromStream(GraphicsDevice graphicsDevice, System.IO.Stream stream)

Creates a Texture2D from a stream, supported formats bmp, gif, jpg, png, tif and dds (only for simple textures). May work with other formats, but will not work with tga files.

Parameters:
  • graphicsDevice (Microsoft.Xna.Framework.Graphics.GraphicsDevice) – The graphics device where the texture will be created.
  • stream (System.IO.Stream) – The stream from which to read the image data.
Returns:

The F:Microsoft.Xna.Framework.Graphics.SurfaceFormat.Color texture created from the image stream.

public void SaveAsJpeg(System.IO.Stream stream, int width, int height)

Converts the texture to a JPG image

Parameters:
  • stream (System.IO.Stream) – Destination for the image
  • width (int) –
  • height (int) –
public void SaveAsPng(System.IO.Stream stream, int width, int height)

Converts the texture to a PNG image

Parameters:
  • stream (System.IO.Stream) – Destination for the image
  • width (int) –
  • height (int) –
public void Reload(System.IO.Stream textureStream)
Parameters:
  • textureStream (System.IO.Stream) –
SharpDX.Direct3D11.Texture2DDescription GetTexture2DDescription()
SharpDX.Direct3D11.Resource CreateTexture()
SharpDX.DXGI.SampleDescription CreateSampleDescription()
SharpDX.DXGI.SampleDescription GetTextureSampleDescription()