Class ScaleByPixels
java.lang.Object
is.galia.operation.Scale
is.galia.operation.ScaleByPixels
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class is.galia.operation.Scale
Scale.Filter -
Constructor Summary
ConstructorsConstructorDescriptionNo-op constructor.ScaleByPixels(Integer width, Integer height, ScaleByPixels.Mode mode) -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis should not be used when figuring out how to apply an instance to an image.getMode()getReductionFactor(Size reducedSize, ScaleConstraint scaleConstraint, int maxFactor) double[]getResultingScales(Size fullSize, ScaleConstraint scaleConstraint) getResultingSize(Size imageSize, ReductionFactor reductionFactor, ScaleConstraint scaleConstraint) getWidth()This should not be used when figuring out how to apply an instance to an image.booleanSimpler but less-accurate counterpart ofOperation.hasEffect(Size, OperationList).booleanhasEffect(Size fullSize, OperationList opList) Context-aware counterpart toOperation.hasEffect().inthashCode()voidvoidsetMode(ScaleByPixels.Mode scaleMode) voidtoString()Returns a string representation of the instance, guaranteed to uniquely represent the instance.Methods inherited from class is.galia.operation.Scale
freeze, getFilter, getResultingSize, isHeightUp, isLinear, isUp, isWidthUp, setFilter, setLinear, toMapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface is.galia.operation.Operation
freeze, getResultingSize, toMap, validate
-
Constructor Details
-
ScaleByPixels
public ScaleByPixels()No-op constructor. -
ScaleByPixels
- Parameters:
width- May benullif mode isScaleByPixels.Mode.ASPECT_FIT_HEIGHT.height- May benullif mode isScaleByPixels.Mode.ASPECT_FIT_WIDTH.mode- Scale mode.
-
-
Method Details
-
equals
-
getHeight
This should not be used when figuring out how to apply an instance to an image. For that,getResultingSize(is.galia.image.Size, is.galia.image.ReductionFactor, is.galia.image.ScaleConstraint)andgetResultingScales(is.galia.image.Size, is.galia.image.ScaleConstraint)should be used instead.- Returns:
- Absolute pixel height. May be
null.
-
getMode
-
getReductionFactor
public ReductionFactor getReductionFactor(Size reducedSize, ScaleConstraint scaleConstraint, int maxFactor) - Specified by:
getReductionFactorin classScale- Parameters:
reducedSize- Size of an image that has been halved n times.scaleConstraint- Ignored.maxFactor- Maximum factor to return.- Returns:
- Reduction factor appropriate for the instance.
-
getResultingScales
- Specified by:
getResultingScalesin classScale- Parameters:
fullSize- Full source image dimensions.scaleConstraint- Scale constraint relative to the full source image dimensions. The instance is expressed relative to the constrainedfullSize.- Returns:
- Two-element array containing the resulting X and Y scales when the instance is applied to the given full size.
-
getResultingSize
public Size getResultingSize(Size imageSize, ReductionFactor reductionFactor, ScaleConstraint scaleConstraint) - Specified by:
getResultingSizein classScale- Parameters:
imageSize- Image whose dimensions have been halvedReductionFactor.factortimes.reductionFactor- Number of times the given dimensions have been halved.scaleConstraint- Scale constraint relative to the full source image dimensions.- Returns:
- Resulting dimensions when the scale is applied to the constrained view of the given full size.
-
getWidth
This should not be used when figuring out how to apply an instance to an image. For that,getResultingSize(is.galia.image.Size, is.galia.image.ReductionFactor, is.galia.image.ScaleConstraint)andgetResultingScales(is.galia.image.Size, is.galia.image.ScaleConstraint)should be used instead.- Returns:
- Absolute pixel width. May be
null.
-
hasEffect
public boolean hasEffect()Description copied from interface:OperationSimpler but less-accurate counterpart ofOperation.hasEffect(Size, OperationList). -
hasEffect
Description copied from interface:OperationContext-aware counterpart toOperation.hasEffect(). For example, a scale operation specifying a scale to 300×200, when the given operation list contains a crop of 300×200, would returnfalse.- Specified by:
hasEffectin interfaceOperation- Parameters:
fullSize- Full size of the source image.opList- Operation list of which the operation may or may not be a member.- Returns:
- Whether applying the operation in the context of the given full size and operation list would result in a changed image.
-
hashCode
-
setHeight
- Parameters:
height- Integer greater than 0. May benull.- Throws:
IllegalArgumentException- if the given height is invalid.IllegalStateException- if the instance is frozen.
-
setMode
- Parameters:
scaleMode- Scale mode to set.- Throws:
IllegalStateException- If the instance is frozen.
-
setWidth
- Parameters:
width- Integer greater than 0. May benull.- Throws:
IllegalArgumentException- If the given width is invalid.IllegalStateException- If the instance is frozen.
-
toString
-