Package com.helger.commons.dimension
Class SizeInt
java.lang.Object
com.helger.commons.dimension.SizeInt
- All Implemented Interfaces:
IHasDimensionInt,IHasHeightInt,IHasWidthInt
This class represents an object having width and height.
- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAdded(IHasDimensionInt aToAdd) getBestMatchingSize(int nMaxWidth, int nMaxHeight) Return the scaled width and height relative to a maximum size.intgetScaledToHeight(int nNewHeight) getScaledToWidth(int nNewWidth) getSubtracted(IHasDimensionInt aToSubtract) intgetWidth()inthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.dimension.IHasDimensionInt
isLandscape, isPortrait, isQuadratic
-
Constructor Details
-
SizeInt
-
SizeInt
-
-
Method Details
-
getWidth
- Specified by:
getWidthin interfaceIHasWidthInt- Returns:
- The width of an object
-
getHeight
- Specified by:
getHeightin interfaceIHasHeightInt- Returns:
- The height of an object
-
getBestMatchingSize
@Nonnull @CheckReturnValue public SizeInt getBestMatchingSize(@Nonnegative int nMaxWidth, @Nonnegative int nMaxHeight) Return the scaled width and height relative to a maximum size.- Parameters:
nMaxWidth- Maximum width. Must be > 0.nMaxHeight- Maximum height. Must be > 0.- Returns:
- An array with 2 elements, where the first element is the width, and the second is the height.
-
getScaledToWidth
-
getScaledToHeight
-
getAdded
-
getSubtracted
-
equals
-
hashCode
public int hashCode() -
toString
-