ptolemy.actor.lib.jmf
Class JMFImageToken

java.lang.Object
  extended by ptolemy.data.Token
      extended by ptolemy.data.ImageToken
          extended by ptolemy.actor.lib.jmf.JMFImageToken
All Implemented Interfaces:
java.io.Serializable

public class JMFImageToken
extends ImageToken

A token that contains a javax.media.Buffer. This token is used when dealing with images in the Java Media Framework (JMF) library. Because it extends ImageToken, it can be used with the standard image processing tools by simply casting it, and calling asAWTImage().

Since:
Ptolemy II 3.0
Version:
$Id: JMFImageToken.java 57040 2010-01-27 20:52:32Z cxh $
Author:
James Yeh
See Also:
Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Field Summary
private  java.awt.Image _awtImage
           
private static javax.media.util.BufferToImage _bufferToImage
           
private  javax.media.Buffer _value
           
private  javax.media.format.VideoFormat _videoFormat
           
 
Fields inherited from class ptolemy.data.Token
NIL
 
Constructor Summary
JMFImageToken(javax.media.Buffer value)
          Construct a token with a specified Buffer.
 
Method Summary
 java.awt.Image asAWTImage()
          Convert a javax.media.Buffer to a java.awt.Image and return it.
 Type getType()
          Return the type of this token.
 javax.media.Buffer getValue()
          Return the value of this token.
 java.lang.String toString()
          Return a description of the token.
 
Methods inherited from class ptolemy.data.Token
add, addReverse, divide, divideReverse, isCloseTo, isCloseTo, isEqualTo, isNil, modulo, moduloReverse, multiply, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, subtract, subtractReverse, zero, zeroReturnType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_value

private javax.media.Buffer _value

_bufferToImage

private static javax.media.util.BufferToImage _bufferToImage

_videoFormat

private javax.media.format.VideoFormat _videoFormat

_awtImage

private java.awt.Image _awtImage
Constructor Detail

JMFImageToken

public JMFImageToken(javax.media.Buffer value)
Construct a token with a specified Buffer.

Parameters:
value - The buffer.
Method Detail

asAWTImage

public java.awt.Image asAWTImage()
Convert a javax.media.Buffer to a java.awt.Image and return it. A new javax.media.util.BufferToImage is created when the video format of the Buffer changes.

Specified by:
asAWTImage in class ImageToken
Returns:
The image.

getType

public Type getType()
Return the type of this token.

Overrides:
getType in class Token
Returns:
BaseType.OBJECT

getValue

public javax.media.Buffer getValue()
Return the value of this token.

Returns:
The value of this token.

toString

public java.lang.String toString()
Return a description of the token. If possible, derived classes should override this method and return the value of this token as a string that can be parsed by the expression language to recover a token with the same value. Unfortunately, in this base class, we can only return the a partial description of the token.

Overrides:
toString in class Token
Returns:
A string representation of a record that partially describes the token.