Class AbstractCropAlgorithm

    • Field Detail

      • m_TopLeft

        protected Point m_TopLeft
        the top-left corner.
      • m_BottomRight

        protected Point m_BottomRight
        the bottom-right corner.
    • Constructor Detail

      • AbstractCropAlgorithm

        public AbstractCropAlgorithm()
    • Method Detail

      • check

        protected void check​(BufferedImage img)
        Checks whether the image can be cropped.

        Default implementation only checks whether an image was supplied.
        Parameters:
        img - the image to check
        Throws:
        IllegalStateException - if image fails check
      • preCrop

        protected void preCrop​(BufferedImage img)
        Hook method before the crop happens.

        Default method initializes the top-left and bottom-right corners to image dimensions.
        Parameters:
        img - the image to crop
      • doCrop

        protected abstract BufferedImage doCrop​(BufferedImage img)
        Performs the actual crop.
        Parameters:
        img - the image to crop
        Returns:
        the (potentially) cropped image
      • postCrop

        protected void postCrop​(BufferedImage img)
        Hook method after the crop happened.

        Default method does nothing.
        Parameters:
        img - the cropped
      • getTopLeft

        public Point getTopLeft()
        Returns the top-left coordinates of the cropped image in the original image.
        Specified by:
        getTopLeft in interface CropAlgorithm<BufferedImage>
        Returns:
        the top-left corner
      • getBottomRight

        public Point getBottomRight()
        Returns the bottom-right coordinates of the cropped image in the original image.
        Specified by:
        getBottomRight in interface CropAlgorithm<BufferedImage>
        Returns:
        the bottom-right corner