|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.opengl.util.Screenshot
Utilities for taking screenshots of OpenGL applications.
Method Summary | |
static BufferedImage |
readToBufferedImage(int width,
int height)
Takes a screenshot of the current OpenGL drawable to a BufferedImage. |
static BufferedImage |
readToBufferedImage(int width,
int height,
boolean alpha)
Takes a screenshot of the current OpenGL drawable to a BufferedImage. |
static BufferedImage |
readToBufferedImage(int x,
int y,
int width,
int height,
boolean alpha)
Takes a screenshot of the current OpenGL drawable to a BufferedImage. |
static void |
writeToFile(File file,
int width,
int height)
Takes a screenshot of the current OpenGL drawable to the specified file on disk using the ImageIO package. |
static void |
writeToFile(File file,
int width,
int height,
boolean alpha)
Takes a screenshot of the current OpenGL drawable to the specified file on disk using the ImageIO package. |
static void |
writeToFile(File file,
int x,
int y,
int width,
int height,
boolean alpha)
Takes a screenshot of the current OpenGL drawable to the specified file on disk using the ImageIO package. |
static void |
writeToTargaFile(File file,
int width,
int height)
Takes a fast screenshot of the current OpenGL drawable to a Targa file. |
static void |
writeToTargaFile(File file,
int width,
int height,
boolean alpha)
Takes a fast screenshot of the current OpenGL drawable to a Targa file. |
static void |
writeToTargaFile(File file,
int x,
int y,
int width,
int height,
boolean alpha)
Takes a fast screenshot of the current OpenGL drawable to a Targa file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void writeToTargaFile(File file, int width, int height) throws GLException, IOException
No alpha channel is written with this variant.
file
- the file to write containing the screenshotwidth
- the width of the current drawableheight
- the height of the current drawable
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurred
IOException
- if an I/O error occurred while writing the
filepublic static void writeToTargaFile(File file, int width, int height, boolean alpha) throws GLException, IOException
file
- the file to write containing the screenshotwidth
- the width of the current drawableheight
- the height of the current drawablealpha
- whether the alpha channel should be saved. If true,
requires GL_EXT_abgr extension to be present.
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurred
IOException
- if an I/O error occurred while writing the
filepublic static void writeToTargaFile(File file, int x, int y, int width, int height, boolean alpha) throws GLException, IOException
file
- the file to write containing the screenshotx
- the starting x coordinate of the screenshot, measured from the lower-lefty
- the starting y coordinate of the screenshot, measured from the lower-leftwidth
- the width of the desired screenshot areaheight
- the height of the desired screenshot areaalpha
- whether the alpha channel should be saved. If true,
requires GL_EXT_abgr extension to be present.
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurred
IOException
- if an I/O error occurred while writing the
filepublic static BufferedImage readToBufferedImage(int width, int height) throws GLException
No alpha channel is read back with this variant.
width
- the width of the current drawableheight
- the height of the current drawable
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurredpublic static BufferedImage readToBufferedImage(int width, int height, boolean alpha) throws GLException
width
- the width of the current drawableheight
- the height of the current drawablealpha
- whether the alpha channel should be read back. If
true, requires GL_EXT_abgr extension to be present.
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurredpublic static BufferedImage readToBufferedImage(int x, int y, int width, int height, boolean alpha) throws GLException
x
- the starting x coordinate of the screenshot, measured from the lower-lefty
- the starting y coordinate of the screenshot, measured from the lower-leftwidth
- the width of the desired screenshot areaheight
- the height of the desired screenshot areaalpha
- whether the alpha channel should be read back. If
true, requires GL_EXT_abgr extension to be present.
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurredpublic static void writeToFile(File file, int width, int height) throws IOException, GLException
No alpha channel is saved with this variant.
file
- the file to write containing the screenshotwidth
- the width of the current drawableheight
- the height of the current drawable
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurred
IOException
- if an I/O error occurred or if the file could
not be written to disk due to the requested file format being
unsupported by ImageIOpublic static void writeToFile(File file, int width, int height, boolean alpha) throws IOException, GLException
Note that some file formats, in particular JPEG, can not handle an alpha channel properly. If the "alpha" argument is specified as true for such a file format it will be silently ignored.
file
- the file to write containing the screenshotwidth
- the width of the current drawableheight
- the height of the current drawablealpha
- whether an alpha channel should be saved. If true,
requires GL_EXT_abgr extension to be present.
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurred
IOException
- if an I/O error occurred or if the file could
not be written to disk due to the requested file format being
unsupported by ImageIOpublic static void writeToFile(File file, int x, int y, int width, int height, boolean alpha) throws IOException, GLException
Note that some file formats, in particular JPEG, can not handle an alpha channel properly. If the "alpha" argument is specified as true for such a file format it will be silently ignored.
file
- the file to write containing the screenshotx
- the starting x coordinate of the screenshot, measured from the lower-lefty
- the starting y coordinate of the screenshot, measured from the lower-leftwidth
- the width of the current drawableheight
- the height of the current drawablealpha
- whether an alpha channel should be saved. If true,
requires GL_EXT_abgr extension to be present.
GLException
- if an OpenGL context was not current or
another OpenGL-related error occurred
IOException
- if an I/O error occurred or if the file could
not be written to disk due to the requested file format being
unsupported by ImageIO
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |