adams.data.jai.transformer
Class Crop

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.image.AbstractImageTransformer<BufferedImageContainer>
              extended by adams.data.jai.transformer.AbstractJAITransformer
                  extended by adams.data.jai.transformer.Crop
All Implemented Interfaces:
CleanUpHandler, Debuggable, Destroyable, OptionHandler, SizeOfHandler, Serializable, Comparable

public class Crop
extends AbstractJAITransformer

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

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to 
    the console (0 = off).
    default: 0
    minimum: 0
 
-x <int> (property: X)
    The horizontal pixel position.
    default: 1
    minimum: 1
 
-y <int> (property: Y)
    The vertical pixel position.
    default: 1
    minimum: 1
 
-width <int> (property: width)
    The width of the crop rectangle.
    default: 100
    minimum: 1
 
-height <int> (property: height)
    The height of the crop rectangle.
    default: 75
    minimum: 1
 
-anchor <TOP_LEFT|TOP_RIGHT|CENTER|BOTTOM_LEFT|BOTTOM_RIGHT> (property: anchor)
    Defines where to anchor the position on the crop rectangle.
    default: TOP_LEFT
 

Version:
$Revision: 4785 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
static class Crop.Anchor
          Enumeration for the crop rectangle anchor.\
 
Field Summary
protected  Crop.Anchor m_Anchor
          where to anchor the position on the rectangle.
protected  int m_Height
          the height of the crop rectangle.
protected  int m_Width
          the width of the crop rectangle.
protected  int m_X
          the X position of the crop rectangle.
protected  int m_Y
          the Y position of the crop rectangle.
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
Crop()
           
 
Method Summary
 String anchorTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
protected  BufferedImageContainer[] doTransform(BufferedImageContainer img)
          Performs no transformation at all, just returns the input.
 Crop.Anchor getAnchor()
          Returns where to anchor the position on the rectangle.
 int getHeight()
          Returns the height of the crop rectangle.
 int getWidth()
          Returns the width of the crop rectangle.
 int getX()
          Returns the X position.
 int getY()
          Returns the Y position.
 String globalInfo()
          Returns a string describing the object.
 String heightTipText()
          Returns the tip text for this property.
 void setAnchor(Crop.Anchor value)
          Sets where to anchor the position on the rectangle.
 void setHeight(int value)
          Sets the height of the crop rectangle.
 void setWidth(int value)
          Sets the width of the crop rectangle.
 void setX(int value)
          Sets the X position.
 void setY(int value)
          Sets the Y position.
 String widthTipText()
          Returns the tip text for this property.
 String XTipText()
          Returns the tip text for this property.
 String YTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.data.jai.transformer.AbstractJAITransformer
forCommandLine, forName, getTransformations
 
Methods inherited from class adams.data.image.AbstractImageTransformer
checkImage, cleanUp, compareTo, destroy, equals, shallowCopy, shallowCopy, transform
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, reset, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_X

protected int m_X
the X position of the crop rectangle.


m_Y

protected int m_Y
the Y position of the crop rectangle.


m_Width

protected int m_Width
the width of the crop rectangle.


m_Height

protected int m_Height
the height of the crop rectangle.


m_Anchor

protected Crop.Anchor m_Anchor
where to anchor the position on the rectangle.

Constructor Detail

Crop

public Crop()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class AbstractOptionHandler
Returns:
a description suitable for displaying in the gui

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractOptionHandler

setX

public void setX(int value)
Sets the X position.

Parameters:
value - the position

getX

public int getX()
Returns the X position.

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(int value)
Sets the Y position.

Parameters:
value - the position

getY

public int getY()
Returns the Y position.

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(int value)
Sets the width of the crop rectangle.

Parameters:
value - the width

getWidth

public int getWidth()
Returns the width of the crop rectangle.

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(int value)
Sets the height of the crop rectangle.

Parameters:
value - the height

getHeight

public int getHeight()
Returns the height of the crop rectangle.

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(Crop.Anchor value)
Sets where to anchor the position on the rectangle.

Parameters:
value - the anchor

getAnchor

public Crop.Anchor 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

doTransform

protected BufferedImageContainer[] doTransform(BufferedImageContainer img)
Performs no transformation at all, just returns the input.

Specified by:
doTransform in class AbstractImageTransformer<BufferedImageContainer>
Parameters:
img - the image to process (can be modified, since it is a copy)
Returns:
the copy of the image


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.