public class TextureData extends A3DObject
name, properties| Constructor and Description |
|---|
TextureData()
Constructor of
TextureData |
TextureData(int width,
int height,
int stride,
int bytesPerPixel,
PixelFormat pixelFormat,
byte[] data)
Constructor of
TextureData |
TextureData(int width,
int height,
PixelFormat pixelFormat)
Constructs a new
TextureData and allocate pixel data. |
| Modifier and Type | Method and Description |
|---|---|
static TextureData |
fromFile(java.lang.String fileName)
Load a texture from file
|
static TextureData |
fromStream(Stream stream)
Load a texture from stream
|
int |
getBytesPerPixel()
Number of bytes of a pixel
|
byte[] |
getData()
Raw bytes of pixel data
|
int |
getHeight()
Number of vertical pixels
|
PixelFormat |
getPixelFormat()
The pixel's format
|
int |
getStride()
Number of bytes of a scanline.
|
int |
getWidth()
Number of horizontal pixels
|
PixelMapping |
mapPixels(PixelMapMode mapMode)
Map all pixels for read/write
|
PixelMapping |
mapPixels(PixelMapMode mapMode,
PixelFormat format)
Map all pixels for read/write in given pixel format
|
PixelMapping |
mapPixels(Rect rect,
PixelMapMode mapMode,
PixelFormat format)
Map pixels addressed by rect for reading/writing in given pixel format
|
void |
save(Stream stream,
java.lang.String format)
Save texture data into specified image format
|
void |
save(java.lang.String fileName)
Save texture data into image file
|
void |
save(java.lang.String fileName,
java.lang.String format)
Save texture data into image file
|
void |
transformPixelFormat(PixelFormat pixelFormat)
Transform pixel's layout to new pixel format.
|
findProperty, getName, getProperties, getProperty, removeProperty, removeProperty, setName, setPropertypublic TextureData(int width,
int height,
int stride,
int bytesPerPixel,
PixelFormat pixelFormat,
byte[] data)
TextureDatapublic TextureData(int width,
int height,
PixelFormat pixelFormat)
TextureData and allocate pixel data.public TextureData()
TextureDatapublic byte[] getData()
public int getWidth()
public int getHeight()
public int getStride()
public int getBytesPerPixel()
public PixelFormat getPixelFormat()
public static TextureData fromStream(Stream stream)
public static TextureData fromFile(java.lang.String fileName) throws java.io.IOException
java.io.IOExceptionpublic void save(Stream stream, java.lang.String format)
stream - The stream that holds the saved imageformat - Image format, usually file extensionpublic void save(java.lang.String fileName)
throws java.io.IOException
fileName - The file name of where the image will be saved.java.io.IOExceptionpublic void save(java.lang.String fileName,
java.lang.String format)
throws java.io.IOException
fileName - The file name of where the image will be saved.format - Image format of the output file.java.io.IOExceptionpublic PixelMapping mapPixels(PixelMapMode mapMode)
mapMode - Map modepublic PixelMapping mapPixels(PixelMapMode mapMode, PixelFormat format)
mapMode - Map modeformat - Pixel formatpublic PixelMapping mapPixels(Rect rect, PixelMapMode mapMode, PixelFormat format)
rect - The area of pixels to be accessedmapMode - Map modeformat - Pixel formatpublic void transformPixelFormat(PixelFormat pixelFormat)
pixelFormat - Destination pixel formatjava.lang.UnsupportedOperationException - When the source or destination pixel format is not supported