org.icepdf.core.pobjects
Class PDimension

java.lang.Object
  extended by org.icepdf.core.pobjects.PDimension

public class PDimension
extends java.lang.Object

This class represents a dimension similar to java.awt.geom.Dimension2D.Dimension but ensures that width and height are stored using floating point values.

Since:
2.0

Constructor Summary
PDimension(float w, float h)
          Creates a new instance of a PDimension.
PDimension(int w, int h)
          Creates a new instance of a PDimension.
 
Method Summary
 float getHeight()
          Gets the height of the dimension object.
 float getWidth()
          Gets the width of the dimension object.
 void set(float w, float h)
          Sets the width and height of the dimension.
 void set(int w, int h)
          Sets the width and height of the dimension.
 java.awt.Dimension toDimension()
          Converts this object to a java.awt.geom.Dimension2D.Dimension.
 java.lang.String toString()
          String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDimension

public PDimension(float w,
                  float h)
Creates a new instance of a PDimension.

Parameters:
w - width of new dimension.
h - height of new dimension.

PDimension

public PDimension(int w,
                  int h)
Creates a new instance of a PDimension.

Parameters:
w - width of new dimension.
h - height of new dimension.
Method Detail

set

public void set(float w,
                float h)
Sets the width and height of the dimension.

Parameters:
w - new width value.
h - new height value.

set

public void set(int w,
                int h)
Sets the width and height of the dimension.

Parameters:
w - new width value.
h - new height value.

getWidth

public float getWidth()
Gets the width of the dimension object.

Returns:
width

getHeight

public float getHeight()
Gets the height of the dimension object.

Returns:
height

toDimension

public java.awt.Dimension toDimension()
Converts this object to a java.awt.geom.Dimension2D.Dimension. The floating point accuracy of the width and height are lost when converted to int.

Returns:
a new java.awt.geom.Dimension2D.Dimension

toString

public java.lang.String toString()
String representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
string summary of width and height of this object.