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 intm_Alphathe alpha value to use for the overlay (0: transparent, 255: opaque).protected booleanm_AntiAliasingEnabledwhether anti-aliasing is enabled.protected Fontm_Fontthe font to use.protected Stringm_Textthe text to draw.protected intm_Xthe X position of the text (1-based).protected intm_Ythe Y position of the text (1-based).protected intm_YIncrementthe 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 StringalphaTipText()Returns the tip text for this property.StringantiAliasingEnabledTipText()Returns the tip text for this property.protected Stringcheck(BufferedImageContainer image)Checks the image.voiddefineOptions()Adds options to the internal list of options.protected StringdoDraw(BufferedImageContainer image)Performs the actual draw operation.StringfontTipText()Returns the tip text for this property.intgetAlpha()Returns the alpha value to use for the overlay: 0=transparent, 255=opaque.FontgetFont()Returns the font in use.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringgetText()Returns the text to draw.intgetX()Returns the X position of the text (top-left corner).intgetY()Returns the Y position of the text (top-left corner).intgetYIncrement()Returns the Y increment when outputting multiple lines.StringglobalInfo()Returns a string describing the object.booleanisAntiAliasingEnabled()Returns whether anti-aliasing is used.voidsetAlpha(int value)Sets the alpha value to use for the overlay: 0=transparent, 255=opaque.voidsetAntiAliasingEnabled(boolean value)Sets whether to use anti-aliasing.voidsetFont(Font value)Sets the font to use.voidsetText(String value)Sets the text to draw.voidsetX(int value)Sets the X position of the text (top-left corner).voidsetY(int value)Sets the Y position of the text (top-left corner).voidsetYIncrement(int value)Sets the Y increment when outputting multiple lines.StringtextTipText()Returns the tip text for this property.StringXTipText()Returns the tip text for this property.StringYIncrementTipText()Returns the tip text for this property.StringYTipText()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.
-
m_Alpha
protected int m_Alpha
the alpha value to use for the overlay (0: transparent, 255: opaque).
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractColorDrawOperation
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
setAntiAliasingEnabledin interfaceAntiAliasingDrawOperation- Parameters:
value- if true then anti-aliasing is used
-
isAntiAliasingEnabled
public boolean isAntiAliasingEnabled()
Returns whether anti-aliasing is used.- Specified by:
isAntiAliasingEnabledin interfaceAntiAliasingDrawOperation- Returns:
- true if anti-aliasing is used
-
antiAliasingEnabledTipText
public String antiAliasingEnabledTipText()
Returns the tip text for this property.- Specified by:
antiAliasingEnabledTipTextin interfaceAntiAliasingDrawOperation- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAlpha
public void setAlpha(int value)
Sets the alpha value to use for the overlay: 0=transparent, 255=opaque.- Parameters:
value- the alpha value
-
getAlpha
public int getAlpha()
Returns the alpha value to use for the overlay: 0=transparent, 255=opaque.- Returns:
- the alpha value
-
alphaTipText
public String alphaTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
check
protected String check(BufferedImageContainer image)
Checks the image.- Overrides:
checkin 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:
doDrawin classAbstractDrawOperation- Parameters:
image- the image to draw on- Returns:
- null if OK, otherwise error message
-
-