Class CropByPercent
java.lang.Object
is.galia.operation.Crop
is.galia.operation.CropByPercent
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a no-op "100% crop" instance.CropByPercent
(double x, double y, double width, double height) -
Method Summary
Modifier and TypeMethodDescriptiondouble
getRegion
(Size reducedSize, ReductionFactor reductionFactor, ScaleConstraint scaleConstraint) Computes an effective crop rectangle in source image coordinates.double
getWidth()
double
getX()
double
getY()
boolean
This method may produce false positives.boolean
hasEffect
(Size fullSize, OperationList opList) Fulfills theOperation
contract, buthasEffect()
can be used safely instead.void
setHeight
(double height) void
setWidth
(double width) void
setX
(double x) void
setY
(double y) toString()
Methods inherited from class is.galia.operation.Crop
equals, freeze, getRegion, getRegion, getResultingSize, hashCode, toMap, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface is.galia.operation.Operation
freeze, getResultingSize, toMap, validate
-
Constructor Details
-
CropByPercent
public CropByPercent()Creates a no-op "100% crop" instance. -
CropByPercent
public CropByPercent(double x, double y, double width, double height) - Parameters:
x
- X origin in the range 0 <= x < 1.y
- Y origin in the range 0 <= y < 1.width
- Width in the range 0 < width <= 1.height
- Height in the range 0 < height <= 1.- Throws:
IllegalArgumentException
- if any of the arguments are invalid.
-
-
Method Details
-
getX
public double getX()- Returns:
- The X origin of the operation, expressed in percent.
-
getY
public double getY()- Returns:
- The Y origin of the operation, expressed in percent.
-
getWidth
public double getWidth()- Returns:
- The width of the operation, expressed in percent.
-
getHeight
public double getHeight()- Returns:
- The height of the operation, expressed in percent.
-
getRegion
public Region getRegion(Size reducedSize, ReductionFactor reductionFactor, ScaleConstraint scaleConstraint) Description copied from class:Crop
Computes an effective crop rectangle in source image coordinates. -
hasEffect
public boolean hasEffect()Description copied from class:Crop
This method may produce false positives.Crop.hasEffect(Size, OperationList)
should be used instead where possible, unless overrides mention otherwise. -
hasEffect
Fulfills theOperation
contract, buthasEffect()
can be used safely instead. -
setX
public void setX(double x) - Parameters:
x
- X coordinate to set.- Throws:
IllegalArgumentException
- If the given X coordinate is invalid.IllegalStateException
- If the instance is frozen.
-
setY
public void setY(double y) - Parameters:
y
- Y coordinate to set.- Throws:
IllegalArgumentException
- If the given Y coordinate is invalid.IllegalStateException
- If the instance is frozen.
-
setWidth
public void setWidth(double width) - Parameters:
width
- Width to set.- Throws:
IllegalArgumentException
- if the given width is invalid.IllegalStateException
- if the instance is frozen.
-
setHeight
public void setHeight(double height) - Parameters:
height
- Height to set.- Throws:
IllegalArgumentException
- if the given height is invalid.IllegalStateException
- if the instance is frozen.
-
toString
-