Package digilib.util
Class ImageSize
java.lang.Object
digilib.util.ImageSize
Class for image size (width, height).
A width or height of 0 is treated as a 'wildcard' that matches any size.
- Author:
- casties
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns if the size of this image is the same as the other image.booleanReturns if this image has the same size or height as the other image.floatReturns the aspect ratio.intgetScaled(float scale) Returns a scaled copy of this image size.intgetWidth()booleanReturns if the size of this image is bigger in at least one dimension than the other image.booleanReturns if the size of this image is smaller in at least one dimension than the other image.booleanReturns if the size of this image is bigger in every dimension than the other image.booleanReturns if the size of this image is smaller in every dimension than the other image.voidsetHeight(int height) voidsetSize(int width, int height) voidsetWidth(int width) toString()
-
Field Details
-
width
public int width -
height
public int height
-
-
Constructor Details
-
ImageSize
public ImageSize() -
ImageSize
public ImageSize(int width, int height) -
ImageSize
-
-
Method Details
-
setSize
public void setSize(int width, int height) -
isTotallySmallerThan
Returns if the size of this image is smaller in every dimension than the other image.- Parameters:
is- the ImageSize- Returns:
- is totally smaller
-
isSmallerThan
Returns if the size of this image is smaller in at least one dimension than the other image.- Parameters:
is- the ImageSize- Returns:
- is smaller than
-
isTotallyBiggerThan
Returns if the size of this image is bigger in every dimension than the other image.- Parameters:
is- the ImageSize- Returns:
- is totally bigger than
-
isBiggerThan
Returns if the size of this image is bigger in at least one dimension than the other image.- Parameters:
is- the ImageSize- Returns:
- is bigger than
-
fitsIn
Returns if this image has the same size or height as the other image.- Parameters:
is- the ImageSize- Returns:
- fits in
-
equals
Returns if the size of this image is the same as the other image.- Parameters:
is- the ImageSize- Returns:
- equals
-
getHeight
public int getHeight()- Returns:
- the height
-
setHeight
public void setHeight(int height) - Parameters:
height- the height
-
getWidth
public int getWidth()- Returns:
- the width
-
setWidth
public void setWidth(int width) - Parameters:
width- the width
-
getAspect
public float getAspect()Returns the aspect ratio. Aspect ratio is (width/height). So it's <1 for portrait and >1 for landscape.- Returns:
- the aspect ratio
-
getScaled
Returns a scaled copy of this image size.- Parameters:
scale- the scale- Returns:
- the ImageSize
-
toString
-