Class CropByPixels
java.lang.Object
is.galia.operation.Crop
is.galia.operation.CropByPixels
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetRegion(Size reducedSize, ReductionFactor reductionFactor, ScaleConstraint scaleConstraint) Computes an effective crop rectangle in source image coordinates.intgetWidth()intgetX()intgetY()booleanMay produce false positives.booleanhasEffect(Size fullSize, OperationList opList) Context-aware counterpart toOperation.hasEffect().voidsetHeight(int height) voidsetWidth(int width) voidsetX(int x) voidsetY(int y) toString()Methods inherited from class is.galia.operation.Crop
equals, freeze, getRegion, getRegion, getResultingSize, hashCode, toMap, validateMethods 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
-
CropByPixels
public CropByPixels(int x, int y, int width, int height) - Parameters:
x- X origin in the range 0 <= x.y- Y origin in the range 0 <= y.width- Width in the range 0 < width.height- Height in the range 0 < height.- Throws:
IllegalArgumentException- if any of the arguments are invalid.
-
-
Method Details
-
getX
public int getX()- Returns:
- The X origin of the operation, expressed in pixels.
-
getY
public int getY()- Returns:
- The Y origin of the operation, expressed in pixels.
-
getWidth
public int getWidth()- Returns:
- The width of the operation, expressed in pixels.
-
getHeight
public int getHeight()- Returns:
- The height of the operation, expressed in pixels.
-
getRegion
public Region getRegion(Size reducedSize, ReductionFactor reductionFactor, ScaleConstraint scaleConstraint) Description copied from class:CropComputes an effective crop rectangle in source image coordinates.- Specified by:
getRegionin classCrop- Parameters:
reducedSize- Size of the input image, reduced byreductionFactor.reductionFactor- Factor by which the full-sized image has been reduced to becomereducedSize.scaleConstraint- Scale constraint yet to be applied to the input image. The instance is expressed relative to this constraint rather than toreducedSizeor the full image size.- Returns:
- Region relative to the given reduced dimensions.
-
hasEffect
public boolean hasEffect()May produce false positives.hasEffect(Size, OperationList)should be used instead where possible. -
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. -
setX
public void setX(int 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(int 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(int width) - Parameters:
width- Width to set.- Throws:
IllegalArgumentException- if the given width is invalid.IllegalStateException- if the instance is frozen.
-
setHeight
public void setHeight(int height) - Parameters:
height- Height to set.- Throws:
IllegalArgumentException- if the given height is invalid.IllegalStateException- if the instance is frozen.
-
toString
-