Example #1
0
 /**
  * Creates a new DDSImage from data supplied by the user. The resulting DDSImage can be written to
  * disk using the write() method.
  *
  * @param d3dFormat the D3DFMT_ constant describing the data; it is assumed that it is packed
  *     tightly
  * @param width the width in pixels of the topmost mipmap image
  * @param height the height in pixels of the topmost mipmap image
  * @param mipmapData the data for each mipmap level of the resulting DDSImage; either only one
  *     mipmap level should be specified, or they all must be
  * @throws IllegalArgumentException if the data does not match the specified arguments
  * @return DDS image object
  */
 public static DDSImage createFromData(
     int d3dFormat, int width, int height, ByteBuffer[] mipmapData)
     throws IllegalArgumentException {
   DDSImage image = new DDSImage();
   image.initFromData(d3dFormat, width, height, mipmapData);
   return image;
 }
Example #2
0
 /**
  * Reads a DirectDraw surface from the specified ByteBuffer, returning the resulting DDSImage.
  *
  * @param buf Input data
  * @return DDS image object
  * @throws java.io.IOException if an I/O exception occurred
  */
 public static DDSImage read(ByteBuffer buf) throws IOException {
   DDSImage image = new DDSImage();
   image.readFromBuffer(buf);
   return image;
 }
Example #3
0
 /**
  * Reads a DirectDraw surface from the specified file, returning the resulting DDSImage.
  *
  * @param file File object
  * @return DDS image object
  * @throws java.io.IOException if an I/O exception occurred
  */
 public static DDSImage read(File file) throws IOException {
   DDSImage image = new DDSImage();
   image.readFromFile(file);
   return image;
 }