Class ConstantScaleFactor
Scale X and Y dimension by a constant floating-point number.
e.g. Applying 0.5 to an image of size (width=50, height=10) would produce a scaled image with (width=25, height=5).
The constant floating-point number is equal across both dimensions.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionConstantScaleFactor
(double value) Creates a newConstantScaleFactor
instance. -
Method Summary
Modifier and TypeMethodDescriptioncalculate
(Optional<Dimensions> dimensionsToBeScaled, Optional<ImageSizeSuggestion> suggestedSize) Calculates a scaling-factor for a source image/entity of particular dimensions.double
getValue()
The constant floating-point value to scale each dimension by.void
setValue
(double value) The constant floating-point value to scale each dimension by.Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitialization
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
ConstantScaleFactor
public ConstantScaleFactor() -
ConstantScaleFactor
public ConstantScaleFactor(double value) Creates a newConstantScaleFactor
instance.- Parameters:
value
- The constant floating-point value to scale each dimension by.
-
-
Method Details
-
calculate
public ScaleFactor calculate(Optional<Dimensions> dimensionsToBeScaled, Optional<ImageSizeSuggestion> suggestedSize) throws OperationFailedException Description copied from class:ScaleCalculator
Calculates a scaling-factor for a source image/entity of particular dimensions.- Specified by:
calculate
in classScaleCalculator
- Parameters:
dimensionsToBeScaled
- dimensions of the source image/entity that will be scaled, if they are known.suggestedSize
- a string suggesting dimensions to resize to or a scaling-factor.- Returns:
- the scaling-factor to use.
- Throws:
OperationFailedException
- if a scale-factor cannot be successfully calculated.
-
getValue
public double getValue()The constant floating-point value to scale each dimension by. -
setValue
public void setValue(double value) The constant floating-point value to scale each dimension by.
-