com.sun.opengl.util
Class TGAWriter

java.lang.Object
  extended bycom.sun.opengl.util.TGAWriter

public class TGAWriter
extends Object

Utility class which helps take fast screenshots of OpenGL rendering results into Targa-format files. Used by the Screenshot class; can also be used in conjunction with the TileRenderer class.


Constructor Summary
TGAWriter()
          Constructor for the TGAWriter.
 
Method Summary
 void close()
           
 ByteBuffer getImageData()
          Returns the ByteBuffer corresponding to the data for the image.
 void open(File file, int width, int height, boolean alpha)
          Opens the specified Targa file for writing, overwriting any existing file, and sets up the header of the file expecting the data to be filled in before closing it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TGAWriter

public TGAWriter()
Constructor for the TGAWriter.

Method Detail

open

public void open(File file,
                 int width,
                 int height,
                 boolean alpha)
          throws IOException
Opens the specified Targa file for writing, overwriting any existing file, and sets up the header of the file expecting the data to be filled in before closing it.

Parameters:
file - the file to write containing the screenshot
width - the width of the current drawable
height - the height of the current drawable
alpha - whether the alpha channel should be saved. If true, requires GL_EXT_abgr extension to be present.
Throws:
IOException - if an I/O error occurred while writing the file

getImageData

public ByteBuffer getImageData()
Returns the ByteBuffer corresponding to the data for the image. This must be filled in with data in either BGR or BGRA format depending on whether an alpha channel was specified during open().


close

public void close()
           throws IOException
Throws:
IOException


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.