public class AsciiArtBuilderImpl extends Object implements AsciiArtBuilder
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
FontAccessor.FontBuilder<B extends FontAccessor.FontBuilder<B>>, FontAccessor.FontMutator, FontAccessor.FontProperty
FontTypeAccessor.FontTypeBuilder<B extends FontTypeAccessor.FontTypeBuilder<B>>, FontTypeAccessor.FontTypeMutator, FontTypeAccessor.FontTypeProperty
FontStyleAccessor.FontStyleBuilder<B extends FontStyleAccessor.FontStyleBuilder<B>>, FontStyleAccessor.FontStyleMutator, FontStyleAccessor.FontStyleProperty
FontSizeAccessor.FontSizeBuilder<B extends FontSizeAccessor.FontSizeBuilder<B>>, FontSizeAccessor.FontSizeMutator, FontSizeAccessor.FontSizeProperty
FontNameAccessor.FontNameBuilder<B extends FontNameAccessor.FontNameBuilder<B>>, FontNameAccessor.FontNameMutator, FontNameAccessor.FontNameProperty
org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B extends org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B>>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
Constructor and Description |
---|
AsciiArtBuilderImpl() |
Modifier and Type | Method and 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.
|
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 the
Pixmap ratio mode from the Pixmap ratio
mode property. |
org.refcodes.graphical.RgbPixmap |
getRgbPixmap()
Retrieves the
Pixmap from the Pixmap property. |
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(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 the
Pixmap ratio mode for the Pixmap ratio mode
property. |
void |
setRgbPixmap(org.refcodes.graphical.RgbPixmap aPixmap)
Sets the
Pixmap for the Pixmap property. |
void |
setText(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 String[] |
toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap,
char[] aPalette)
To ascii art.
|
protected static String[] |
toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap,
int aColumnWidth,
char[] aPalette,
AsciiArtMode aAsciiArtMode,
PixmapRatioMode aPixmapRatioMode)
To ascii art.
|
protected static String[] |
toAsciiArt(String[] aLines,
int aWidth,
Font aFont,
char[] aPalette,
AsciiArtMode aAsciiArtMode)
To ascii art.
|
protected static String[] |
toAsciiArt(String[] aLines,
int aWidth,
String aFontName,
int aFontStyle,
int aFontSize,
char[] aPalette,
AsciiArtMode aAsciiArtMode)
To ascii art.
|
protected static String[] |
toAsciiArt(String aText,
Font aFont)
|
protected static String[] |
toAsciiArt(String aText,
Font aFont,
char[] aPalette)
|
protected static String[] |
toAsciiArt(String aText,
int aWidth,
Font aFont,
char[] aPalette)
|
protected static String[] |
toAsciiArt(String aText,
int aWidth,
Font aFont,
char[] aPalette,
AsciiArtMode aAsciiArtMode)
To ascii art.
|
protected static String[] |
toAsciiArt(String aText,
int aWidth,
String aFontName,
int aFontStyle)
|
protected static String[] |
toAsciiArt(String aText,
int aWidth,
String aFontName,
int aFontStyle,
char[] aPalette)
|
protected static String[] |
toAsciiArt(String aText,
int aWidth,
String aFontName,
int aFontStyle,
int aFontSize,
char[] aPalette,
AsciiArtMode aAsciiArtMode)
To ascii art.
|
protected static String[] |
toInverseAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap,
char[] aPalette)
To inverse ascii art.
|
protected static String[] |
toInverseAsciiArt(String aText,
Font aFont)
Same as
toAsciiArt with inverted colors (black = white, dark =
bright, bright = dark, white = black). |
protected static String[] |
toInverseAsciiArt(String aText,
Font aFont,
char[] aPalette)
Same as
toAsciiArt with inverted colors (black = white, dark =
bright, bright = dark, white = black). |
protected static String[] |
toInverseAsciiArt(String aText,
int aWidth,
Font aFont,
char[] aPalette)
Same as
toAsciiArt with inverted colors (black = white, dark =
bright, bright = dark, white = black). |
protected static String[] |
toInverseAsciiArt(String aText,
int aWidth,
String aFontName,
int aFontStyle)
Same as
toAsciiArt with inverted colors (black = white, dark =
bright, bright = dark, white = black). |
protected static String[] |
toInverseAsciiArt(String aText,
int aWidth,
String aFontName,
int aFontStyle,
char[] aPalette)
Same as
toAsciiArt with inverted colors (black = white, dark =
bright, bright = dark, white = black). |
String |
toString()
The
String being build by the builder upon the settings of
the attributes. |
String |
toString(org.refcodes.graphical.RgbPixmap aPixmap)
Race condition safe shortcut for using
AsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed by TextAccessor.TextProvider.toString() . |
String |
toString(String... aText)
Race condition safe shortcut for using
Text.withText(String...) |
String[] |
toStrings()
The
String s being build by the builder upon the settings of
the attributes. |
String[] |
toStrings(org.refcodes.graphical.RgbPixmap aPixmap)
Race condition safe shortcut for using
AsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed by TextAccessor.TextProvider.toStrings() . |
String[] |
toStrings(String... aText)
Race condition safe shortcut for using
Text.withText(String...) |
AsciiArtBuilder |
withColumnWidth(int aColumnWidth) |
AsciiArtBuilder |
withFont(Font aFont)
Sets the font for the font property.
|
AsciiArtBuilder |
withFontName(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(Collection<String> aText)
With text.
|
B |
withText(String... aText)
With text.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
setAsciiColors, setImageFile, toString, toStrings, withAsciiArtMode, withAsciiColorPalette, withAsciiColors, withAsciiColors, withImageFile, withPixmapRatioMode, withRgbPixmap
getText
setText, setText
withText
toString
public PixmapRatioMode getPixmapRatioMode()
Pixmap
ratio mode from the Pixmap
ratio
mode property.getPixmapRatioMode
in interface AsciiArtBuilder
Pixmap
ratio mode stored by the Pixmap
ratio
mode property.public void setPixmapRatioMode(PixmapRatioMode aPixmapRatioMode)
Pixmap
ratio mode for the Pixmap
ratio mode
property.setPixmapRatioMode
in interface AsciiArtBuilder
aPixmapRatioMode
- The Pixmap
ratio mode to be stored by the
text strip mode property.public org.refcodes.graphical.RgbPixmap getRgbPixmap()
Pixmap
from the Pixmap
property.getRgbPixmap
in interface AsciiArtBuilder
Pixmap
stored by the Pixmap
property.public AsciiArtBuilder withColumnWidth(int aColumnWidth)
withColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<AsciiArtBuilder>
public void setColumnWidth(int aColumnWidth)
setColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
public int getColumnWidth()
getColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor
public Font getFont()
getFont
in interface FontAccessor
public void setFont(Font aFont)
setFont
in interface FontAccessor.FontMutator
aFont
- The font to be stored by the font property.public AsciiArtBuilder withFont(Font aFont)
withFont
in interface FontAccessor.FontBuilder<AsciiArtBuilder>
aFont
- The font to be stored by the font property.public AsciiArtMode getAsciiArtMode()
getAsciiArtMode
in interface AsciiArtBuilder
public void setAsciiArtMode(AsciiArtMode aAsciiArtMode)
setAsciiArtMode
in interface AsciiArtBuilder
aAsciiArtMode
- The ASCII art mode to be stored by the text strip
mode property.public char[] getAsciiColors()
getAsciiColors
in interface AsciiArtBuilder
public void setAsciiColors(char... aAsciiColors)
setAsciiColors
in interface AsciiArtBuilder
aAsciiColors
- The ASCII colors to be stored by the ASCII colors
property.public org.refcodes.data.AsciiColorPalette getAsciiColorPalette()
getAsciiColorPalette
in interface AsciiArtBuilder
public void setAsciiColorPalette(org.refcodes.data.AsciiColorPalette aAsciiColorPalette)
setAsciiColorPalette
in interface AsciiArtBuilder
aAsciiColorPalette
- The ASCII color palette to be stored by the
ASCII color palette property.public FontType getFontType()
getFontType
in interface FontTypeAccessor
public void setFontType(FontType aFontName)
setFontType
in interface FontTypeAccessor.FontTypeMutator
aFontName
- The font type to be stored by the font type
property.public AsciiArtBuilder withFontType(FontType aFontName)
withFontType
in interface FontTypeAccessor.FontTypeBuilder<AsciiArtBuilder>
aFontName
- The font type to be stored by the font type
property.public FontStyle getFontStyle()
getFontStyle
in interface FontStyleAccessor
public void setFontStyle(FontStyle aFontStyle)
setFontStyle
in interface FontStyleAccessor.FontStyleMutator
aFontStyle
- The font style to be stored by the font style
property.public AsciiArtBuilder withFontStyle(FontStyle aFontStyle)
withFontStyle
in interface FontStyleAccessor.FontStyleBuilder<AsciiArtBuilder>
aFontStyle
- The font style to be stored by the font style
property.public int getFontSize()
getFontSize
in interface FontSizeAccessor
public void setFontSize(int aFontSize)
setFontSize
in interface FontSizeAccessor.FontSizeMutator
aFontSize
- The font style to be stored by the font style
property.public AsciiArtBuilder withFontSize(int aFontSize)
withFontSize
in interface FontSizeAccessor.FontSizeBuilder<AsciiArtBuilder>
aFontSize
- The font style to be stored by the font style
property.public String getFontName()
getFontName
in interface FontNameAccessor
public void setFontName(String aFontName)
setFontName
in interface FontNameAccessor.FontNameMutator
aFontName
- The font name to be stored by the font name
property.public AsciiArtBuilder withFontName(String aFontName)
withFontName
in interface FontNameAccessor.FontNameBuilder<AsciiArtBuilder>
aFontName
- The font name to be stored by the font name
property.public void setRgbPixmap(org.refcodes.graphical.RgbPixmap aPixmap)
Pixmap
for the Pixmap
property.setRgbPixmap
in interface AsciiArtBuilder
aPixmap
- The Pixmap
to be stored by the Pixmap
property.public String[] toStrings()
String
s being build by the builder upon the settings of
the attributes.toStrings
in interface TextAccessor.TextProvider
String
arraypublic String[] toStrings(String... aText)
Text.withText(String...)
followed by TextAccessor.TextProvider.toStrings()
.
Implementation requirements: This method must not(!) be implemented by
calling Text.withText(String...)
followed by TextAccessor.TextProvider.toStrings()
(do
not change the text property) as this would not be thread safe!toStrings
in interface Text<AsciiArtBuilder>
aText
- The text to be processed.String
arraypublic String toString(org.refcodes.graphical.RgbPixmap aPixmap)
AsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed by TextAccessor.TextProvider.toString()
.
Implementation requirements: This method must not(!) be implemented by
calling AsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed by TextAccessor.TextProvider.toString()
(do not change the Pixmap
property) as this would not be thread
safe!toString
in interface AsciiArtBuilder
aPixmap
- The Pixmap
to be converted to AsciiArt.String
public String[] toStrings(org.refcodes.graphical.RgbPixmap aPixmap)
AsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed by TextAccessor.TextProvider.toStrings()
.
Implementation requirements: This method must not(!) be implemented by
calling AsciiArtBuilder.withRgbPixmap(RgbPixmap)
followed by
TextAccessor.TextProvider.toStrings()
(do not change the Pixmap
property) as this
would not be thread safe!toStrings
in interface AsciiArtBuilder
aPixmap
- The Pixmap
to be converted to AsciiArt.String
arrayprotected static String[] toAsciiArt(String[] aLines, int aWidth, String aFontName, int aFontStyle, int aFontSize, char[] aPalette, AsciiArtMode aAsciiArtMode)
aLines
- the linesaWidth
- the widthaFontName
- the font nameaFontStyle
- the font styleaFontSize
- the font sizeaPalette
- the paletteaAsciiArtMode
- the ascii art modeprotected static String[] toAsciiArt(String[] aLines, int aWidth, Font aFont, char[] aPalette, AsciiArtMode aAsciiArtMode)
aLines
- the linesaWidth
- the widthaFont
- the fontaPalette
- the paletteaAsciiArtMode
- the ascii art modeprotected static String[] toAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle, int aFontSize, char[] aPalette, AsciiArtMode aAsciiArtMode)
aText
- the textaWidth
- the widthaFontName
- the font nameaFontStyle
- the font styleaFontSize
- the font sizeaPalette
- the paletteaAsciiArtMode
- the ascii art modeprotected static String[] toAsciiArt(String aText, int aWidth, Font aFont, char[] aPalette, AsciiArtMode aAsciiArtMode)
aText
- the textaWidth
- the widthaFont
- the fontaPalette
- the paletteaAsciiArtMode
- the ascii art modeprotected static String[] toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, int aColumnWidth, char[] aPalette, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode)
aPixmap
- the pixmapaColumnWidth
- the column widthaPalette
- the paletteaAsciiArtMode
- the ascii art modeaPixmapRatioMode
- the pixmap ratio modeprotected static String[] toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette)
aPixmap
- the pixmapaPalette
- the paletteprotected static String[] toInverseAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette)
aPixmap
- the pixmapaPalette
- the paletteprotected static String[] toAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle, char[] aPalette)
String
instances containing the
given text as so called ASCII art rendered with the given Font
name and Font
Style
to fit into the given width.aText
- The text to be rendered as ASCII art.aWidth
- the widthaFontName
- The Font
name to be used when rendering to ASCII
art.aFontStyle
- The Font
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.String
instances, when printed out in the
order as returned, visualize the provided text in the given
Font
as ASCII art.protected static String[] toAsciiArt(String aText, int aWidth, Font aFont, char[] aPalette)
String
instances containing the
given text as so called ASCII art rendered with the given Font
name and Font
Style
to fit into the given width.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.String
instances, when printed out in the
order as returned, visualize the provided text in the given
Font
as ASCII art.protected static String[] toInverseAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle, char[] aPalette)
toAsciiArt
with inverted colors (black = white, dark =
bright, bright = dark, white = black).aText
- The text to be rendered as ASCII art.aWidth
- the widthaFontName
- The Font
name to be used when rendering to ASCII
art.aFontStyle
- The Font
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.String
instances, when printed out in the
order as returned, visualize the provided text in the given
Font
as ASCII art.protected static String[] toInverseAsciiArt(String aText, int aWidth, Font aFont, char[] aPalette)
toAsciiArt
with inverted colors (black = white, dark =
bright, bright = dark, white = black).aText
- The text to be rendered as ASCII art.aWidth
- the widthaFont
- The Font
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.String
instances, when printed out in the
order as returned, visualize the provided text in the given
Font
as ASCII art.protected static String[] toAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle)
String
instances containing the
given text as so called ASCII art rendered with the given Font
name and Font
Style
to fit into the given width.aText
- The text to be rendered as ASCII art.aWidth
- the widthaFontName
- The Font
name to be used when rendering to ASCII
art.aFontStyle
- The Font
style to be used when rendering to
ASCII art.String
instances, when printed out in the
order as returned, visualize the provided text in the given
Font
as ASCII art.protected static String[] toInverseAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle)
toAsciiArt
with inverted colors (black = white, dark =
bright, bright = dark, white = black).aText
- The text to be rendered as ASCII art.aWidth
- the widthaFontName
- The Font
name to be used when rendering to ASCII
art.aFontStyle
- The Font
style to be used when rendering to
ASCII art.String
instances, when printed out in the
order as returned, visualize the provided text in the given
Font
as ASCII art.protected static String[] toInverseAsciiArt(String aText, Font aFont)
toAsciiArt
with inverted colors (black = white, dark =
bright, bright = dark, white = black).protected static String[] toAsciiArt(String aText, Font aFont, char[] aPalette)
String
instances containing the
given text rendered with the given Font
as so called ASCII art.aText
- The text to be rendered as ASCII art.aFont
- The Font
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.String
instances, when printed out in the
order as returned, visualize the provided text in the given
Font
as ASCII art.protected static String[] toInverseAsciiArt(String aText, Font aFont, char[] aPalette)
toAsciiArt
with inverted colors (black = white, dark =
bright, bright = dark, white = black).aText
- The text to be rendered as ASCII art.aFont
- The Font
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.String
instances, when printed out in the
order as returned, visualize the provided text in the given
Font
as ASCII art.protected static char toAscii(int aRgbValue, char[] aPalette)
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.protected static char toAscii(int aRgbValue)
aRgbValue
- The RGB value to be converted to an ASCII character.public String[] getText()
getText
in interface TextAccessor
public void setText(String... aText)
setText
in interface TextAccessor.TextMutator
aText
- The text to be stored by the text property.public B withText(String... aText)
public B withText(Collection<String> aText)
withText
in interface TextAccessor.TextBuilder<Text<B extends Text<B>>>
aText
- the textpublic String toString()
String
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).toString
in interface TextAccessor.TextProvider
toString
in class Object
String
public String toString(String... aText)
Text.withText(String...)
followed by TextAccessor.TextProvider.toString()
.
Implementation requirements: This method must not(!) be implemented by
calling Text.withText(String...)
followed by TextAccessor.TextProvider.toString()
(do
not change the text property) as this would not be thread safe!Copyright © 2018. All rights reserved.