Package com.helger.commons.dimension
Class SizeInt
- java.lang.Object
-
- com.helger.commons.dimension.SizeInt
-
- All Implemented Interfaces:
IHasDimensionInt,IHasHeightInt,IHasWidthInt
@Immutable public class SizeInt extends Object implements IHasDimensionInt
This class represents an object having width and height.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description SizeInt(int nWidth, int nHeight)SizeInt(IHasDimensionInt aObj)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)SizeIntgetAdded(IHasDimensionInt aToAdd)SizeIntgetBestMatchingSize(int nMaxWidth, int nMaxHeight)Return the scaled width and height relative to a maximum size.intgetHeight()SizeIntgetScaledToHeight(int nNewHeight)SizeIntgetScaledToWidth(int nNewWidth)SizeIntgetSubtracted(IHasDimensionInt aToSubtract)intgetWidth()inthashCode()StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.dimension.IHasDimensionInt
isLandscape, isPortrait, isQuadratic
-
-
-
-
Constructor Detail
-
SizeInt
public SizeInt(@Nonnull IHasDimensionInt aObj)
-
SizeInt
public SizeInt(@Nonnegative int nWidth, @Nonnegative int nHeight)
-
-
Method Detail
-
getWidth
@Nonnegative public int getWidth()
- Specified by:
getWidthin interfaceIHasWidthInt- Returns:
- The width of an object
-
getHeight
@Nonnegative public int 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
@Nonnull @CheckReturnValue public SizeInt getScaledToWidth(@Nonnegative int nNewWidth)
-
getScaledToHeight
@Nonnull @CheckReturnValue public SizeInt getScaledToHeight(@Nonnegative int nNewHeight)
-
getAdded
@Nonnull @CheckReturnValue public SizeInt getAdded(@Nonnull IHasDimensionInt aToAdd)
-
getSubtracted
@Nonnull @CheckReturnValue public SizeInt getSubtracted(@Nonnull IHasDimensionInt aToSubtract)
-
-