|
Eclipse Draw2d 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.draw2d.geometry.Dimension
Stores an integer width and height. This class provides various methods for manipulating this Dimension or creating new derived Objects.
Field Summary | |
int |
height
The height. |
int |
width
The width. |
Constructor Summary | |
Dimension()
Constructs a Dimension of zero width and height. |
|
Dimension(Dimension d)
Constructs a Dimension with the width and height of the passed Dimension. |
|
Dimension(Image image)
Constructs a Dimension with the width and height of the Image supplied as input. |
|
Dimension(int w,
int h)
Constructs a Dimension with the supplied width and height values. |
|
Dimension(Point pt)
Constructs a Dimension where the width and height are the x and y distances of the input point from the origin. |
Method Summary | |
boolean |
contains(Dimension d)
Returns whether the input Dimension fits into this Dimension. |
boolean |
containsProper(Dimension d)
Returns true if this Dimension properly contains the one specified. |
boolean |
equals(int w,
int h)
Returns whether this Dimension's width and height are equal to the given width and height. |
boolean |
equals(Object o)
Returns whether the input Object is equivalent to this Dimension. |
Dimension |
expand(Dimension d)
Expands the size of this Dimension by the specified amount. |
Dimension |
expand(int w,
int h)
Expands the size of this Dimension by the specified width and height. |
Dimension |
expand(Point pt)
Expands the size of this Dimension by the specified amound. |
int |
getArea()
Returns the area of this Dimension. |
Dimension |
getCopy()
Creates a copy. |
Dimension |
getDifference(Dimension d)
Creates a new Dimension representing the difference between this Dimension and the one specified. |
Dimension |
getExpanded(Dimension d)
Creates a Dimension representing the sum of this Dimension and the one specified. |
Dimension |
getExpanded(int w,
int h)
Creates a new Dimension representing the sum of this Dimension and the one specified. |
Dimension |
getIntersected(Dimension d)
Creates a new Dimension representing the intersection of this Dimension and the one specified. |
Dimension |
getNegated()
Creates a new Dimension with negated values. |
Dimension |
getScaled(double amount)
Creates a new Dimension with its width and height scaled by the specified value. |
Dimension |
getTransposed()
Creates a new Dimension with its height and width swapped. |
Dimension |
getUnioned(Dimension d)
Creates a new Dimension representing the union of this Dimension with the one specified. |
Dimension |
intersect(Dimension d)
This Dimension is intersected with the one specified. |
boolean |
isEmpty()
Returns whether the Dimension has width or height greater than 0. |
Dimension |
negate()
Negates this Dimension |
void |
performScale(double factor)
Scales this object by the scale factor. |
void |
performTranslate(int dx,
int dy)
Translates this object horizontally by dx and vertically by
dy . |
Dimension |
scale(double amount)
Scales the width and height of this Dimension by the amount supplied, and returns this for convenience. |
Dimension |
scale(double w,
double h)
Scales the width of this Dimension by w and scales the height of this Dimension by h. |
void |
setSize(Dimension d)
Copies the width and height values of the input Dimension to this Dimension. |
Dimension |
shrink(int w,
int h)
Reduces the width of this Dimension by w, and reduces the height of this Dimension by h. |
String |
toString()
|
Dimension |
transpose()
Swaps the width and height of this Dimension, and returns this for convenience. |
Dimension |
union(Dimension d)
Sets the width of this Dimension to the greater of this Dimension's width and d.width. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int width
public int height
Constructor Detail |
public Dimension()
public Dimension(Dimension d)
d
- Dimension supplying the initial values.public Dimension(Point pt)
pt
- Point supplying the initial values.public Dimension(int w, int h)
w
- Width of the Dimension.h
- Height of the Dimension.public Dimension(Image image)
image
- SWT Image
supplying the dimensions.Image
Method Detail |
public boolean contains(Dimension d)
d
- Dimension being tested.
boolean
specifying the result of the fit test.public boolean containsProper(Dimension d)
d
- Dimension being tested.
true
if this Dimension properly contains the one specifiedpublic void setSize(Dimension d)
d
- Dimension supplying the values.public int getArea()
public Dimension getCopy()
public Dimension getDifference(Dimension d)
d
- Dimension being compared
public Dimension getExpanded(Dimension d)
d
- Dimension providing the expansion width and height.
getDifference(Dimension)
public Dimension getExpanded(int w, int h)
w
- Value by which the width of this is to be expanded.h
- Value by which the height of this is to be expanded.
getDifference(Dimension)
public Dimension getIntersected(Dimension d)
d
- The Dimension to intersect with
intersect(Dimension)
public Dimension getNegated()
public boolean equals(Object o)
equals
in class Object
o
- Object being tested for equality.
public boolean equals(int w, int h)
w
- widthh
- height
public Dimension expand(Dimension d)
d
- Dimension providing the expansion width and height.
this
for convenienceshrink(int, int)
public Dimension expand(Point pt)
pt
- Point supplying the dimensional values.
this
for conveniencepublic Dimension expand(int w, int h)
w
- Value by which the width should be increased.h
- Value by which the height should be increased.
this
for conveniencepublic Dimension getScaled(double amount)
amount
- Value by which the width and height are scaled.
public Dimension getTransposed()
public Dimension getUnioned(Dimension d)
d
- Dimension to be unioned.
public Dimension intersect(Dimension d)
d
- The Dimension used to perform the Min().
this
for conveniencepublic boolean isEmpty()
boolean containing the emptiness test.- Since:
- 2.0
public Dimension negate()
public void performScale(double factor)
Translatable
performScale
in interface Translatable
factor
- The scale factorTranslatable.performScale(double)
public void performTranslate(int dx, int dy)
Translatable
dx
and vertically by
dy
.
performTranslate
in interface Translatable
dx
- The amount to translate horizontallydy
- The amount to translate verticallyTranslatable.performTranslate(int, int)
public Dimension scale(double amount)
amount
- Value by which this Dimension's width and
height are to be scaled.
public Dimension scale(double w, double h)
w
- Value by which the width is to be scaled.h
- Value by which the height is to be scaled.
public Dimension shrink(int w, int h)
w
- Value by which the width is to be reduced.h
- Value by which the height is to be reduced.
public String toString()
toString
in class Object
public Dimension transpose()
public Dimension union(Dimension d)
d
- Dimension to union with this Dimension.
|
Eclipse Draw2d 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |