|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMicrosoft.Xna.Framework.Graphics.GraphicsResource
Microsoft.Xna.Framework.Graphics.Texture
Microsoft.Xna.Framework.Graphics.Texture2D
public class Texture2D
Represents a 2D grid of texels.
Field Summary | |
---|---|
protected int |
height
|
protected int |
width
|
Fields inherited from class Microsoft.Xna.Framework.Graphics.GraphicsResource |
---|
_parent, Disposing, Name, Tag |
Constructor Summary | |
---|---|
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. |
Method Summary | ||
---|---|---|
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. |
|
|
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. |
|
|
GetData(T[] data)
Gets a copy of 2D texture data. |
|
|
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. |
|
|
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. |
|
|
SetData(T[] data)
Sets 2D texture data. |
|
|
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. |
Methods inherited from class Microsoft.Xna.Framework.Graphics.Texture |
---|
Format, LevelCount |
Methods inherited from class Microsoft.Xna.Framework.Graphics.GraphicsResource |
---|
Dispose, finalize, GraphicsDevice, IsDisposed, raise_disposing, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int height
protected int width
Constructor Detail |
---|
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.Method Detail |
---|
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.
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.public void SaveAsPng(java.io.OutputStream stream, int width, int height)
stream
- Data stream number.width
- Image width.height
- Image height.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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |