Package adams.data.image.transformer
Class ChangeCanvasSize
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,ImageTransformer<BufferedImageContainer>
,FlowContextHandler
,Serializable
,Comparable
public class ChangeCanvasSize extends AbstractBufferedImageTransformer
Places the image on a canvas of specified size based on 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
-canvas-width <int> (property: canvasWidth) The width of the canvas in pixels. default: 100 minimum: 1
-canvas-height <int> (property: canvasHeight) The height of the canvas in pixels. default: 100 minimum: 1
-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 canvas. default: TOP_LEFT
-background <java.awt.Color> (property: background) The background color to use. default: #ffffff
- Version:
- $Revision: 9648 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ImageAnchor
m_Anchor
where to anchor the position on the canvas.protected Color
m_Background
the background color.protected int
m_CanvasHeight
the height of the canvas.protected int
m_CanvasWidth
the width of the canvas.-
Fields inherited from class adams.data.image.AbstractImageTransformer
m_FlowContext
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ChangeCanvasSize()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
anchorTipText()
Returns the tip text for this property.String
backgroundTipText()
Returns the tip text for this property.String
canvasHeightTipText()
Returns the tip text for this property.String
canvasWidthTipText()
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.ImageAnchor
getAnchor()
Returns where to anchor the position on the rectangle.Color
getBackground()
Returns the background color to use.int
getCanvasHeight()
Returns the height of the canvas.int
getCanvasWidth()
Returns the width of the canvas.String
globalInfo()
Returns a string describing the object.void
setAnchor(ImageAnchor value)
Sets where to anchor the position on the rectangle.void
setBackground(Color value)
Sets the background color to use.void
setCanvasHeight(int value)
Sets the height of the canvas.void
setCanvasWidth(int value)
Sets the width of the canvase.-
Methods inherited from class adams.data.image.transformer.AbstractBufferedImageTransformer
forCommandLine, forName, getTransformations
-
Methods inherited from class adams.data.image.AbstractImageTransformer
checkImage, cleanUp, compareTo, destroy, equals, getFlowContext, getQuickInfo, initialize, setFlowContext, shallowCopy, shallowCopy, transform
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_CanvasWidth
protected int m_CanvasWidth
the width of the canvas.
-
m_CanvasHeight
protected int m_CanvasHeight
the height of the canvas.
-
m_Anchor
protected ImageAnchor m_Anchor
where to anchor the position on the canvas.
-
m_Background
protected Color m_Background
the background color.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- 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 interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setCanvasWidth
public void setCanvasWidth(int value)
Sets the width of the canvase.- Parameters:
value
- the width
-
getCanvasWidth
public int getCanvasWidth()
Returns the width of the canvas.- Returns:
- the width
-
canvasWidthTipText
public String canvasWidthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setCanvasHeight
public void setCanvasHeight(int value)
Sets the height of the canvas.- Parameters:
value
- the height
-
getCanvasHeight
public int getCanvasHeight()
Returns the height of the canvas.- Returns:
- the height
-
canvasHeightTipText
public String canvasHeightTipText()
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
-
setBackground
public void setBackground(Color value)
Sets the background color to use.- Parameters:
value
- the color
-
getBackground
public Color getBackground()
Returns the background color to use.- Returns:
- the color
-
backgroundTipText
public String backgroundTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
doTransform
protected BufferedImageContainer[] doTransform(BufferedImageContainer img)
Performs no transformation at all, just returns the input.- Specified by:
doTransform
in classAbstractImageTransformer<BufferedImageContainer>
- Parameters:
img
- the image to process (can be modified, since it is a copy)- Returns:
- the copy of the image
-
-