Package org.refcodes.textual
Class AsciiArtBuilderImpl
- java.lang.Object
-
- org.refcodes.textual.AsciiArtBuilderImpl
-
- All Implemented Interfaces:
org.refcodes.mixin.ColumnWidthAccessor
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<AsciiArtBuilder>
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
,AsciiArtBuilder
,FontAccessor
,FontAccessor.FontBuilder<AsciiArtBuilder>
,FontAccessor.FontMutator
,FontAccessor.FontProperty
,FontNameAccessor
,FontNameAccessor.FontNameBuilder<AsciiArtBuilder>
,FontNameAccessor.FontNameMutator
,FontNameAccessor.FontNameProperty
,FontSizeAccessor
,FontSizeAccessor.FontSizeBuilder<AsciiArtBuilder>
,FontSizeAccessor.FontSizeMutator
,FontSizeAccessor.FontSizeProperty
,FontStyleAccessor
,FontStyleAccessor.FontStyleBuilder<AsciiArtBuilder>
,FontStyleAccessor.FontStyleMutator
,FontStyleAccessor.FontStyleProperty
,FontTypeAccessor
,FontTypeAccessor.FontTypeBuilder<AsciiArtBuilder>
,FontTypeAccessor.FontTypeMutator
,FontTypeAccessor.FontTypeProperty
,Text<AsciiArtBuilder>
,TextAccessor
,TextAccessor.TextBuilder<Text<AsciiArtBuilder>>
,TextAccessor.TextMutator
,TextAccessor.TextProperty
,TextAccessor.TextProvider
public class AsciiArtBuilderImpl extends java.lang.Object implements AsciiArtBuilder
The Class AsciiArtBuilderImpl.- Author:
- steiner
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.ColumnWidthAccessor
org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B extends org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B>>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
-
Nested classes/interfaces inherited from interface org.refcodes.textual.FontAccessor
FontAccessor.FontBuilder<B extends FontAccessor.FontBuilder<B>>, FontAccessor.FontMutator, FontAccessor.FontProperty
-
Nested classes/interfaces inherited from interface org.refcodes.textual.FontNameAccessor
FontNameAccessor.FontNameBuilder<B extends FontNameAccessor.FontNameBuilder<B>>, FontNameAccessor.FontNameMutator, FontNameAccessor.FontNameProperty
-
Nested classes/interfaces inherited from interface org.refcodes.textual.FontSizeAccessor
FontSizeAccessor.FontSizeBuilder<B extends FontSizeAccessor.FontSizeBuilder<B>>, FontSizeAccessor.FontSizeMutator, FontSizeAccessor.FontSizeProperty
-
Nested classes/interfaces inherited from interface org.refcodes.textual.FontStyleAccessor
FontStyleAccessor.FontStyleBuilder<B extends FontStyleAccessor.FontStyleBuilder<B>>, FontStyleAccessor.FontStyleMutator, FontStyleAccessor.FontStyleProperty
-
Nested classes/interfaces inherited from interface org.refcodes.textual.FontTypeAccessor
FontTypeAccessor.FontTypeBuilder<B extends FontTypeAccessor.FontTypeBuilder<B>>, FontTypeAccessor.FontTypeMutator, FontTypeAccessor.FontTypeProperty
-
Nested classes/interfaces inherited from interface org.refcodes.textual.TextAccessor
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
-
-
Constructor Summary
Constructors Constructor Description AsciiArtBuilderImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AsciiArtMode
getAsciiArtMode()
Retrieves the ASCII art mode from the ASCII art mode property.org.refcodes.data.AsciiColorPalette
getAsciiColorPalette()
Retrieves the ASCII color palette from the ASCII color palette property.char[]
getAsciiColors()
Retrieves the ASCII colors from the ASCII colors property.int
getColumnWidth()
Font
getFont()
Retrieves the font from the font property.java.lang.String
getFontName()
Retrieves the font name from the font name property.int
getFontSize()
Retrieves the font style from the font style property.FontStyle
getFontStyle()
Retrieves the font style from the font style property.FontType
getFontType()
Retrieves the font type from the font type property.PixmapRatioMode
getPixmapRatioMode()
Retrieves thePixmap
ratio mode from thePixmap
ratio mode property.org.refcodes.graphical.RgbPixmap
getRgbPixmap()
Retrieves thePixmap
from thePixmap
property.java.lang.String[]
getText()
Retrieves the text from the text property.void
setAsciiArtMode(AsciiArtMode aAsciiArtMode)
Sets the ASCII art mode for the ASCII art mode property.void
setAsciiColorPalette(org.refcodes.data.AsciiColorPalette aAsciiColorPalette)
Sets the ASCII color palette for the ASCII color palette property.void
setAsciiColors(char... aAsciiColors)
Sets the ASCII colors for the ASCII colors property.void
setColumnWidth(int aColumnWidth)
void
setFont(Font aFont)
Sets the font for the font property.void
setFontName(java.lang.String aFontName)
Sets the font name for the font name property.void
setFontSize(int aFontSize)
Sets the font style for the font style property.void
setFontStyle(FontStyle aFontStyle)
Sets the font style for the font style property.void
setFontType(FontType aFontName)
Sets the font type for the font type property.void
setPixmapRatioMode(PixmapRatioMode aPixmapRatioMode)
Sets thePixmap
ratio mode for thePixmap
ratio mode property.void
setRgbPixmap(org.refcodes.graphical.RgbPixmap aPixmap)
Sets thePixmap
for thePixmap
property.void
setText(java.lang.String... aText)
Sets the text for the text property.protected static char
toAscii(int aRgbValue)
Converts an RGB value to an ASCII character from a palette if characters as provided.protected static char
toAscii(int aRgbValue, char[] aPalette)
Converts an RGB value to an ASCII character from a palette if characters as provided.protected static java.lang.String[]
toAsciiArt(java.lang.String[] aLines, int aWidth, java.awt.Font aFont, char[] aPalette, AsciiArtMode aAsciiArtMode)
To ascii art.protected static java.lang.String[]
toAsciiArt(java.lang.String[] aLines, int aWidth, java.lang.String aFontName, int aFontStyle, int aFontSize, char[] aPalette, AsciiArtMode aAsciiArtMode)
To ascii art.protected static java.lang.String[]
toAsciiArt(java.lang.String aText, int aWidth, java.awt.Font aFont, char[] aPalette)
protected static java.lang.String[]
toAsciiArt(java.lang.String aText, int aWidth, java.awt.Font aFont, char[] aPalette, AsciiArtMode aAsciiArtMode)
To ascii art.protected static java.lang.String[]
toAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle)
protected static java.lang.String[]
toAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle, char[] aPalette)
protected static java.lang.String[]
toAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle, int aFontSize, char[] aPalette, AsciiArtMode aAsciiArtMode)
To ascii art.protected static java.lang.String[]
toAsciiArt(java.lang.String aText, java.awt.Font aFont)
This method creates an array ofString
instances containing the given text rendered with the givenFont
as so called ASCII art.protected static java.lang.String[]
toAsciiArt(java.lang.String aText, java.awt.Font aFont, char[] aPalette)
This method creates an array ofString
instances containing the given text rendered with the givenFont
as so called ASCII art.protected static java.lang.String[]
toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette)
To ascii art.protected static java.lang.String[]
toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, int aColumnWidth, char[] aPalette, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode)
To ascii art.protected static java.lang.String[]
toInverseAsciiArt(java.lang.String aText, int aWidth, java.awt.Font aFont, char[] aPalette)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static java.lang.String[]
toInverseAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static java.lang.String[]
toInverseAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle, char[] aPalette)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static java.lang.String[]
toInverseAsciiArt(java.lang.String aText, java.awt.Font aFont)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static java.lang.String[]
toInverseAsciiArt(java.lang.String aText, java.awt.Font aFont, char[] aPalette)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static java.lang.String[]
toInverseAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette)
To inverse ascii art.java.lang.String
toString()
TheString
being build by the builder upon the settings of the attributes.java.lang.String
toString(java.lang.String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
.java.lang.String
toString(org.refcodes.graphical.RgbPixmap aPixmap)
Race condition safe shortcut for usingAsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toString()
.java.lang.String[]
toStrings()
TheString
s being build by the builder upon the settings of the attributes.java.lang.String[]
toStrings(java.lang.String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
.java.lang.String[]
toStrings(org.refcodes.graphical.RgbPixmap aPixmap)
Race condition safe shortcut for usingAsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toStrings()
.AsciiArtBuilder
withColumnWidth(int aColumnWidth)
AsciiArtBuilder
withFont(Font aFont)
Sets the font for the font property.AsciiArtBuilder
withFontName(java.lang.String aFontName)
Sets the font name for the font name property.AsciiArtBuilder
withFontSize(int aFontSize)
Sets the font style for the font style property.AsciiArtBuilder
withFontStyle(FontStyle aFontStyle)
Sets the font style for the font style property.AsciiArtBuilder
withFontType(FontType aFontName)
Sets the font type for the font type property.B
withText(java.lang.String... aText)
With text.B
withText(java.util.Collection<java.lang.String> aText)
With text.-
Methods inherited from interface org.refcodes.textual.AsciiArtBuilder
setAsciiColors, setImageFile, toString, toStrings, withAsciiArtMode, withAsciiColorPalette, withAsciiColors, withAsciiColors, withImageFile, withPixmapRatioMode, withRgbPixmap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.textual.TextAccessor
getText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextBuilder
withText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextMutator
setText, setText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextProvider
toString
-
-
-
-
Method Detail
-
getPixmapRatioMode
public PixmapRatioMode getPixmapRatioMode()
Retrieves thePixmap
ratio mode from thePixmap
ratio mode property.- Specified by:
getPixmapRatioMode
in interfaceAsciiArtBuilder
- Returns:
- The
Pixmap
ratio mode stored by thePixmap
ratio mode property.
-
setPixmapRatioMode
public void setPixmapRatioMode(PixmapRatioMode aPixmapRatioMode)
Sets thePixmap
ratio mode for thePixmap
ratio mode property.- Specified by:
setPixmapRatioMode
in interfaceAsciiArtBuilder
- Parameters:
aPixmapRatioMode
- ThePixmap
ratio mode to be stored by the text strip mode property.
-
getRgbPixmap
public org.refcodes.graphical.RgbPixmap getRgbPixmap()
Retrieves thePixmap
from thePixmap
property.- Specified by:
getRgbPixmap
in interfaceAsciiArtBuilder
- Returns:
- The
Pixmap
stored by thePixmap
property.
-
withColumnWidth
public AsciiArtBuilder withColumnWidth(int aColumnWidth)
- Specified by:
withColumnWidth
in interfaceorg.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<AsciiArtBuilder>
-
setColumnWidth
public void setColumnWidth(int aColumnWidth)
- Specified by:
setColumnWidth
in interfaceorg.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
-
getColumnWidth
public int getColumnWidth()
- Specified by:
getColumnWidth
in interfaceorg.refcodes.mixin.ColumnWidthAccessor
-
getFont
public Font getFont()
Retrieves the font from the font property.- Specified by:
getFont
in interfaceFontAccessor
- Returns:
- The font stored by the font property.
-
setFont
public void setFont(Font aFont)
Sets the font for the font property.- Specified by:
setFont
in interfaceFontAccessor.FontMutator
- Parameters:
aFont
- The font to be stored by the font property.
-
withFont
public AsciiArtBuilder withFont(Font aFont)
Sets the font for the font property.- Specified by:
withFont
in interfaceFontAccessor.FontBuilder<AsciiArtBuilder>
- Parameters:
aFont
- The font to be stored by the font property.- Returns:
- The builder for applying multiple build operations.
-
getAsciiArtMode
public AsciiArtMode getAsciiArtMode()
Retrieves the ASCII art mode from the ASCII art mode property.- Specified by:
getAsciiArtMode
in interfaceAsciiArtBuilder
- Returns:
- The ASCII art mode stored by the ASCII art mode property.
-
setAsciiArtMode
public void setAsciiArtMode(AsciiArtMode aAsciiArtMode)
Sets the ASCII art mode for the ASCII art mode property.- Specified by:
setAsciiArtMode
in interfaceAsciiArtBuilder
- Parameters:
aAsciiArtMode
- The ASCII art mode to be stored by the text strip mode property.
-
getAsciiColors
public char[] getAsciiColors()
Retrieves the ASCII colors from the ASCII colors property.- Specified by:
getAsciiColors
in interfaceAsciiArtBuilder
- Returns:
- The ASCII colors stored by the ASCII colors property.
-
setAsciiColors
public void setAsciiColors(char... aAsciiColors)
Sets the ASCII colors for the ASCII colors property.- Specified by:
setAsciiColors
in interfaceAsciiArtBuilder
- Parameters:
aAsciiColors
- The ASCII colors to be stored by the ASCII colors property.
-
getAsciiColorPalette
public org.refcodes.data.AsciiColorPalette getAsciiColorPalette()
Retrieves the ASCII color palette from the ASCII color palette property.- Specified by:
getAsciiColorPalette
in interfaceAsciiArtBuilder
- Returns:
- The ASCII color palette stored by the ASCII color palette property.
-
setAsciiColorPalette
public void setAsciiColorPalette(org.refcodes.data.AsciiColorPalette aAsciiColorPalette)
Sets the ASCII color palette for the ASCII color palette property.- Specified by:
setAsciiColorPalette
in interfaceAsciiArtBuilder
- Parameters:
aAsciiColorPalette
- The ASCII color palette to be stored by the ASCII color palette property.
-
getFontType
public FontType getFontType()
Retrieves the font type from the font type property.- Specified by:
getFontType
in interfaceFontTypeAccessor
- Returns:
- The font type stored by the font type property.
-
setFontType
public void setFontType(FontType aFontName)
Sets the font type for the font type property.- Specified by:
setFontType
in interfaceFontTypeAccessor.FontTypeMutator
- Parameters:
aFontName
- The font type to be stored by the font type property.
-
withFontType
public AsciiArtBuilder withFontType(FontType aFontName)
Sets the font type for the font type property.- Specified by:
withFontType
in interfaceFontTypeAccessor.FontTypeBuilder<AsciiArtBuilder>
- Parameters:
aFontName
- The font type to be stored by the font type property.- Returns:
- The builder for applying multiple build operations.
-
getFontStyle
public FontStyle getFontStyle()
Retrieves the font style from the font style property.- Specified by:
getFontStyle
in interfaceFontStyleAccessor
- Returns:
- The font style stored by the font style property.
-
setFontStyle
public void setFontStyle(FontStyle aFontStyle)
Sets the font style for the font style property.- Specified by:
setFontStyle
in interfaceFontStyleAccessor.FontStyleMutator
- Parameters:
aFontStyle
- The font style to be stored by the font style property.
-
withFontStyle
public AsciiArtBuilder withFontStyle(FontStyle aFontStyle)
Sets the font style for the font style property.- Specified by:
withFontStyle
in interfaceFontStyleAccessor.FontStyleBuilder<AsciiArtBuilder>
- Parameters:
aFontStyle
- The font style to be stored by the font style property.- Returns:
- The builder for applying multiple build operations.
-
getFontSize
public int getFontSize()
Retrieves the font style from the font style property.- Specified by:
getFontSize
in interfaceFontSizeAccessor
- Returns:
- The font style stored by the font style property.
-
setFontSize
public void setFontSize(int aFontSize)
Sets the font style for the font style property.- Specified by:
setFontSize
in interfaceFontSizeAccessor.FontSizeMutator
- Parameters:
aFontSize
- The font style to be stored by the font style property.
-
withFontSize
public AsciiArtBuilder withFontSize(int aFontSize)
Sets the font style for the font style property.- Specified by:
withFontSize
in interfaceFontSizeAccessor.FontSizeBuilder<AsciiArtBuilder>
- Parameters:
aFontSize
- The font style to be stored by the font style property.- Returns:
- The builder for applying multiple build operations.
-
getFontName
public java.lang.String getFontName()
Retrieves the font name from the font name property.- Specified by:
getFontName
in interfaceFontNameAccessor
- Returns:
- The font name stored by the font name property.
-
setFontName
public void setFontName(java.lang.String aFontName)
Sets the font name for the font name property.- Specified by:
setFontName
in interfaceFontNameAccessor.FontNameMutator
- Parameters:
aFontName
- The font name to be stored by the font name property.
-
withFontName
public AsciiArtBuilder withFontName(java.lang.String aFontName)
Sets the font name for the font name property.- Specified by:
withFontName
in interfaceFontNameAccessor.FontNameBuilder<AsciiArtBuilder>
- Parameters:
aFontName
- The font name to be stored by the font name property.- Returns:
- The builder for applying multiple build operations.
-
setRgbPixmap
public void setRgbPixmap(org.refcodes.graphical.RgbPixmap aPixmap)
Sets thePixmap
for thePixmap
property.- Specified by:
setRgbPixmap
in interfaceAsciiArtBuilder
- Parameters:
aPixmap
- ThePixmap
to be stored by thePixmap
property.
-
toStrings
public java.lang.String[] toStrings()
TheString
s being build by the builder upon the settings of the attributes.- Specified by:
toStrings
in interfaceTextAccessor.TextProvider
- Returns:
- The according resulting
String
array
-
toStrings
public java.lang.String[] toStrings(java.lang.String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
. Implementation requirements: This method must not(!) be implemented by callingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
(do not change the text property) as this would not be thread safe!- Specified by:
toStrings
in interfaceText<AsciiArtBuilder>
- Parameters:
aText
- The text to be processed.- Returns:
- The according resulting
String
array
-
toString
public java.lang.String toString(org.refcodes.graphical.RgbPixmap aPixmap)
Race condition safe shortcut for usingAsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toString()
. Implementation requirements: This method must not(!) be implemented by callingAsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toString()
(do not change thePixmap
property) as this would not be thread safe!- Specified by:
toString
in interfaceAsciiArtBuilder
- Parameters:
aPixmap
- ThePixmap
to be converted to AsciiArt.- Returns:
- The according resulting
String
-
toStrings
public java.lang.String[] toStrings(org.refcodes.graphical.RgbPixmap aPixmap)
Race condition safe shortcut for usingAsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toStrings()
. Implementation requirements: This method must not(!) be implemented by callingAsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toStrings()
(do not change thePixmap
property) as this would not be thread safe!- Specified by:
toStrings
in interfaceAsciiArtBuilder
- Parameters:
aPixmap
- ThePixmap
to be converted to AsciiArt.- Returns:
- The according resulting
String
array
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String[] aLines, int aWidth, java.lang.String aFontName, int aFontStyle, int aFontSize, char[] aPalette, AsciiArtMode aAsciiArtMode)
To ascii art.- Parameters:
aLines
- the linesaWidth
- the widthaFontName
- the font nameaFontStyle
- the font styleaFontSize
- the font sizeaPalette
- the paletteaAsciiArtMode
- the ascii art mode- Returns:
- the string[]
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String[] aLines, int aWidth, java.awt.Font aFont, char[] aPalette, AsciiArtMode aAsciiArtMode)
To ascii art.- Parameters:
aLines
- the linesaWidth
- the widthaFont
- the fontaPalette
- the paletteaAsciiArtMode
- the ascii art mode- Returns:
- the string[]
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle, int aFontSize, char[] aPalette, AsciiArtMode aAsciiArtMode)
To ascii art.- Parameters:
aText
- the textaWidth
- the widthaFontName
- the font nameaFontStyle
- the font styleaFontSize
- the font sizeaPalette
- the paletteaAsciiArtMode
- the ascii art mode- Returns:
- the string[]
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String aText, int aWidth, java.awt.Font aFont, char[] aPalette, AsciiArtMode aAsciiArtMode)
To ascii art.- Parameters:
aText
- the textaWidth
- the widthaFont
- the fontaPalette
- the paletteaAsciiArtMode
- the ascii art mode- Returns:
- the string[]
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, int aColumnWidth, char[] aPalette, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode)
To ascii art.- Parameters:
aPixmap
- the pixmapaColumnWidth
- the column widthaPalette
- the paletteaAsciiArtMode
- the ascii art modeaPixmapRatioMode
- the pixmap ratio mode- Returns:
- the string[]
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette)
To ascii art.- Parameters:
aPixmap
- the pixmapaPalette
- the palette- Returns:
- the string[]
-
toInverseAsciiArt
protected static java.lang.String[] toInverseAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette)
To inverse ascii art.- Parameters:
aPixmap
- the pixmapaPalette
- the palette- Returns:
- the string[]
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle, char[] aPalette)
This method creates an array ofString
instances containing the given text as so called ASCII art rendered with the givenFont
name andFont
Style
to fit into the given width.- Parameters:
aText
- The text to be rendered as ASCII art.aWidth
- the widthaFontName
- TheFont
name to be used when rendering to ASCII art.aFontStyle
- TheFont
style to be used when rendering to ASCII art.aPalette
- The character palate to use when converting an RGB value to an ASCII character. The first character represents white, the last character represents black, the characters in between are gradients from white to black.- Returns:
- An array of
String
instances, when printed out in the order as returned, visualize the provided text in the givenFont
as ASCII art.
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String aText, int aWidth, java.awt.Font aFont, char[] aPalette)
This method creates an array ofString
instances containing the given text as so called ASCII art rendered with the givenFont
name andFont
Style
to fit into the given width.- Parameters:
aText
- The text to be rendered as ASCII art.aWidth
- the widthaFont
- the fontaPalette
- The character palate to use when converting an RGB value to an ASCII character. The first character represents white, the last character represents black, the characters in between are gradients from white to black.- Returns:
- An array of
String
instances, when printed out in the order as returned, visualize the provided text in the givenFont
as ASCII art.
-
toInverseAsciiArt
protected static java.lang.String[] toInverseAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle, char[] aPalette)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).- Parameters:
aText
- The text to be rendered as ASCII art.aWidth
- the widthaFontName
- TheFont
name to be used when rendering to ASCII art.aFontStyle
- TheFont
style to be used when rendering to ASCII art.aPalette
- The character palate to use when converting an RGB value to an ASCII character. The first character represents white, the last character represents black, the characters in between are gradients from white to black.- Returns:
- An array of
String
instances, when printed out in the order as returned, visualize the provided text in the givenFont
as ASCII art.
-
toInverseAsciiArt
protected static java.lang.String[] toInverseAsciiArt(java.lang.String aText, int aWidth, java.awt.Font aFont, char[] aPalette)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).- Parameters:
aText
- The text to be rendered as ASCII art.aWidth
- the widthaFont
- TheFont
to be used when rendering to ASCII art.aPalette
- The character palate to use when converting an RGB value to an ASCII character. The first character represents white, the last character represents black, the characters in between are gradients from white to black.- Returns:
- An array of
String
instances, when printed out in the order as returned, visualize the provided text in the givenFont
as ASCII art.
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle)
This method creates an array ofString
instances containing the given text as so called ASCII art rendered with the givenFont
name andFont
Style
to fit into the given width.- Parameters:
aText
- The text to be rendered as ASCII art.aWidth
- the widthaFontName
- TheFont
name to be used when rendering to ASCII art.aFontStyle
- TheFont
style to be used when rendering to ASCII art.- Returns:
- An array of
String
instances, when printed out in the order as returned, visualize the provided text in the givenFont
as ASCII art.
-
toInverseAsciiArt
protected static java.lang.String[] toInverseAsciiArt(java.lang.String aText, int aWidth, java.lang.String aFontName, int aFontStyle)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).- Parameters:
aText
- The text to be rendered as ASCII art.aWidth
- the widthaFontName
- TheFont
name to be used when rendering to ASCII art.aFontStyle
- TheFont
style to be used when rendering to ASCII art.- Returns:
- An array of
String
instances, when printed out in the order as returned, visualize the provided text in the givenFont
as ASCII art.
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String aText, java.awt.Font aFont)
This method creates an array ofString
instances containing the given text rendered with the givenFont
as so called ASCII art.
-
toInverseAsciiArt
protected static java.lang.String[] toInverseAsciiArt(java.lang.String aText, java.awt.Font aFont)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).
-
toAsciiArt
protected static java.lang.String[] toAsciiArt(java.lang.String aText, java.awt.Font aFont, char[] aPalette)
This method creates an array ofString
instances containing the given text rendered with the givenFont
as so called ASCII art.- Parameters:
aText
- The text to be rendered as ASCII art.aFont
- TheFont
to render the ASCII art.aPalette
- The character palate to use when converting an RGB value to an ASCII character. The first character represents white, the last character represents black, the characters in between are gradients from white to black.- Returns:
- An array of
String
instances, when printed out in the order as returned, visualize the provided text in the givenFont
as ASCII art.
-
toInverseAsciiArt
protected static java.lang.String[] toInverseAsciiArt(java.lang.String aText, java.awt.Font aFont, char[] aPalette)
Same astoAsciiArt(java.lang.String[],int,java.lang.String,int,int,char[],org.refcodes.textual.AsciiArtMode)
with inverted colors (black = white, dark = bright, bright = dark, white = black).- Parameters:
aText
- The text to be rendered as ASCII art.aFont
- TheFont
to render the ASCII art.aPalette
- The character palate to use when converting an RGB value to an ASCII character. The first character represents white, the last character represents black, the characters in between are gradients from white to black.- Returns:
- An array of
String
instances, when printed out in the order as returned, visualize the provided text in the givenFont
as ASCII art.
-
toAscii
protected static char toAscii(int aRgbValue, char[] aPalette)
Converts an RGB value to an ASCII character from a palette if characters as provided.- Parameters:
aRgbValue
- The RGB value to be converted to an ASCII character.aPalette
- The character palate to use when converting an RGB value to an ASCII character. The first character represents white, the last character represents black, the characters in between are gradients from white to black.- Returns:
- the char
-
toAscii
protected static char toAscii(int aRgbValue)
Converts an RGB value to an ASCII character from a palette if characters as provided.- Parameters:
aRgbValue
- The RGB value to be converted to an ASCII character.- Returns:
- the char
-
getText
public java.lang.String[] getText()
Retrieves the text from the text property.- Specified by:
getText
in interfaceTextAccessor
- Returns:
- The text stored by the text property.
-
setText
public void setText(java.lang.String... aText)
Sets the text for the text property.- Specified by:
setText
in interfaceTextAccessor.TextMutator
- Parameters:
aText
- The text to be stored by the text property.
-
withText
public B withText(java.lang.String... aText)
With text.
-
withText
public B withText(java.util.Collection<java.lang.String> aText)
With text.- Specified by:
withText
in interfaceTextAccessor.TextBuilder<B extends Text<B>>
- Parameters:
aText
- the text- Returns:
- the b
-
toString
public java.lang.String toString()
TheString
being build by the builder upon the settings of the attributes. In case more then one line has been set as input and the functionality of the builder is applied to each line in separate, then this method returns all of them lines concatenated with a line break between each of them (implementation depended).- Specified by:
toString
in interfaceTextAccessor.TextProvider
- Overrides:
toString
in classjava.lang.Object
- Returns:
- The according resulting
String
-
toString
public java.lang.String toString(java.lang.String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
. Implementation requirements: This method must not(!) be implemented by callingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
(do not change the text property) as this would not be thread safe!
-
-