Package jahuwaldt.j3d.image
Class PNGImageObserver
- java.lang.Object
-
- jahuwaldt.j3d.image.PNGImageObserver
-
- All Implemented Interfaces:
CapturedImageObserver
public class PNGImageObserver extends java.lang.Object implements CapturedImageObserver
An image observer that turns the image into a PNG 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:
- Joseph A. Huwaldt Date: April 16, 2009
-
-
Constructor Summary
Constructors Constructor Description PNGImageObserver()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 voidcanvasImageCaptured(java.awt.image.BufferedImage img)Notification that an image has been captured from the canvas and is ready for processing.booleancaptureNextFrame()Returns a flag indicating if the next frame should be captured or not.voidsetCaptureNextFrame()Tell the observer to capture the next frame it is told about.voidsetFilename(java.lang.String name)Set the filename that this will write to.
-
-
-
Constructor Detail
-
PNGImageObserver
public PNGImageObserver()
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.
-
captureNextFrame
public boolean captureNextFrame()
Returns a flag indicating if the next frame should be captured or not.- Specified by:
captureNextFramein interfaceCapturedImageObserver- Returns:
trueif the observer should be passed an image for the next frame andfalseif 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:
canvasImageCapturedin interfaceCapturedImageObserver- Parameters:
img- The image that was captured- Throws:
java.lang.IllegalStateException- The filename has not been set
-
-