Class Region
- java.lang.Object
-
- net.coobird.thumbnailator.geometry.Region
-
public final class Region extends java.lang.ObjectA representation of a region, using aPositionobject and aDimensionobject.- Since:
- 0.3.4
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Rectanglecalculate(int outerWidth, int outerHeight, boolean flipHorizontal, boolean flipVertical, boolean swapDimensions)Calculates the position and size of the enclosed region, relative to the enclosing region.PositiongetPosition()Returns the position of the region.SizegetSize()Returns the size of the region.java.lang.StringtoString()Returns aStringrepresentation of this region.
-
-
-
Method Detail
-
getPosition
public Position getPosition()
Returns the position of the region.- Returns:
- Position of the region.
-
getSize
public Size getSize()
Returns the size of the region.- Returns:
- Size of the region.
-
calculate
public java.awt.Rectangle calculate(int outerWidth, int outerHeight, boolean flipHorizontal, boolean flipVertical, boolean swapDimensions)Calculates the position and size of the enclosed region, relative to the enclosing region.The portions of the enclosed region which lies outside the enclosing region are ignored. Effectively, the
Rectanglereturned by this method is an intersection of the enclosing and enclose regions.- Parameters:
outerWidth- Width of the enclosing region.outerHeight- Height of the enclosing region.flipHorizontal- Whether enclosed region should flip horizontally within the enclosing region.flipVertical- Whether enclosed region should flip vertically within the enclosing region.swapDimensions- Whether the components of the point and dimension of the enclosed region should be swapped.- Returns:
- Position and size of the enclosed region.
-
toString
public java.lang.String toString()
Returns aStringrepresentation of this region.- Overrides:
toStringin classjava.lang.Object- Returns:
Stringrepresentation of this region.
-
-