Class FitTo
Object
AnchorBean<ScaleCalculator>
InitializableBean<ScaleCalculator, ImageInitialization>
ImageBean<ScaleCalculator>
ScaleCalculator
FitTo
public class FitTo
extends ScaleCalculator
Scales an image to approximately similar in size to a
SizeXY.
Optionally, the aspect-ratio is preserved between width and height.
Optionally, the eventual width, and height can be rounded to the nearest whole multiple of an integer.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionScaleFactorintThe eventual width and height of the image must be a multiple of this number.SizeXYThe target size.booleanIf true, the aspect-ratio is preserved between width and height.voidsetMultipleOf(int multipleOf) The eventual width and height of the image must be a multiple of this number.voidsetPreserveAspectRatio(boolean preserveAspectRatio) If true, the aspect-ratio is preserved between width and height.voidsetTargetSize(SizeXY targetSize) The target size.Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitializationMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
FitTo
public FitTo()
-
-
Method Details
-
calculate
-
getTargetSize
public SizeXY getTargetSize()The target size. The image will be scaled to be as similar to this as possible, preserving aspect ratio. -
setTargetSize
public void setTargetSize(SizeXY targetSize) The target size. The image will be scaled to be as similar to this as possible, preserving aspect ratio. -
isPreserveAspectRatio
public boolean isPreserveAspectRatio()If true, the aspect-ratio is preserved between width and height. Otherwise, they are treated independently. -
setPreserveAspectRatio
public void setPreserveAspectRatio(boolean preserveAspectRatio) If true, the aspect-ratio is preserved between width and height. Otherwise, they are treated independently. -
getMultipleOf
public int getMultipleOf()The eventual width and height of the image must be a multiple of this number. Effecitvely disabled when== 1 -
setMultipleOf
public void setMultipleOf(int multipleOf) The eventual width and height of the image must be a multiple of this number. Effecitvely disabled when== 1
-