Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JSR-927 (Maintenance Release)

javax.tv.media
Class AWTVideoSize

java.lang.Object
  extended byjavax.tv.media.AWTVideoSize

public class AWTVideoSize
extends java.lang.Object

AWTVideoSize is a data holder that represents the position, scaling, and clipping of a JMF Player, as controlled via an AWTVideoSizeControl. All coordinates are expressed in the same coordinate space as AWT components. Because background video might be larger than the addressable AWT area, some of the positions might be negative.

An AWTVideoSize represents a transformation of video where the video is first positioned, then scaled, and then clipped. A rectangle (in the screen's coordinate system) of the source video is translated, scaled and clipped to fit within a rectangle specified in the screen's coordinate system.

See Also:
AWTVideoSizeControl

Constructor Summary
AWTVideoSize(java.awt.Rectangle source, java.awt.Rectangle dest)
          Constructs a new AWTVideoSize instance.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares this AWTVideoSize with the given object for equality.
 java.awt.Rectangle getDestination()
          Return a copy of the rectangle representing where the video is to be displayed, in the coordinate system of the screen.
 java.awt.Rectangle getSource()
          Return a copy of the rectangle representing the portion of the source video to display, in the coordinate system of the screen.
 float getXScale()
          Give the scaling factor applied to the video in the horizontal dimension, i.e., getDestination().width / getSource().width.
 float getYScale()
          Give the scaling factor applied to the video in the vertical dimension, i.e., getDestination().height / getSource().height.
 int hashCode()
          Generates a hash code value for this AWTVideoSize.
 java.lang.String toString()
          Returns a string representation of this AWTVideoSize and its values.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AWTVideoSize

public AWTVideoSize(java.awt.Rectangle source,
                    java.awt.Rectangle dest)
Constructs a new AWTVideoSize instance. This AWTVideoSize represents a transformation where the rectangle source in the source video is scaled and clipped to be within the rectangle dest.

The instance of AWTVideoSize created with this constructor will not maintain a reference to either of the constructor's parameters.

Parameters:
source - The rectangle representing the portion of the source video to display, in the coordinate system of the screen.
dest - The rectangle representing where the video is to be displayed, in the coordinate system of the screen.
Method Detail

getSource

public java.awt.Rectangle getSource()
Return a copy of the rectangle representing the portion of the source video to display, in the coordinate system of the screen.

Returns:
The source Rectangle.

getDestination

public java.awt.Rectangle getDestination()
Return a copy of the rectangle representing where the video is to be displayed, in the coordinate system of the screen.

Returns:
The destination Rectangle.

getXScale

public float getXScale()
Give the scaling factor applied to the video in the horizontal dimension, i.e., getDestination().width / getSource().width.

Returns:
The horizontal scaling factor applied to the video.

getYScale

public float getYScale()
Give the scaling factor applied to the video in the vertical dimension, i.e., getDestination().height / getSource().height.

Returns:
The vertical scaling factor applied to the video.

hashCode

public int hashCode()
Generates a hash code value for this AWTVideoSize. Two AWTVideoSize instances for which AWTVideoSize.equals() is true will have identical hash code values.

Returns:
The hashcode value for this AWTVideoSize.

equals

public boolean equals(java.lang.Object other)
Compares this AWTVideoSize with the given object for equality. Returns true if and only if the given object is also of type AWTVideoSize and contains data members equal to those of this AWTVideoSize.

Parameters:
other - The object with which to test for equality.
Returns:
true if the two AWTVideoSize instances are equal; false otherwise.

toString

public java.lang.String toString()
Returns a string representation of this AWTVideoSize and its values.

Returns:
A string representation of this object.

JSR-927 (Maintenance Release)

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 927 specification.