public class Texture2D extends Texture
Modifier and Type | Field and Description |
---|---|
protected int |
height |
protected int |
width |
_parent, Disposing, Name, Tag
Modifier | Constructor and Description |
---|---|
protected |
Texture2D() |
|
Texture2D(GraphicsDevice graphicsDevice,
int width,
int height)
Creates a new instance of this object.
|
|
Texture2D(GraphicsDevice graphicsDevice,
int width,
int height,
boolean mipMap,
SurfaceFormat format)
Creates a new instance of this object.
|
Modifier and Type | Method and Description |
---|---|
Rectangle |
Bounds()
Gets the size of this resource.
|
protected void |
Dispose(boolean disposing)
Immediately releases the unmanaged resources used by this Object.
|
static Texture2D |
FromStream(GraphicsDevice graphicsDevice,
java.io.InputStream stream)
Loads texture data from a stream.
|
static Texture2D |
FromStream(GraphicsDevice graphicsDevice,
java.io.InputStream stream,
int width,
int height,
boolean zoom)
Loads texture data from a stream.
|
<T> void |
GetData(int level,
Rectangle rect,
T[] data,
int startIndex,
int elementCount)
Gets a copy of 2D texture data, specifying a mipmap level, source rectangle, start index, and number of elements.
|
<T> void |
GetData(T[] data)
Gets a copy of 2D texture data.
|
<T> void |
GetData(T[] data,
int startIndex,
int elementCount)
Gets a copy of 2D texture data, specifying a start index and number of elements.
|
int |
Height()
Gets the height of this texture resource, in pixels.
|
void |
SaveAsJpeg(java.io.OutputStream stream,
int width,
int height)
Saves texture data as a .jpg.
|
void |
SaveAsPng(java.io.OutputStream stream,
int width,
int height)
Saves texture data as a .png.
|
<T> void |
SetData(int level,
Rectangle rect,
T[] data,
int startIndex,
int elementCount)
Sets 2D texture data, specifying a mipmap level, source rectangle, start index, and number of elements.
|
<T> void |
SetData(T[] data)
Sets 2D texture data.
|
<T> void |
SetData(T[] data,
int startIndex,
int elementCount)
Sets 2D texture data, specifying a start index, and number of elements.
|
int |
Width()
Gets the width of this texture resource, in pixels.
|
getFormat, getLevelCount
Dispose, finalize, getGraphicsDevice, IsDisposed, raise_disposing, toString
protected Texture2D()
public Texture2D(GraphicsDevice graphicsDevice, int width, int height)
graphicsDevice
- The device.width
- Texture width.height
- Texture height.public Texture2D(GraphicsDevice graphicsDevice, int width, int height, boolean mipMap, SurfaceFormat format)
graphicsDevice
- The device.width
- Texture width.height
- Texture height.mipMap
- True to generate a full mipmap chain; false otherwise.format
- Texture data format.public Rectangle Bounds()
public int Width()
public int Height()
protected void Dispose(boolean disposing)
GraphicsResource
Dispose
in class GraphicsResource
public static Texture2D FromStream(GraphicsDevice graphicsDevice, java.io.InputStream stream)
graphicsDevice
- A graphics device.stream
- Data stream from one of the following file types: .gif, .jpg or .png.public static Texture2D FromStream(GraphicsDevice graphicsDevice, java.io.InputStream stream, int width, int height, boolean zoom)
graphicsDevice
- A graphics device.stream
- Data stream from one of the following file types: .gif, .jpg or .png.width
- The requested image width.height
- The requested image height.zoom
- Control the aspect ratio when zooming (scaling); set to false to maintain a constant aspect ratio, true otherwise. See remarks.ArgumentNullException
- graphicsDevice or stream is null.public <T> void GetData(T[] data)
data
- Array of data.public <T> void GetData(T[] data, int startIndex, int elementCount)
data
- Array of data.startIndex
- Index of the first element to get.elementCount
- Number of elements to get.public <T> void GetData(int level, Rectangle rect, T[] data, int startIndex, int elementCount)
level
- Mipmap level.rect
- The section of the texture to copy. null indicates the data will be copied from the entire texture.data
- Array of data.startIndex
- Index of the first element to get.elementCount
- Number of elements to get.public void SaveAsJpeg(java.io.OutputStream stream, int width, int height)
stream
- Data stream number.width
- Image width.height
- Image height.ArgumentNullException
- stream is null.public void SaveAsPng(java.io.OutputStream stream, int width, int height)
stream
- Data stream number.width
- Image width.height
- Image height.ArgumentNullException
- stream is null.public <T> void SetData(T[] data)
data
- Array of data.public <T> void SetData(T[] data, int startIndex, int elementCount)
data
- Array of data.startIndex
- Index of the first element to set.elementCount
- Number of elements to set.public <T> void SetData(int level, Rectangle rect, T[] data, int startIndex, int elementCount)
level
- Mipmap level.rect
- A bounding box that defines the position and location (in pixels) of the data.data
- Array of data.startIndex
- Index of the first element to set.elementCount
- Number of elements to set.