Ejemplo n.º 1
0
  /** Reads an SGI image from the specified InputStream. */
  public static SGIImage read(final InputStream in) throws IOException {
    final DataInputStream dIn = new DataInputStream(new BufferedInputStream(in));

    final Header header = new Header(dIn);
    final SGIImage res = new SGIImage(header);
    res.decodeImage(dIn);
    return res;
  }
Ejemplo n.º 2
0
 /** Creates an SGIImage from the specified data in either RGB or RGBA format. */
 public static SGIImage createFromData(
     final int width, final int height, final boolean hasAlpha, final byte[] data) {
   final Header header = new Header();
   header.xsize = (short) width;
   header.ysize = (short) height;
   header.zsize = (short) (hasAlpha ? 4 : 3);
   final SGIImage image = new SGIImage(header);
   image.data = data;
   return image;
 }