|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.opengl.util.texture.spi.DDSImage
A reader and writer for DirectDraw Surface (.dds) files, which are used to describe textures. These files can contain multiple mipmap levels in one file. This class is currently minimal and does not support all of the possible file formats.
Nested Class Summary | |
static class |
DDSImage.ImageInfo
Simple class describing images and data; does not encapsulate image format information. |
Field Summary | |
static int |
D3DFMT_A8R8G8B8
|
static int |
D3DFMT_DXT1
|
static int |
D3DFMT_DXT2
|
static int |
D3DFMT_DXT3
|
static int |
D3DFMT_DXT4
|
static int |
D3DFMT_DXT5
|
static int |
D3DFMT_R8G8B8
|
static int |
D3DFMT_UNKNOWN
|
static int |
D3DFMT_X8R8G8B8
|
static int |
DDPF_ALPHA
|
static int |
DDPF_ALPHAPIXELS
|
static int |
DDPF_COMPRESSED
|
static int |
DDPF_FOURCC
|
static int |
DDPF_PALETTEINDEXED1
|
static int |
DDPF_PALETTEINDEXED2
|
static int |
DDPF_PALETTEINDEXED4
|
static int |
DDPF_PALETTEINDEXED8
|
static int |
DDPF_PALETTEINDEXEDTO8
|
static int |
DDPF_RGB
|
static int |
DDPF_RGBTOYUV
|
static int |
DDPF_YUV
|
static int |
DDPF_ZBUFFER
|
static int |
DDPF_ZPIXELS
|
static int |
DDSCAPS_MIPMAP
|
static int |
DDSCAPS_TEXTURE
|
static int |
DDSD_ALPHABITDEPTH
|
static int |
DDSD_BACKBUFFERCOUNT
|
static int |
DDSD_CAPS
|
static int |
DDSD_DEPTH
|
static int |
DDSD_HEIGHT
|
static int |
DDSD_LINEARSIZE
|
static int |
DDSD_LPSURFACE
|
static int |
DDSD_MIPMAPCOUNT
|
static int |
DDSD_PITCH
|
static int |
DDSD_PIXELFORMAT
|
static int |
DDSD_WIDTH
|
static int |
DDSD_ZBUFFERBITDEPTH
|
Method Summary | |
void |
close()
Closes open files and resources associated with the open DDSImage. |
static DDSImage |
createFromData(int d3dFormat,
int width,
int height,
ByteBuffer[] mipmapData)
Creates a new DDSImage from data supplied by the user. |
void |
debugPrint()
|
DDSImage.ImageInfo[] |
getAllMipMaps()
Returns an array of ImageInfos corresponding to all mipmap levels of this DDS file. |
int |
getCompressionFormat()
If this surface is compressed, returns the kind of compression used (DXT1..DXT5). |
static String |
getCompressionFormatName(int compressionFormat)
Converts e.g. |
int |
getDepth()
Total number of bits per pixel. |
int |
getHeight()
Height of the texture (or the top-most mipmap if mipmaps are present) |
DDSImage.ImageInfo |
getMipMap(int map)
Gets the ith mipmap data (0..getNumMipMaps() - 1) |
int |
getNumMipMaps()
Number of mip maps in the texture |
int |
getPixelFormat()
Gets the pixel format of this texture (D3DFMT_*) based on some heuristics. |
int |
getWidth()
Width of the texture (or the top-most mipmap if mipmaps are present) |
boolean |
isCompressed()
Indicates whether this texture is compressed. |
static boolean |
isDDSImage(InputStream in)
Determines from the magic number whether the given InputStream points to a DDS image. |
boolean |
isPixelFormatFlagSet(int flag)
Test for presence/absence of pixel format flags (DDPF_*) |
boolean |
isSurfaceDescFlagSet(int flag)
Test for presence/absence of surface description flags (DDSD_*) |
static DDSImage |
read(ByteBuffer buf)
Reads a DirectDraw surface from the specified ByteBuffer, returning the resulting DDSImage. |
static DDSImage |
read(File file)
Reads a DirectDraw surface from the specified file, returning the resulting DDSImage. |
static DDSImage |
read(String filename)
Reads a DirectDraw surface from the specified file name, returning the resulting DDSImage. |
void |
write(File file)
Writes this DDSImage to the specified file name. |
void |
write(String filename)
Writes this DDSImage to the specified file name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DDSD_CAPS
public static final int DDSD_HEIGHT
public static final int DDSD_WIDTH
public static final int DDSD_PITCH
public static final int DDSD_BACKBUFFERCOUNT
public static final int DDSD_ZBUFFERBITDEPTH
public static final int DDSD_ALPHABITDEPTH
public static final int DDSD_LPSURFACE
public static final int DDSD_PIXELFORMAT
public static final int DDSD_MIPMAPCOUNT
public static final int DDSD_LINEARSIZE
public static final int DDSD_DEPTH
public static final int DDPF_ALPHAPIXELS
public static final int DDPF_ALPHA
public static final int DDPF_FOURCC
public static final int DDPF_PALETTEINDEXED4
public static final int DDPF_PALETTEINDEXEDTO8
public static final int DDPF_PALETTEINDEXED8
public static final int DDPF_RGB
public static final int DDPF_COMPRESSED
public static final int DDPF_RGBTOYUV
public static final int DDPF_YUV
public static final int DDPF_ZBUFFER
public static final int DDPF_PALETTEINDEXED1
public static final int DDPF_PALETTEINDEXED2
public static final int DDPF_ZPIXELS
public static final int DDSCAPS_TEXTURE
public static final int DDSCAPS_MIPMAP
public static final int D3DFMT_UNKNOWN
public static final int D3DFMT_R8G8B8
public static final int D3DFMT_A8R8G8B8
public static final int D3DFMT_X8R8G8B8
public static final int D3DFMT_DXT1
public static final int D3DFMT_DXT2
public static final int D3DFMT_DXT3
public static final int D3DFMT_DXT4
public static final int D3DFMT_DXT5
Method Detail |
public static DDSImage read(String filename) throws IOException
IOException
public static DDSImage read(File file) throws IOException
IOException
public static DDSImage read(ByteBuffer buf) throws IOException
IOException
public void close()
public static DDSImage createFromData(int d3dFormat, int width, int height, ByteBuffer[] mipmapData) throws IllegalArgumentException
d3dFormat
- the D3DFMT_ constant describing the data; it is
assumed that it is packed tightlywidth
- the width in pixels of the topmost mipmap imageheight
- the height in pixels of the topmost mipmap imagemipmapData
- the data for each mipmap level of the resulting
DDSImage; either only one mipmap level should
be specified, or they all must be
IllegalArgumentException
- if the data does not match the
specified argumentspublic static boolean isDDSImage(InputStream in) throws IOException
IOException
public void write(String filename) throws IOException
IOException
public void write(File file) throws IOException
IOException
public boolean isSurfaceDescFlagSet(int flag)
public boolean isPixelFormatFlagSet(int flag)
public int getPixelFormat()
public boolean isCompressed()
public int getCompressionFormat()
public int getWidth()
public int getHeight()
public int getDepth()
public int getNumMipMaps()
public DDSImage.ImageInfo getMipMap(int map)
public DDSImage.ImageInfo[] getAllMipMaps()
public static String getCompressionFormatName(int compressionFormat)
getCompressionFormat()
) into "DXT1".
public void debugPrint()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |