com.sun.opengl.util

Class 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.

Constructor Details

TGAWriter

public TGAWriter()
Constructor for the TGAWriter.

Method Details

close

public void close()
            throws IOException

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().

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.

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