Class CropByPixels

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

public class CropByPixels extends Crop implements Operation
  • 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: Crop
      Computes an effective crop rectangle in source image coordinates.
      Specified by:
      getRegion in class Crop
      Parameters:
      reducedSize - Size of the input image, reduced by reductionFactor.
      reductionFactor - Factor by which the full-sized image has been reduced to become reducedSize.
      scaleConstraint - Scale constraint yet to be applied to the input image. The instance is expressed relative to this constraint rather than to reducedSize or 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.
      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)
      Description copied from interface: Operation
      Context-aware counterpart to Operation.hasEffect(). For example, a scale operation specifying a scale to 300×200, when the given operation list contains a crop of 300×200, would return false.
      Specified by:
      hasEffect in interface Operation
      Specified by:
      hasEffect in class Crop
      Parameters:
      fullSize - Full size of the source image.
      opList - Operation list of which the operation may or may not be a member.
      Returns:
      Whether the crop is not effectively a no-op.
    • 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

      public String toString()
      Overrides:
      toString in class Object