Class ImageToBuffer


public class ImageToBuffer
extends java.lang.Object

Utility class to convert an AWT Image object to a JMF Buffer object. The output buffer will contain the image data in an array of ints in the default ColorModel of the AWT toolkit. The getFormat method on the returned buffer will contain the exact format that the data is in, including the RGB mask values.

Constructor Summary
Method Summary
static Buffer createBuffer(java.awt.Image image, float frameRate)
          Creates a JMF Buffer object for the given AWT Image and frameRate.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ImageToBuffer()
Method Detail


public static Buffer createBuffer(java.awt.Image image,
                                  float frameRate)
Creates a JMF Buffer object for the given AWT Image and frameRate. If the frameRate parameter of the output format is not relevant to your needs, then any value can be specified as the frameRate. If you are generating live video data that is to be presented by JMF, then you should specify a reasonable value between 1 and 60 for the frameRate.

The output buffer will have unspecified values for the flags, sequenceNumber, header and timeStamp fields. Only the format, data, offset and length will contain valid values.

image - an AWT Image that is fully prepared and has a known size.
frameRate - the frameRate at which these buffer objects are being generated.
a JMF Buffer object that contains the image data in RGB format, or null if the image could not be converted succesfully.

Submit a bug or feature
Copyright 1999-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved. See the Specification License for more details.
Sun, Sun Microsystems, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.