Class RelativeCrop

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, SizeOfHandler, CropAlgorithm<BufferedImage>, Serializable

    public class RelativeCrop
    extends AbstractCropAlgorithm
    Crops the image to specified width and height. Where the crop rectangle starts is defined by the X and Y position and the anchor.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -x <double> (property: X)
        The horizontal pixel position (0-1: percent; >1: pixels).
        default: 0.0
        minimum: 0.0
     
    -y <double> (property: Y)
        The vertical pixel position (0-1: percent; >1: pixels).
        default: 0.0
        minimum: 0.0
     
    -width <double> (property: width)
        The width of the crop rectangle (0-1: percent; >1: pixels).
        default: 1.0
        minimum: 1.0E-5
     
    -height <double> (property: height)
        The height of the crop rectangle (0-1: percent; >1: pixels).
        default: 1.0
        minimum: 1.0E-5
     
    -anchor <TOP_LEFT|TOP_CENTER|TOP_RIGHT|MIDDLE_LEFT|MIDDLE_CENTER|MIDDLE_RIGHT|BOTTOM_LEFT|BOTTOM_CENTER|BOTTOM_RIGHT> (property: anchor)
        Defines where to anchor the position on the crop rectangle.
        default: TOP_LEFT
     
    -use-anchor-at-pos <boolean> (property: useAnchorAtPos)
        If enabled, the anchor gets placed at the x/y positiion and the corners 
        of the crop are calculated accordingly; eg 'MIDDLE_CENTER' then refers to 
        the center of the crop rectangle, with the center located at x/y.
        default: false
     
    Version:
    $Revision: 8950 $
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_X

        protected double m_X
        the X position of the crop rectangle.
      • m_Y

        protected double m_Y
        the Y position of the crop rectangle.
      • m_Width

        protected double m_Width
        the width of the crop rectangle.
      • m_Height

        protected double m_Height
        the height of the crop rectangle.
      • m_Anchor

        protected ImageAnchor m_Anchor
        where to anchor the position on the rectangle.
      • m_UseAnchorAtPos

        protected boolean m_UseAnchorAtPos
        whether to use the anchor at the specified to position rather than using image.
    • Constructor Detail

      • RelativeCrop

        public RelativeCrop()
    • Method Detail

      • setX

        public void setX​(double value)
        Sets the X position (0-1: percent; >1: pixels).
        Parameters:
        value - the position
      • getX

        public double getX()
        Returns the X position (0-1: percent; >1: pixels).
        Returns:
        the position
      • XTipText

        public String XTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setY

        public void setY​(double value)
        Sets the Y position (0-1: percent; >1: pixels).
        Parameters:
        value - the position
      • getY

        public double getY()
        Returns the Y position (0-1: percent; >1: pixels).
        Returns:
        the position
      • YTipText

        public String YTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setWidth

        public void setWidth​(double value)
        Sets the width of the crop rectangle (0-1: percent; >1: pixels).
        Parameters:
        value - the width
      • getWidth

        public double getWidth()
        Returns the width of the crop rectangle (0-1: percent; >1: pixels).
        Returns:
        the width
      • widthTipText

        public String widthTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setHeight

        public void setHeight​(double value)
        Sets the height of the crop rectangle (0-1: percent; >1: pixels).
        Parameters:
        value - the height
      • getHeight

        public double getHeight()
        Returns the height of the crop rectangle (0-1: percent; >1: pixels).
        Returns:
        the height
      • heightTipText

        public String heightTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setAnchor

        public void setAnchor​(ImageAnchor value)
        Sets where to anchor the position on the rectangle.
        Parameters:
        value - the anchor
      • getAnchor

        public ImageAnchor getAnchor()
        Returns where to anchor the position on the rectangle.
        Returns:
        the anchor
      • anchorTipText

        public String anchorTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui
      • setUseAnchorAtPos

        public void setUseAnchorAtPos​(boolean value)
        Sets whether to place the anchor at the position or use it relative to image.
        Parameters:
        value - true if anchor at pos
      • getUseAnchorAtPos

        public boolean getUseAnchorAtPos()
        Returns whether to place the anchor at the position or use it relative to image.
        Returns:
        true if anchor at pos
      • useAnchorAtPosTipText

        public String useAnchorAtPosTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the gui