Class representing a 2D texture. More...
Public Member Functions | |
Texture2D (int width, int height, bool mipmap, PixelFormat format) | |
Creates a 2D texture. | |
Texture2D (int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option) | |
Creates a 2D texture (with options) | |
Texture2D (string fileName, bool mipmap) | |
Creates a 2D texture (from a file) | |
Texture2D (string fileName, bool mipmap, PixelFormat format) | |
Creates a 2D texture (from a file, with format conversion) | |
Texture2D (byte[] fileImage, bool mipmap) | |
Creates a 2D texture (from a file image) | |
Texture2D (byte[] fileImage, bool mipmap, PixelFormat format) | |
Creates a 2D texture (from a file image, with format conversion) | |
override Object | ShallowClone () |
Creates a copy of a 2D texture. | |
void | SetPixels (int level, Array pixels) |
Sets pixel data. | |
void | SetPixels (int level, Array pixels, int dx, int dy, int dw, int dh) |
Sets pixel data (with range) | |
void | SetPixels (int level, Array pixels, int offset, int pitch) |
Sets pixel data (with byte offset) | |
void | SetPixels (int level, Array pixels, PixelFormat format) |
Sets pixel data (with format conversion) | |
void | SetPixels (int level, Array pixels, PixelFormat format, int offset, int pitch, int dx, int dy, int dw, int dh) |
Sets pixel data (with format conversion, with byte offset, with range) | |
void | GenerateMipmap () |
Automatically creates a mipmap image. | |
Protected Member Functions | |
Texture2D (Texture2D texture) | |
Creates a copy of a 2D texture. |
Class representing a 2D texture.
Texture2D | ( | int | width, |
int | height, | ||
bool | mipmap, | ||
PixelFormat | format | ||
) |
Creates a 2D texture.
width | Texture width |
height | Texture height |
mipmap | Existence/Lack of mipmap |
format | Pixel format |
Creates the 2D texture using the specified parameters. Rgba, Rgba4444, Rgba5551, Rgb565, LuminanceAlpha, Luminance, Alpha, RgbaH, LuminanceAlphaH, LuminanceH, AlphaH, Dxt1, Dxt2, Dxt3, Dxt4, or Dxt5 can be specified to the pixel format.
When the pixel format is DXT, the width and height must be a power of 2.
Texture2D | ( | int | width, |
int | height, | ||
bool | mipmap, | ||
PixelFormat | format, | ||
PixelBufferOption | option | ||
) |
Creates a 2D texture (with options)
width | Texture width |
height | Texture height |
mipmap | Existence/Lack of mipmap |
format | Pixel format |
option | Pixel buffer creation option |
Creates the 2D texture using the specified parameters. Rgba, Rgba4444, Rgba5551, Rgb565, LuminanceAlpha, Luminance, Alpha, RgbaH, LuminanceAlphaH, LuminanceH, AlphaH, Dxt1, Dxt2, Dxt3, Dxt4, or Dxt5 can be specified to the pixel format. However, if the Renderable option is specified, only Rgba, Rgba4444, Rgba5551, or Rgb565 can be specified.
When the pixel format is DXT, the width and height must be a power of 2.
Texture2D | ( | string | fileName, |
bool | mipmap | ||
) |
Creates a 2D texture (from a file)
fileName | Filename |
mipmap | Existence/Lack of mipmap |
Creates a 2D texture from a specified file. The usable file formats are DDS, PNG, JPG, BMP, and GIF (however, animated GIFs are not supported).
When a DDS file, the mipmap argument is ignored. When the pixel format is DXT, the width and height must be a power of 2.
Texture2D | ( | string | fileName, |
bool | mipmap, | ||
PixelFormat | format | ||
) |
Creates a 2D texture (from a file, with format conversion)
fileName | Filename |
mipmap | Existence/Lack of mipmap |
format | Pixel format |
Creates a 2D texture from a specified file. The usable file formats are DDS, PNG, JPG, BMP, and GIF (however, animated GIFs are not supported). Rgba, Rgba4444, Rgba5551, Rgb565, LuminanceAlpha, Luminance, Alpha, RgbaH, LuminanceAlphaH, LuminanceH, or AlphaH can be specified to the pixel format.
When a DDS file, the mipmap and format arguments are ignored. When the pixel format is DXT, the width and height must be a power of 2.
Texture2D | ( | byte[] | fileImage, |
bool | mipmap | ||
) |
Creates a 2D texture (from a file image)
fileImage | File image |
mipmap | Existence/Lack of mipmap |
Creates a 2D texture from a specified file image. The usable file formats are DDS, PNG, JPG, BMP, and GIF (however, animated GIFs are not supported).
When a DDS file, the mipmap arguments is ignored. When the pixel format is DXT, the width and height must be a power of 2.
Texture2D | ( | byte[] | fileImage, |
bool | mipmap, | ||
PixelFormat | format | ||
) |
Creates a 2D texture (from a file image, with format conversion)
fileImage | File image |
mipmap | Existence/Lack of mipmap |
format | Pixel format |
Creates a 2D texture from a specified file image. The usable file formats are DDS, PNG, JPG, BMP, and GIF (however, animated GIFs are not supported). Rgba, Rgba4444, Rgba5551, Rgb565, LuminanceAlpha, Luminance, Alpha, RgbaH, LuminanceAlphaH, LuminanceH, or AlphaH can be specified to the pixel format.
When a DDS file, the mipmap and format arguments are ignored. When the pixel format is DXT, the width and height must be a power of 2.
Creates a copy of a 2D texture.
texture | 2D texture |
Creates a copy of the texture. The 2 2D textures will then share unmanaged resources. When Dispose() is called for all copies, the shared unmanaged resources will be freed.
void GenerateMipmap | ( | ) |
Automatically creates a mipmap image.
Automatically creates a mipmap image from the current zero level image. Nothing will be performed if mipmaps are not present.
When the pixel format is DXT, nothing will be performed.
void SetPixels | ( | int | level, |
Array | pixels, | ||
int | dx, | ||
int | dy, | ||
int | dw, | ||
int | dh | ||
) |
Sets pixel data (with range)
level | Mipmap level (0 to LevelCount-1) |
pixels | Pixel data |
dx | X coordinate of the transfer destination |
dy | Y coordinate of the transfer destination |
dw | Width of the transfer destination |
dh | Height of the transfer destination |
Sets the pixel data to the specified mipmap level.
When the pixel format is DXT, the dx, dy, dw, and dh must be a multiple of 4.
void SetPixels | ( | int | level, |
Array | pixels, | ||
PixelFormat | format, | ||
int | offset, | ||
int | pitch, | ||
int | dx, | ||
int | dy, | ||
int | dw, | ||
int | dh | ||
) |
Sets pixel data (with format conversion, with byte offset, with range)
level | Mipmap level (0 to LevelCount-1) |
pixels | Pixel data |
format | Pixel format |
offset | Byte offset of pixel data |
pitch | Byte pitch of pixel data |
dx | X coordinate of the transfer destination |
dy | Y coordinate of the transfer destination |
dw | Width of the transfer destination |
dh | Height of the transfer destination |
Sets the pixel data to the specified mipmap level. Rgba or the same format as the texture can be specified to the pixel format.
When the pixel format is DXT, the dx, dy, dw, and dh must be a multiple of 4. Conversion of DXT pixel format is not supported.
void SetPixels | ( | int | level, |
Array | pixels, | ||
PixelFormat | format | ||
) |
Sets pixel data (with format conversion)
level | Mipmap level (0 to LevelCount-1) |
pixels | Pixel data |
format | Pixel format |
Sets the pixel data to the specified mipmap level. Rgba or the same format as the texture can be specified to the pixel format.
Conversion of DXT pixel format is not supported.
void SetPixels | ( | int | level, |
Array | pixels, | ||
int | offset, | ||
int | pitch | ||
) |
Sets pixel data (with byte offset)
level | Mipmap level (0 to LevelCount-1) |
pixels | Pixel data |
offset | Byte offset of pixel data |
pitch | Byte pitch of pixel data |
Sets the pixel data to the specified mipmap level.
void SetPixels | ( | int | level, |
Array | pixels | ||
) |
Sets pixel data.
level | Mipmap level (0 to LevelCount-1) |
pixels | Pixel data |
Sets the pixel data to the specified mipmap level.
This overload sets data to all pixels of the specified mipmap level. When the size of the array differs from the required size, an exception is thrown. When the array size is bigger than the required size, please use a different overload.
override Object ShallowClone | ( | ) | [virtual] |