Class ReductionFactor
java.lang.Object
is.galia.image.ReductionFactor
Represents a scale-reduction multiple with a corresponding scale of
(1/2)^rf
. For example, a factor of 0 represents full scale; 1
represents 50% reduction; 2 represents 75% reduction; etc.
This class is mutable, as one of its uses is to be passed to a Decoder
, which may change it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Set to a value that will allow one pixel of leeway in an image up to 99999x99999.int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
double
findDifferentialScale
(double scale) static ReductionFactor
forScale
(double scalePercent) Factory method.static ReductionFactor
forScale
(double scalePercent, double tolerance) Factory method.double
getScale()
int
hashCode()
toString()
-
Field Details
-
DEFAULT_TOLERANCE
public static final double DEFAULT_TOLERANCESet to a value that will allow one pixel of leeway in an image up to 99999x99999.- See Also:
-
factor
public int factor
-
-
Constructor Details
-
ReductionFactor
public ReductionFactor()No-op constructor. -
ReductionFactor
public ReductionFactor(int factor)
-
-
Method Details
-
forScale
Factory method. UsesDEFAULT_TOLERANCE
.- Parameters:
scalePercent
- Scale percentage.- Returns:
- Instance corresponding to the given scale.
-
forScale
Factory method.- Parameters:
scalePercent
- Scale percentage.tolerance
- Leeway that could allow a larger factor to be selected.- Returns:
- Instance corresponding to the given scale. If the
given scale is greater than 1, the factor will be
0
.
-
equals
-
findDifferentialScale
public double findDifferentialScale(double scale) - Parameters:
scale
- Amount to scale an image (or one of its axes).- Returns:
- Amount that the image will need to be scaled relative to the
instance's
factor
.
-
getScale
public double getScale()- Returns:
- Scale corresponding to the instance.
-
hashCode
-
toString
-