Package jahuwaldt.j3d.image
Class JPEGImageObserver
- java.lang.Object
-
- jahuwaldt.j3d.image.JPEGImageObserver
-
- All Implemented Interfaces:
CapturedImageObserver
public class JPEGImageObserver extends java.lang.Object implements CapturedImageObserver
An image observer that turns the image into a JPEG image.If the filename already exists, it will automatically overwrite the existing image. If the filename contains non-existent intermediate directories, these will be automatically created.
Modified by: Joseph A.Huwaldt
- Version:
- February 17, 2014
- Author:
- Justin Couch
-
-
Constructor Summary
Constructors Constructor Description JPEGImageObserver()
Construct a default observer with no filename set and it has not yet captured an image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
canvasImageCaptured(java.awt.image.BufferedImage img)
Notification that an image has been captured from the canvas and is ready for processing.boolean
captureNextFrame()
Returns a flag indicating if the next frame should be captured or not.void
setCaptureNextFrame()
Tell the observer to capture the next frame it is told about.void
setFilename(java.lang.String name)
Set the filename that this will write to.
-
-
-
Constructor Detail
-
JPEGImageObserver
public JPEGImageObserver()
Construct a default observer with no filename set and it has not yet captured an image.
-
-
Method Detail
-
setCaptureNextFrame
public void setCaptureNextFrame()
Tell the observer to capture the next frame it is told about. If the observer has already fired, it will throw an IllegalStateException.
-
captureNextFrame
public boolean captureNextFrame()
Returns a flag indicating if the next frame should be captured or not.- Specified by:
captureNextFrame
in interfaceCapturedImageObserver
- Returns:
true
if the observer should be passed an image for the next frame andfalse
if it should not.
-
setFilename
public void setFilename(java.lang.String name) throws java.lang.IllegalStateException
Set the filename that this will write to. If the filename is null, this will remove the previously set name. It can only be set if the image has not yet been captured.- Parameters:
name
- The name of the file to write to.- Throws:
java.lang.IllegalStateException
-
canvasImageCaptured
public void canvasImageCaptured(java.awt.image.BufferedImage img)
Notification that an image has been captured from the canvas and is ready for processing. If the filename has not been set then this will throw an exception.- Specified by:
canvasImageCaptured
in interfaceCapturedImageObserver
- Parameters:
img
- The image that was captured- Throws:
java.lang.IllegalStateException
- The filename has not been set
-
-