Class CropByPercent

java.lang.Object
is.galia.operation.Crop
is.galia.operation.CropByPercent
All Implemented Interfaces:
Operation

public class CropByPercent extends Crop implements Operation
  • 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.
      Specified by:
      getRegion in class Crop
      Parameters:
      reducedSize - Size of the input image, which has been reduced by reductionFactor.
      reductionFactor - Ignored.
      scaleConstraint - Ignored.
      Returns:
      Region relative to reducedSize.
    • 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.
      Specified by:
      hasEffect in interface Operation
      Specified by:
      hasEffect in class Crop
      Returns:
      Whether the crop is not effectively a no-op.
    • hasEffect

      public boolean hasEffect(Size fullSize, OperationList opList)
      Fulfills the Operation contract, but hasEffect() can be used safely instead.
      Specified by:
      hasEffect in interface Operation
      Specified by:
      hasEffect in class Crop
      Parameters:
      fullSize - Ignored.
      opList - Ignored.
      Returns:
      Whether the crop is not effectively a no-op.
    • 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

      public String toString()
      Overrides:
      toString in class Object