org.xith3d.utility.screenshots
Class ScreenshotCreator

java.lang.Object
  extended by org.xith3d.utility.screenshots.ScreenshotCreator
All Implemented Interfaces:
java.lang.Runnable

public class ScreenshotCreator
extends java.lang.Object
implements java.lang.Runnable

This class creates a screenshot image from the frame buffer's content.


Nested Class Summary
static class ScreenshotCreator.Format
          This format indicates if the resulting image will have an alpha channel
 
Constructor Summary
ScreenshotCreator(int width, int height, ScreenshotCreator.Format format)
          Starts a new Thread that waits until the time is right to create a new screenshot.
ScreenshotCreator(int width, int height, ScreenshotCreator.Format format, java.io.File targetFile)
          Starts a new Thread that waits until the time is right to create a new screenshot.
 
Method Summary
 java.awt.image.BufferedImage createScreenshot()
          Creates a screenshot from a ByteBuffer
 void createScreenshot(java.io.File targetFile)
          Creates a screenshot from a ByteBuffer (asynchronously)
 java.nio.ByteBuffer getBuffer()
           
 ScreenshotCreator.Format getFormat()
           
 int getGLFormat()
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenshotCreator

public ScreenshotCreator(int width,
                         int height,
                         ScreenshotCreator.Format format,
                         java.io.File targetFile)
Starts a new Thread that waits until the time is right to create a new screenshot.

Parameters:
width - the image's width
height - the image's height
format - RGB or RGBA
targetFile - the file to save the shot to

ScreenshotCreator

public ScreenshotCreator(int width,
                         int height,
                         ScreenshotCreator.Format format)
Starts a new Thread that waits until the time is right to create a new screenshot.

Parameters:
width - the image's width
height - the image's height
format - RGB or RGBA
Method Detail

getFormat

public ScreenshotCreator.Format getFormat()
Returns:
the image-format

getGLFormat

public int getGLFormat()
Returns:
the OpenGL-image-format

getBuffer

public java.nio.ByteBuffer getBuffer()
Returns:
the ByteBuffer to use for FrameBuffer capture

run

public void run()
Specified by:
run in interface java.lang.Runnable

createScreenshot

public java.awt.image.BufferedImage createScreenshot()
Creates a screenshot from a ByteBuffer


createScreenshot

public void createScreenshot(java.io.File targetFile)
Creates a screenshot from a ByteBuffer (asynchronously)

Parameters:
targetFile - the file to save the shot to