Package adams.flow.transformer.draw
Class Text
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,AntiAliasingDrawOperation
,Serializable
public class Text extends AbstractColorDrawOperation implements AntiAliasingDrawOperation
Draws text with a specified font at the given location.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-color <java.awt.Color> (property: color) The color of the pixel. default: #000000
-x <int> (property: X) The X position of the top-left corner of the text (1-based). default: 1 minimum: 1
-y <int> (property: Y) The Y position of the top-left corner of the text (1-based). default: 1 minimum: 1
-y-increment <int> (property: YIncrement) The Y increment when outputting multiple lines of text. default: 16 minimum: 1
-font <java.awt.Font> (property: font) The font to use for the text. default: Monospaced-PLAIN-12
-text <java.lang.String> (property: text) The text to draw; it is possible to multiple lines of text, simply use ' \n' as line break. default: Hello World!
-anti-aliasing-enabled <boolean> (property: antiAliasingEnabled) If enabled, uses anti-aliasing for drawing. default: true
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_AntiAliasingEnabled
whether anti-aliasing is enabled.protected Font
m_Font
the font to use.protected String
m_Text
the text to draw.protected int
m_X
the X position of the text (1-based).protected int
m_Y
the Y position of the text (1-based).protected int
m_YIncrement
the Y increment when outputting multiple lines.-
Fields inherited from class adams.flow.transformer.draw.AbstractColorDrawOperation
m_Color
-
Fields inherited from class adams.flow.transformer.draw.AbstractDrawOperation
m_Owner
-
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 Text()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
antiAliasingEnabledTipText()
Returns the tip text for this property.protected String
check(BufferedImageContainer image)
Checks the image.void
defineOptions()
Adds options to the internal list of options.protected String
doDraw(BufferedImageContainer image)
Performs the actual draw operation.String
fontTipText()
Returns the tip text for this property.Font
getFont()
Returns the font in use.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
getText()
Returns the text to draw.int
getX()
Returns the X position of the text (top-left corner).int
getY()
Returns the Y position of the text (top-left corner).int
getYIncrement()
Returns the Y increment when outputting multiple lines.String
globalInfo()
Returns a string describing the object.boolean
isAntiAliasingEnabled()
Returns whether anti-aliasing is used.void
setAntiAliasingEnabled(boolean value)
Sets whether to use anti-aliasing.void
setFont(Font value)
Sets the font to use.void
setText(String value)
Sets the text to draw.void
setX(int value)
Sets the X position of the text (top-left corner).void
setY(int value)
Sets the Y position of the text (top-left corner).void
setYIncrement(int value)
Sets the Y increment when outputting multiple lines.String
textTipText()
Returns the tip text for this property.String
XTipText()
Returns the tip text for this property.String
YIncrementTipText()
Returns the tip text for this property.String
YTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.draw.AbstractColorDrawOperation
colorTipText, getColor, setColor
-
Methods inherited from class adams.flow.transformer.draw.AbstractDrawOperation
draw, getOwner, setOwner
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_X
protected int m_X
the X position of the text (1-based).
-
m_Y
protected int m_Y
the Y position of the text (1-based).
-
m_YIncrement
protected int m_YIncrement
the Y increment when outputting multiple lines.
-
m_Font
protected Font m_Font
the font to use.
-
m_Text
protected String m_Text
the text to draw.
-
m_AntiAliasingEnabled
protected boolean m_AntiAliasingEnabled
whether anti-aliasing is enabled.
-
-
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 classAbstractColorDrawOperation
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractDrawOperation
- Returns:
- null if no info available, otherwise short string
-
setX
public void setX(int value)
Sets the X position of the text (top-left corner).- Parameters:
value
- the position, 1-based
-
getX
public int getX()
Returns the X position of the text (top-left corner).- Returns:
- the position, 1-based
-
XTipText
public String XTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setY
public void setY(int value)
Sets the Y position of the text (top-left corner).- Parameters:
value
- the position, 1-based
-
getY
public int getY()
Returns the Y position of the text (top-left corner).- Returns:
- the position, 1-based
-
YTipText
public String YTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setYIncrement
public void setYIncrement(int value)
Sets the Y increment when outputting multiple lines.- Parameters:
value
- the increment
-
getYIncrement
public int getYIncrement()
Returns the Y increment when outputting multiple lines.- Returns:
- the increment
-
YIncrementTipText
public String YIncrementTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFont
public void setFont(Font value)
Sets the font to use.- Parameters:
value
- the font
-
getFont
public Font getFont()
Returns the font in use.- Returns:
- the font
-
fontTipText
public String fontTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setText
public void setText(String value)
Sets the text to draw. Use \n as line break.- Parameters:
value
- the text, backquoted
-
getText
public String getText()
Returns the text to draw. Uses \n as line break.- Returns:
- the text, backquoted
-
textTipText
public String textTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAntiAliasingEnabled
public void setAntiAliasingEnabled(boolean value)
Sets whether to use anti-aliasing.- Specified by:
setAntiAliasingEnabled
in interfaceAntiAliasingDrawOperation
- Parameters:
value
- if true then anti-aliasing is used
-
isAntiAliasingEnabled
public boolean isAntiAliasingEnabled()
Returns whether anti-aliasing is used.- Specified by:
isAntiAliasingEnabled
in interfaceAntiAliasingDrawOperation
- Returns:
- true if anti-aliasing is used
-
antiAliasingEnabledTipText
public String antiAliasingEnabledTipText()
Returns the tip text for this property.- Specified by:
antiAliasingEnabledTipText
in interfaceAntiAliasingDrawOperation
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
check
protected String check(BufferedImageContainer image)
Checks the image.- Overrides:
check
in classAbstractDrawOperation
- Parameters:
image
- the image to check- Returns:
- null if OK, otherwise error message
-
doDraw
protected String doDraw(BufferedImageContainer image)
Performs the actual draw operation.- Specified by:
doDraw
in classAbstractDrawOperation
- Parameters:
image
- the image to draw on- Returns:
- null if OK, otherwise error message
-
-