java.lang.Object
org.refcodes.textual.AsciiArtBuilder
- All Implemented Interfaces:
org.refcodes.mixin.ColumnWidthAccessor
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<AsciiArtBuilder>
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
,FontAccessor
,FontAccessor.FontBuilder<AsciiArtBuilder>
,FontAccessor.FontMutator
,FontAccessor.FontProperty
,FontFamilyAccessor
,FontFamilyAccessor.FontFamilyBuilder<AsciiArtBuilder>
,FontFamilyAccessor.FontFamilyMutator
,FontFamilyAccessor.FontFamilyProperty
,FontNameAccessor
,FontNameAccessor.FontNameBuilder<AsciiArtBuilder>
,FontNameAccessor.FontNameMutator
,FontNameAccessor.FontNameProperty
,FontSizeAccessor
,FontSizeAccessor.FontSizeBuilder<AsciiArtBuilder>
,FontSizeAccessor.FontSizeMutator
,FontSizeAccessor.FontSizeProperty
,FontStyleAccessor
,FontStyleAccessor.FontStyleBuilder<AsciiArtBuilder>
,FontStyleAccessor.FontStyleMutator
,FontStyleAccessor.FontStyleProperty
,Text<AsciiArtBuilder>
,TextAccessor
,TextAccessor.TextBuilder<Text<AsciiArtBuilder>>
,TextAccessor.TextMutator
,TextAccessor.TextProperty
,TextAccessor.TextProvider
public class AsciiArtBuilder
extends Object
implements FontAccessor.FontProperty, FontAccessor.FontBuilder<AsciiArtBuilder>, FontFamilyAccessor.FontFamilyProperty, FontFamilyAccessor.FontFamilyBuilder<AsciiArtBuilder>, FontStyleAccessor.FontStyleProperty, FontStyleAccessor.FontStyleBuilder<AsciiArtBuilder>, FontSizeAccessor.FontSizeProperty, FontSizeAccessor.FontSizeBuilder<AsciiArtBuilder>, FontNameAccessor.FontNameProperty, FontNameAccessor.FontNameBuilder<AsciiArtBuilder>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<AsciiArtBuilder>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
ASCII-Art as of the
AsciiArtBuilder
is represented by an array of
String
instances "visualizing" a given text (rendered with the given
Font
) or image as so called ASCII_HEADER_ASCII_BODY art.
ASCII_HEADER_ASCII_BODY characters are used as "pixels" when "paining" the
text or image into the String
array. Different
ASCII_HEADER_ASCII_BODY characters represent different levels of brightness
for a "pixel".-
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.FontFamilyAccessor
FontFamilyAccessor.FontFamilyBuilder<B extends FontFamilyAccessor.FontFamilyBuilder<B>>, FontFamilyAccessor.FontFamilyMutator, FontFamilyAccessor.FontFamilyProperty
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.TextAccessor
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String[]
asAsciiArt
(int aWidth, Font aFont, AsciiArtMode aAsciiArtMode, char[] aPalette, String... aLines) Produces ASCII-Art from the provided arguments.static String[]
asAsciiArt
(int aWidth, Font aFont, AsciiArtMode aAsciiArtMode, String[] aLines, char... aPalette) Produces ASCII-Art from the provided arguments.static String[]
asAsciiArt
(File aImageFile, int aWidth, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode, char... aPalette) Produces ASCII-Art from the provided arguments.static String[]
asAsciiArt
(InputStream aImageStream, int aWidth, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode, char... aPalette) Produces ASCII-Art from the provided arguments.static String[]
asAsciiArt
(String aText, int aWidth, Font aFont, AsciiArtMode aAsciiArtMode, char... aPalette) Produces ASCII-Art from the provided arguments.static String[]
asAsciiArt
(org.refcodes.graphical.RgbPixmap aPixmap, int aWidth, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode, char... aPalette) Produces ASCII-Art from the provided arguments.static String[]
asSimpleBanner
(String aText, int aWidth, AsciiArtMode aAsciiArtMode, char... aPalette) Fallback in case creating the ASCII-Art banner failed (can happen in the GraalVM with poor AWT support for rendering fonts.Retrieves the ASCII-Art mode from the ASCII-Art mode property.org.refcodes.data.AsciiColorPalette
Retrieves the ASCII_HEADER_ASCII_BODY color palette from the ASCII_HEADER_ASCII_BODY color palette property.char[]
Retrieves the ASCII_HEADER_ASCII_BODY colors from the ASCII_HEADER_ASCII_BODY colors property.int
getFont()
Retrieves the font from the font property.Retrieves the font family from the font family property.Retrieves the font name from the font name property.int
Retrieves the font style from the font style property.Retrieves the font style from the font style property.Retrieves thePixmap
ratio mode from thePixmap
ratio mode property.org.refcodes.graphical.RgbPixmap
Retrieves thePixmap
from thePixmap
property.String[]
getText()
Retrieves the text from the text property.void
setAsciiArtMode
(AsciiArtMode aAsciiArtMode) Sets the ASCII-Art mode for the ASCII_HEADER_ASCII_BODY art mode property.void
setAsciiColorPalette
(org.refcodes.data.AsciiColorPalette aAsciiColorPalette) Sets the ASCII_HEADER_ASCII_BODY color palette for the ASCII_HEADER_ASCII_BODY color palette property.void
setAsciiColors
(char... aAsciiColors) Sets the ASCII_HEADER_ASCII_BODY colors for the ASCII_HEADER_ASCII_BODY colors property.void
setAsciiColors
(String aAsciiColors) Sets the ASCII_HEADER_ASCII_BODY colors for the ASCII_HEADER_ASCII_BODY colors property.void
setColumnWidth
(int aColumnWidth) void
Sets the font for the font property.void
setFontFamily
(FontFamily aFontName) Sets the font family for the font family 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
setImageFile
(File aImageFile) Sets the image file for thePixmap
property.void
setImageInputStream
(InputStream aImageStream) Sets the image'sInputStream
for thePixmap
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
Sets the text for the text property.protected static char
toAscii
(int aRgbValue) Converts an RGB value to an ASCII_HEADER_ASCII_BODY character from a palette if characters as provided.protected static char
toAscii
(int aRgbValue, char[] aPalette) Converts an RGB value to an ASCII_HEADER_ASCII_BODY character from a palette if characters as provided.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, Font aFont, char[] aPalette) protected static String[]
toAsciiArt
(String aText, Font aFont) protected static String[]
toAsciiArt
(String aText, Font aFont, char[] aPalette) protected static String[]
toAsciiArt
(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette) To ascii art.protected static String[]
toInverseAsciiArt
(String aText, int aWidth, String aFontName, int aFontStyle) Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
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 astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static String[]
toInverseAsciiArt
(String aText, int aWidth, Font aFont, char[] aPalette) Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static String[]
toInverseAsciiArt
(String aText, Font aFont) Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static String[]
toInverseAsciiArt
(String aText, Font aFont, char[] aPalette) Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
with inverted colors (black = white, dark = bright, bright = dark, white = black).protected static String[]
toInverseAsciiArt
(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette) To inverse ascii art.toString()
TheString
being build by the builder upon the settings of the attributes.Race condition safe shortcut for usingwithImageFile(File)
followed byTextAccessor.TextProvider.toString()
.toString
(InputStream aImageStream) Race condition safe shortcut for usingwithImageFile(File)
followed byTextAccessor.TextProvider.toString()
.Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
.toString
(org.refcodes.graphical.RgbPixmap aPixmap) Race condition safe shortcut for usingwithRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toString()
.String[]
TheString
s being build by the builder upon the settings of the attributes.String[]
Race condition safe shortcut for usingwithImageFile(File)
followed bytoStrings()
.String[]
toStrings
(InputStream aImageStream) Race condition safe shortcut for usingwithImageFile(File)
followed bytoStrings()
.String[]
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
.String[]
toStrings
(org.refcodes.graphical.RgbPixmap aPixmap) Race condition safe shortcut for usingwithRgbPixmap(RgbPixmap)
followed bytoStrings()
.withAsciiArtMode
(AsciiArtMode aAsciiArtMode) Sets the ASCII-Art mode for the ASCII_HEADER_ASCII_BODY art mode property.withAsciiColorPalette
(org.refcodes.data.AsciiColorPalette aAsciiColorPalette) Sets the ASCII_HEADER_ASCII_BODY color palette for the ASCII_HEADER_ASCII_BODY color palette property.withAsciiColors
(char... aAsciiColors) Sets the ASCII_HEADER_ASCII_BODY colors for the ASCII_HEADER_ASCII_BODY colors property.withAsciiColors
(String aAsciiColors) Sets the ASCII_HEADER_ASCII_BODY colors for the ASCII_HEADER_ASCII_BODY colors property.withColumnWidth
(int aColumnWidth) Sets the font for the font property.withFontFamily
(FontFamily aFontName) Sets the font family for the font family property.withFontName
(String aFontName) Sets the font name for the font name property.withFontSize
(int aFontSize) Sets the font style for the font style property.withFontStyle
(FontStyle aFontStyle) Sets the font style for the font style property.withImageFile
(File aImageFile) Sets the image file for thePixmap
property.withImageInputStream
(InputStream aImageStream) Sets the image'sInputStream
for thePixmap
property.withPixmapRatioMode
(PixmapRatioMode aPixmapRatioMode) Sets thePixmap
ratio mode for thePixmap
ratio mode property.withRgbPixmap
(org.refcodes.graphical.RgbPixmap aPixmap) Sets thePixmap
for thePixmap
property.With text.withText
(Collection<String> aText) With text.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
letColumnWidth
Methods inherited from interface org.refcodes.textual.FontAccessor.FontProperty
letFont
Methods inherited from interface org.refcodes.textual.FontFamilyAccessor.FontFamilyProperty
letFontFamily
Methods inherited from interface org.refcodes.textual.FontNameAccessor.FontNameProperty
letFontName
Methods inherited from interface org.refcodes.textual.FontSizeAccessor.FontSizeProperty
letFontSize
Methods inherited from interface org.refcodes.textual.FontStyleAccessor.FontStyleProperty
letFontStyle
Methods inherited from interface org.refcodes.textual.TextAccessor.TextMutator
setText
Methods inherited from interface org.refcodes.textual.TextAccessor.TextProperty
letText, letText
-
Constructor Details
-
AsciiArtBuilder
public AsciiArtBuilder()
-
-
Method Details
-
getPixmapRatioMode
Retrieves thePixmap
ratio mode from thePixmap
ratio mode property.- Returns:
- The
Pixmap
ratio mode stored by thePixmap
ratio mode property.
-
setPixmapRatioMode
Sets thePixmap
ratio mode for thePixmap
ratio mode property.- 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.- Returns:
- The
Pixmap
stored by thePixmap
property.
-
withColumnWidth
- 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
Retrieves the font from the font property.- Specified by:
getFont
in interfaceFontAccessor
- Returns:
- The font stored by the font property.
-
setFont
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
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
Retrieves the ASCII-Art mode from the ASCII-Art mode property.- Returns:
- The ASCII-Art mode stored by the ASCII-Art mode property.
-
setAsciiArtMode
Sets the ASCII-Art mode for the ASCII_HEADER_ASCII_BODY art mode property.- Parameters:
aAsciiArtMode
- The ASCII-Art mode to be stored by the text strip mode property.
-
getAsciiColors
public char[] getAsciiColors()Retrieves the ASCII_HEADER_ASCII_BODY colors from the ASCII_HEADER_ASCII_BODY colors property.- Returns:
- The ASCII_HEADER_ASCII_BODY colors stored by the ASCII_HEADER_ASCII_BODY colors property.
-
setAsciiColors
public void setAsciiColors(char... aAsciiColors) Sets the ASCII_HEADER_ASCII_BODY colors for the ASCII_HEADER_ASCII_BODY colors property.- Parameters:
aAsciiColors
- The ASCII_HEADER_ASCII_BODY colors to be stored by the ASCII_HEADER_ASCII_BODY colors property.
-
getAsciiColorPalette
public org.refcodes.data.AsciiColorPalette getAsciiColorPalette()Retrieves the ASCII_HEADER_ASCII_BODY color palette from the ASCII_HEADER_ASCII_BODY color palette property.- Returns:
- The ASCII_HEADER_ASCII_BODY color palette stored by the ASCII_HEADER_ASCII_BODY color palette property.
-
setAsciiColorPalette
public void setAsciiColorPalette(org.refcodes.data.AsciiColorPalette aAsciiColorPalette) Sets the ASCII_HEADER_ASCII_BODY color palette for the ASCII_HEADER_ASCII_BODY color palette property.- Parameters:
aAsciiColorPalette
- The ASCII_HEADER_ASCII_BODY color palette to be stored by the ASCII_HEADER_ASCII_BODY color palette property.
-
getFontFamily
Retrieves the font family from the font family property.- Specified by:
getFontFamily
in interfaceFontFamilyAccessor
- Returns:
- The font family stored by the font family property.
-
setFontFamily
Sets the font family for the font family property.- Specified by:
setFontFamily
in interfaceFontFamilyAccessor.FontFamilyMutator
- Parameters:
aFontName
- The font family to be stored by the font family property.
-
withFontFamily
Sets the font family for the font family property.- Specified by:
withFontFamily
in interfaceFontFamilyAccessor.FontFamilyBuilder<AsciiArtBuilder>
- Parameters:
aFontName
- The font family to be stored by the font family property.- Returns:
- The builder for applying multiple build operations.
-
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
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
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
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
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
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
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.- Parameters:
aPixmap
- ThePixmap
to be stored by thePixmap
property.
-
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
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
Race condition safe shortcut for usingwithRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toString()
. Implementation requirements: This method must not(!) be implemented by callingwithRgbPixmap(RgbPixmap)
followed byTextAccessor.TextProvider.toString()
(do not change thePixmap
property) as this would not be thread safe!- Parameters:
aPixmap
- ThePixmap
to be converted to ASCII-Art.- Returns:
- The according resulting
String
-
toStrings
Race condition safe shortcut for usingwithRgbPixmap(RgbPixmap)
followed bytoStrings()
. Implementation requirements: This method must not(!) be implemented by callingwithRgbPixmap(RgbPixmap)
followed bytoStrings()
(do not change thePixmap
property) as this would not be thread safe!- Parameters:
aPixmap
- ThePixmap
to be converted to ASCII-Art.- Returns:
- The according resulting
String
array
-
withAsciiArtMode
Sets the ASCII-Art mode for the ASCII_HEADER_ASCII_BODY art mode property.- Parameters:
aAsciiArtMode
- The ASCII-Art mode to be stored by the text strip mode property.- Returns:
- The builder for applying multiple build operations.
-
withPixmapRatioMode
Sets thePixmap
ratio mode for thePixmap
ratio mode property.- Parameters:
aPixmapRatioMode
- ThePixmap
ratio mode to be stored by the text strip mode property.- Returns:
- The builder for applying multiple build operations.
-
withAsciiColors
Sets the ASCII_HEADER_ASCII_BODY colors for the ASCII_HEADER_ASCII_BODY colors property.- Parameters:
aAsciiColors
- The ASCII_HEADER_ASCII_BODY colors to be stored by the ASCII_HEADER_ASCII_BODY colors property.- Returns:
- The builder for applying multiple build operations.
-
setAsciiColors
Sets the ASCII_HEADER_ASCII_BODY colors for the ASCII_HEADER_ASCII_BODY colors property.- Parameters:
aAsciiColors
- The ASCII_HEADER_ASCII_BODY colors to be stored by the ASCII_HEADER_ASCII_BODY colors property.
-
withAsciiColors
Sets the ASCII_HEADER_ASCII_BODY colors for the ASCII_HEADER_ASCII_BODY colors property.- Parameters:
aAsciiColors
- The ASCII_HEADER_ASCII_BODY colors to be stored by the ASCII_HEADER_ASCII_BODY colors property.- Returns:
- The builder for applying multiple build operations.
-
withAsciiColorPalette
public AsciiArtBuilder withAsciiColorPalette(org.refcodes.data.AsciiColorPalette aAsciiColorPalette) Sets the ASCII_HEADER_ASCII_BODY color palette for the ASCII_HEADER_ASCII_BODY color palette property.- Parameters:
aAsciiColorPalette
- The ASCII_HEADER_ASCII_BODY color palette to be stored by the ASCII_HEADER_ASCII_BODY color palette property.- Returns:
- The builder for applying multiple build operations.
-
withRgbPixmap
Sets thePixmap
for thePixmap
property.- Parameters:
aPixmap
- ThePixmap
to be stored by thePixmap
property.- Returns:
- The builder for applying multiple build operations.
-
setImageFile
Sets the image file for thePixmap
property.- Parameters:
aImageFile
- The image file from which to retrieve thePixmap
which is to be stored by thePixmap
property.- Throws:
IOException
- in case the file was not found.
-
withImageFile
Sets the image file for thePixmap
property.- Parameters:
aImageFile
- The image file for thePixmap
to be stored by thePixmap
property.- Returns:
- The builder for applying multiple build operations.
- Throws:
IOException
- in case the file was not found.
-
setImageInputStream
Sets the image'sInputStream
for thePixmap
property.- Parameters:
aImageStream
- The image'sInputStream
from which to retrieve thePixmap
which is to be stored by thePixmap
property.- Throws:
IOException
- in case the file was not found.
-
withImageInputStream
Sets the image'sInputStream
for thePixmap
property.- Parameters:
aImageStream
- The image'sInputStream
for thePixmap
to be stored by thePixmap
property.- Returns:
- The builder for applying multiple build operations.
- Throws:
IOException
- in case the file was not found.
-
toString
Race condition safe shortcut for usingwithImageFile(File)
followed byTextAccessor.TextProvider.toString()
. Implementation requirements: This method must not(!) be implemented by callingwithImageFile(File)
followed byTextAccessor.TextProvider.toString()
(do not change thePixmap
property) as this would not be thread safe!- Parameters:
aImageStream
- The image'sInputStream
for thePixmap
to be stored by thePixmap
property.- Returns:
- The according resulting
String
- Throws:
IOException
- in case the file was not found
-
toStrings
Race condition safe shortcut for usingwithImageFile(File)
followed bytoStrings()
. Implementation requirements: This method must not(!) be implemented by callingwithImageFile(File)
followed bytoStrings()
(do not change thePixmap
property) as this would not be thread safe!- Parameters:
aImageStream
- The image'sInputStream
for thePixmap
to be stored by thePixmap
property.- Returns:
- The according resulting
String
array - Throws:
IOException
- in case the file was not found or the like.
-
toString
Race condition safe shortcut for usingwithImageFile(File)
followed byTextAccessor.TextProvider.toString()
. Implementation requirements: This method must not(!) be implemented by callingwithImageFile(File)
followed byTextAccessor.TextProvider.toString()
(do not change thePixmap
property) as this would not be thread safe!- Parameters:
aImageFile
- The image file to be converted to ASCII-Art.- Returns:
- The according resulting
String
- Throws:
IOException
- in case the file was not found
-
toStrings
Race condition safe shortcut for usingwithImageFile(File)
followed bytoStrings()
. Implementation requirements: This method must not(!) be implemented by callingwithImageFile(File)
followed bytoStrings()
(do not change thePixmap
property) as this would not be thread safe!- Parameters:
aImageFile
- The image file to be converted to ASCII-Art.- Returns:
- The according resulting
String
array - Throws:
IOException
- in case the file was not found or the like.
-
asAsciiArt
public static String[] asAsciiArt(int aWidth, Font aFont, AsciiArtMode aAsciiArtMode, String[] aLines, char... aPalette) Produces ASCII-Art from the provided arguments.- Parameters:
aWidth
- The width for the resulting ASCII-Art.aFont
- TheFont
to use for printing ASCII-Art.aAsciiArtMode
- TheAsciiArtMode
specifies whether to invert the resulting ASCII-Art or not.aLines
- The text lines to convert to ASCII-Art.aPalette
- TheCharacter
set used as ASCII-Art color palette.- Returns:
- The resulting ASCII-Art.
-
asAsciiArt
public static String[] asAsciiArt(int aWidth, Font aFont, AsciiArtMode aAsciiArtMode, char[] aPalette, String... aLines) Produces ASCII-Art from the provided arguments.- Parameters:
aWidth
- The width for the resulting ASCII-Art.aFont
- TheFont
to use for printing ASCII-Art.aAsciiArtMode
- TheAsciiArtMode
specifies whether to invert the resulting ASCII-Art or not.aPalette
- TheCharacter
set used as ASCII-Art color palette.aLines
- The text lines to convert to ASCII-Art.- Returns:
- The resulting ASCII-Art.
-
asAsciiArt
public static String[] asAsciiArt(String aText, int aWidth, Font aFont, AsciiArtMode aAsciiArtMode, char... aPalette) Produces ASCII-Art from the provided arguments.- Parameters:
aText
- The text to convert to ASCII-Art.aWidth
- The width for the resulting ASCII-Art.aFont
- TheFont
to use for printing ASCII-Art.aAsciiArtMode
- TheAsciiArtMode
specifies whether to invert the resulting ASCII-Art or not.aPalette
- TheCharacter
set used as ASCII-Art color palette.- Returns:
- The resulting ASCII-Art.
-
asSimpleBanner
public static String[] asSimpleBanner(String aText, int aWidth, AsciiArtMode aAsciiArtMode, char... aPalette) Fallback in case creating the ASCII-Art banner failed (can happen in the GraalVM with poor AWT support for rendering fonts.- Parameters:
aText
- The text to convert to ASCII-Art.aWidth
- The width for the resulting ASCII-Art.aAsciiArtMode
- TheAsciiArtMode
specifies whether to invert the resulting ASCII-Art or not.aPalette
- TheCharacter
set used as ASCII-Art color palette.- Returns:
- The resulting simple banner.
-
asAsciiArt
public static String[] asAsciiArt(File aImageFile, int aWidth, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode, char... aPalette) throws IOException Produces ASCII-Art from the provided arguments.- Parameters:
aImageFile
- The image file to be converted to ASCII-Art.aWidth
- The width for the resulting ASCII-Art.aAsciiArtMode
- TheAsciiArtMode
specifies whether to invert the resulting ASCII-Art or not.aPixmapRatioMode
- ThePixmapRatioMode
describes how to scale thePixmap
ratio for ASCII-Art as aCharacter
on the screen does not have a ratio of 1:1 (in comparison to a pixel which usually has a ration of 1:1).aPalette
- TheCharacter
set used as ASCII-Art color palette.- Returns:
- The resulting ASCII-Art.
- Throws:
IOException
- in case the file was not found or the like.
-
asAsciiArt
public static String[] asAsciiArt(InputStream aImageStream, int aWidth, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode, char... aPalette) throws IOException Produces ASCII-Art from the provided arguments.- Parameters:
aImageStream
- The image'sInputStream
to be converted to ASCII-Art.aWidth
- The width for the resulting ASCII-Art.aAsciiArtMode
- TheAsciiArtMode
specifies whether to invert the resulting ASCII-Art or not.aPixmapRatioMode
- ThePixmapRatioMode
describes how to scale thePixmap
ratio for ASCII-Art as aCharacter
on the screen does not have a ratio of 1:1 (in comparison to a pixel which usually has a ration of 1:1).aPalette
- TheCharacter
set used as ASCII-Art color palette.- Returns:
- The resulting ASCII-Art.
- Throws:
IOException
- in case the file was not found or the like.
-
asAsciiArt
public static String[] asAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, int aWidth, AsciiArtMode aAsciiArtMode, PixmapRatioMode aPixmapRatioMode, char... aPalette) Produces ASCII-Art from the provided arguments.- Parameters:
aPixmap
- ThePixmap
which to convert to ASCII-Art.aWidth
- The width for the resulting ASCII-Art.aAsciiArtMode
- TheAsciiArtMode
specifies whether to invert the resulting ASCII-Art or not.aPixmapRatioMode
- ThePixmapRatioMode
describes how to scale thePixmap
ratio for ASCII-Art as aCharacter
on the screen does not have a ratio of 1:1 (in comparison to a pixel which usually has a ration of 1:1).aPalette
- TheCharacter
set used as ASCII-Art color palette.- Returns:
- The resulting ASCII-Art.
-
toAsciiArt
To ascii art.- Parameters:
aPixmap
- the pixmapaPalette
- the palette- Returns:
- the string[]
-
toInverseAsciiArt
protected static 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 String[] toAsciiArt(String aText, int aWidth, 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
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_HEADER_ASCII_BODY 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
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_HEADER_ASCII_BODY 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 String[] toInverseAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle, char[] aPalette) Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
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_HEADER_ASCII_BODY 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
Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
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_HEADER_ASCII_BODY 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
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 String[] toInverseAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle) Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
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
-
toInverseAsciiArt
Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
with inverted colors (black = white, dark = bright, bright = dark, white = black). -
toAsciiArt
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_HEADER_ASCII_BODY 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
Same astoAsciiArt(org.refcodes.graphical.RgbPixmap,char[])
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_HEADER_ASCII_BODY 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_HEADER_ASCII_BODY character from a palette if characters as provided.- Parameters:
aRgbValue
- The RGB value to be converted to an ASCII_HEADER_ASCII_BODY character.aPalette
- The character palate to use when converting an RGB value to an ASCII_HEADER_ASCII_BODY 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_HEADER_ASCII_BODY character from a palette if characters as provided.- Parameters:
aRgbValue
- The RGB value to be converted to an ASCII_HEADER_ASCII_BODY character.- Returns:
- the char
-
getText
Retrieves the text from the text property.- Specified by:
getText
in interfaceTextAccessor
- Returns:
- The text stored by the text property.
-
setText
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
With text. -
withText
With text.- Specified by:
withText
in interfaceTextAccessor.TextBuilder<B extends Text<B>>
- Parameters:
aText
- the text- Returns:
- the b
-
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 classObject
- Returns:
- The according resulting
String
-
toString
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!
-