Class SGIImage

java.lang.Object
com.jogamp.opengl.util.texture.spi.SGIImage

public class SGIImage extends Object

Reads and writes SGI RGB/RGBA images.

Written from Paul Bourke's adaptation of the SGI specification.

  • Method Summary

    Modifier and Type
    Method
    Description
    static SGIImage
    createFromData(int width, int height, boolean hasAlpha, byte[] data)
    Creates an SGIImage from the specified data in either RGB or RGBA format.
    byte[]
    Returns the raw data for this texture in the correct (bottom-to-top) order for calls to glTexImage2D.
    int
    Returns the OpenGL format for this texture; e.g.
    int
    Returns the height of the image.
    int
    Returns the width of the image.
    static boolean
    Deprecated.
    rather call ImageType#getFileSuffix(InputStream)
    static SGIImage
    Reads an SGI image from the specified InputStream.
    static SGIImage
    read(String filename)
    Reads an SGI image from the specified file.
     
    void
    write(File file, boolean flipVertically)
    Writes this SGIImage to the specified file.
    void
    write(String filename, boolean flipVertically)
    Writes this SGIImage to the specified file name.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • read

      public static SGIImage read(String filename) throws IOException
      Reads an SGI image from the specified file.
      Throws:
      IOException
    • read

      public static SGIImage read(InputStream in) throws IOException
      Reads an SGI image from the specified InputStream.
      Throws:
      IOException
    • write

      public void write(String filename, boolean flipVertically) throws IOException
      Writes this SGIImage to the specified file name. If flipVertically is set, outputs the scanlines from top to bottom rather than the default bottom to top order.
      Throws:
      IOException
    • write

      public void write(File file, boolean flipVertically) throws IOException
      Writes this SGIImage to the specified file. If flipVertically is set, outputs the scanlines from top to bottom rather than the default bottom to top order.
      Throws:
      IOException
    • createFromData

      public static SGIImage createFromData(int width, int height, boolean hasAlpha, byte[] data)
      Creates an SGIImage from the specified data in either RGB or RGBA format.
    • isSGIImage

      @Deprecated public static boolean isSGIImage(InputStream in) throws IOException
      Deprecated.
      rather call ImageType#getFileSuffix(InputStream)
      Determines from the magic number whether the given InputStream points to an SGI RGB image. The given InputStream must return true from markSupported() and support a minimum of two bytes of read-ahead.
      Throws:
      IOException
    • getWidth

      public int getWidth()
      Returns the width of the image.
    • getHeight

      public int getHeight()
      Returns the height of the image.
    • getFormat

      public int getFormat()
      Returns the OpenGL format for this texture; e.g. GL.GL_RGB or GL.GL_RGBA.
    • getData

      public byte[] getData()
      Returns the raw data for this texture in the correct (bottom-to-top) order for calls to glTexImage2D.
    • toString

      public String toString()
      Overrides:
      toString in class Object