Class AsciiArtBuilder

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

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".
  • Constructor Details

    • AsciiArtBuilder

      public AsciiArtBuilder()
  • Method Details

    • getPixmapRatioMode

      public PixmapRatioMode getPixmapRatioMode()
      Retrieves the Pixmap ratio mode from the Pixmap ratio mode property.
      Returns:
      The Pixmap ratio mode stored by the Pixmap ratio mode property.
    • setPixmapRatioMode

      public void setPixmapRatioMode(PixmapRatioMode aPixmapRatioMode)
      Sets the Pixmap ratio mode for the Pixmap ratio mode property.
      Parameters:
      aPixmapRatioMode - The Pixmap ratio mode to be stored by the text strip mode property.
    • getRgbPixmap

      public org.refcodes.graphical.RgbPixmap getRgbPixmap()
      Retrieves the Pixmap from the Pixmap property.
      Returns:
      The Pixmap stored by the Pixmap property.
    • withColumnWidth

      public AsciiArtBuilder withColumnWidth(int aColumnWidth)
      Specified by:
      withColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<AsciiArtBuilder>
    • setColumnWidth

      public void setColumnWidth(int aColumnWidth)
      Specified by:
      setColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
    • getColumnWidth

      public int getColumnWidth()
      Specified by:
      getColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor
    • getFont

      public Font getFont()
      Retrieves the font from the font property.
      Specified by:
      getFont in interface FontAccessor
      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 interface FontAccessor.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 interface FontAccessor.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.
      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_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

      public FontFamily getFontFamily()
      Retrieves the font family from the font family property.
      Specified by:
      getFontFamily in interface FontFamilyAccessor
      Returns:
      The font family stored by the font family property.
    • setFontFamily

      public void setFontFamily(FontFamily aFontName)
      Sets the font family for the font family property.
      Specified by:
      setFontFamily in interface FontFamilyAccessor.FontFamilyMutator
      Parameters:
      aFontName - The font family to be stored by the font family property.
    • withFontFamily

      public AsciiArtBuilder withFontFamily(FontFamily aFontName)
      Sets the font family for the font family property.
      Specified by:
      withFontFamily in interface FontFamilyAccessor.FontFamilyBuilder<AsciiArtBuilder>
      Parameters:
      aFontName - The font family to be stored by the font family 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 interface FontStyleAccessor
      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 interface FontStyleAccessor.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 interface FontStyleAccessor.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 interface FontSizeAccessor
      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 interface FontSizeAccessor.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 interface FontSizeAccessor.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 String getFontName()
      Retrieves the font name from the font name property.
      Specified by:
      getFontName in interface FontNameAccessor
      Returns:
      The font name stored by the font name property.
    • setFontName

      public void setFontName(String aFontName)
      Sets the font name for the font name property.
      Specified by:
      setFontName in interface FontNameAccessor.FontNameMutator
      Parameters:
      aFontName - The font name to be stored by the font name property.
    • withFontName

      public AsciiArtBuilder withFontName(String aFontName)
      Sets the font name for the font name property.
      Specified by:
      withFontName in interface FontNameAccessor.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 the Pixmap for the Pixmap property.
      Parameters:
      aPixmap - The Pixmap to be stored by the Pixmap property.
    • toStrings

      public String[] toStrings()
      The Strings being build by the builder upon the settings of the attributes.
      Specified by:
      toStrings in interface TextAccessor.TextProvider
      Returns:
      The according resulting String array
    • toStrings

      public String[] toStrings(String... aText)
      Race condition safe shortcut for using 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!
      Specified by:
      toStrings in interface Text<AsciiArtBuilder>
      Parameters:
      aText - The text to be processed.
      Returns:
      The according resulting String array
    • toString

      public String toString(org.refcodes.graphical.RgbPixmap aPixmap)
      Race condition safe shortcut for using withRgbPixmap(RgbPixmap) followed by TextAccessor.TextProvider.toString(). Implementation requirements: This method must not(!) be implemented by calling withRgbPixmap(RgbPixmap) followed by TextAccessor.TextProvider.toString() (do not change the Pixmap property) as this would not be thread safe!
      Parameters:
      aPixmap - The Pixmap to be converted to ASCII-Art.
      Returns:
      The according resulting String
    • toStrings

      public String[] toStrings(org.refcodes.graphical.RgbPixmap aPixmap)
      Race condition safe shortcut for using withRgbPixmap(RgbPixmap) followed by toStrings(). Implementation requirements: This method must not(!) be implemented by calling withRgbPixmap(RgbPixmap) followed by toStrings() (do not change the Pixmap property) as this would not be thread safe!
      Parameters:
      aPixmap - The Pixmap to be converted to ASCII-Art.
      Returns:
      The according resulting String array
    • withAsciiArtMode

      public AsciiArtBuilder withAsciiArtMode(AsciiArtMode aAsciiArtMode)
      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

      public AsciiArtBuilder withPixmapRatioMode(PixmapRatioMode aPixmapRatioMode)
      Sets the Pixmap ratio mode for the Pixmap ratio mode property.
      Parameters:
      aPixmapRatioMode - The Pixmap ratio mode to be stored by the text strip mode property.
      Returns:
      The builder for applying multiple build operations.
    • withAsciiColors

      public AsciiArtBuilder withAsciiColors(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.
      Returns:
      The builder for applying multiple build operations.
    • setAsciiColors

      public void setAsciiColors(String 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.
    • withAsciiColors

      public AsciiArtBuilder withAsciiColors(String 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.
      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

      public AsciiArtBuilder withRgbPixmap(org.refcodes.graphical.RgbPixmap aPixmap)
      Sets the Pixmap for the Pixmap property.
      Parameters:
      aPixmap - The Pixmap to be stored by the Pixmap property.
      Returns:
      The builder for applying multiple build operations.
    • setImageFile

      public void setImageFile(File aImageFile) throws IOException
      Sets the image file for the Pixmap property.
      Parameters:
      aImageFile - The image file from which to retrieve the Pixmap which is to be stored by the Pixmap property.
      Throws:
      IOException - in case the file was not found.
    • withImageFile

      public AsciiArtBuilder withImageFile(File aImageFile) throws IOException
      Sets the image file for the Pixmap property.
      Parameters:
      aImageFile - The image file for the Pixmap to be stored by the Pixmap property.
      Returns:
      The builder for applying multiple build operations.
      Throws:
      IOException - in case the file was not found.
    • setImageInputStream

      public void setImageInputStream(InputStream aImageStream) throws IOException
      Sets the image's InputStream for the Pixmap property.
      Parameters:
      aImageStream - The image's InputStream from which to retrieve the Pixmap which is to be stored by the Pixmap property.
      Throws:
      IOException - in case the file was not found.
    • withImageInputStream

      public AsciiArtBuilder withImageInputStream(InputStream aImageStream) throws IOException
      Sets the image's InputStream for the Pixmap property.
      Parameters:
      aImageStream - The image's InputStream for the Pixmap to be stored by the Pixmap property.
      Returns:
      The builder for applying multiple build operations.
      Throws:
      IOException - in case the file was not found.
    • toString

      public String toString(InputStream aImageStream) throws IOException
      Race condition safe shortcut for using withImageFile(File) followed by TextAccessor.TextProvider.toString(). Implementation requirements: This method must not(!) be implemented by calling withImageFile(File) followed by TextAccessor.TextProvider.toString() (do not change the Pixmap property) as this would not be thread safe!
      Parameters:
      aImageStream - The image's InputStream for the Pixmap to be stored by the Pixmap property.
      Returns:
      The according resulting String
      Throws:
      IOException - in case the file was not found
    • toStrings

      public String[] toStrings(InputStream aImageStream) throws IOException
      Race condition safe shortcut for using withImageFile(File) followed by toStrings(). Implementation requirements: This method must not(!) be implemented by calling withImageFile(File) followed by toStrings() (do not change the Pixmap property) as this would not be thread safe!
      Parameters:
      aImageStream - The image's InputStream for the Pixmap to be stored by the Pixmap property.
      Returns:
      The according resulting String array
      Throws:
      IOException - in case the file was not found or the like.
    • toString

      public String toString(File aImageFile) throws IOException
      Race condition safe shortcut for using withImageFile(File) followed by TextAccessor.TextProvider.toString(). Implementation requirements: This method must not(!) be implemented by calling withImageFile(File) followed by TextAccessor.TextProvider.toString() (do not change the Pixmap 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

      public String[] toStrings(File aImageFile) throws IOException
      Race condition safe shortcut for using withImageFile(File) followed by toStrings(). Implementation requirements: This method must not(!) be implemented by calling withImageFile(File) followed by toStrings() (do not change the Pixmap 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 - The Font to use for printing ASCII-Art.
      aAsciiArtMode - The AsciiArtMode specifies whether to invert the resulting ASCII-Art or not.
      aLines - The text lines to convert to ASCII-Art.
      aPalette - The Character 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 - The Font to use for printing ASCII-Art.
      aAsciiArtMode - The AsciiArtMode specifies whether to invert the resulting ASCII-Art or not.
      aPalette - The Character 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 - The Font to use for printing ASCII-Art.
      aAsciiArtMode - The AsciiArtMode specifies whether to invert the resulting ASCII-Art or not.
      aPalette - The Character 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 - The AsciiArtMode specifies whether to invert the resulting ASCII-Art or not.
      aPalette - The Character 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 - The AsciiArtMode specifies whether to invert the resulting ASCII-Art or not.
      aPixmapRatioMode - The PixmapRatioMode describes how to scale the Pixmap ratio for ASCII-Art as a Character 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 - The Character 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's InputStream to be converted to ASCII-Art.
      aWidth - The width for the resulting ASCII-Art.
      aAsciiArtMode - The AsciiArtMode specifies whether to invert the resulting ASCII-Art or not.
      aPixmapRatioMode - The PixmapRatioMode describes how to scale the Pixmap ratio for ASCII-Art as a Character 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 - The Character 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 - The Pixmap which to convert to ASCII-Art.
      aWidth - The width for the resulting ASCII-Art.
      aAsciiArtMode - The AsciiArtMode specifies whether to invert the resulting ASCII-Art or not.
      aPixmapRatioMode - The PixmapRatioMode describes how to scale the Pixmap ratio for ASCII-Art as a Character 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 - The Character set used as ASCII-Art color palette.
      Returns:
      The resulting ASCII-Art.
    • toAsciiArt

      protected static String[] toAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette)
      To ascii art.
      Parameters:
      aPixmap - the pixmap
      aPalette - the palette
      Returns:
      the string[]
    • toInverseAsciiArt

      protected static String[] toInverseAsciiArt(org.refcodes.graphical.RgbPixmap aPixmap, char[] aPalette)
      To inverse ascii art.
      Parameters:
      aPixmap - the pixmap
      aPalette - 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 of String instances containing the given text as so called ASCII-Art rendered with the given Font name and Font to fit into the given width.
      Parameters:
      aText - The text to be rendered as ASCII-Art.
      aWidth - the width
      aFontName - 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_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 given Font as ASCII-Art.
    • toAsciiArt

      protected static String[] toAsciiArt(String aText, int aWidth, Font aFont, char[] aPalette)
      This method creates an array of 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.
      Parameters:
      aText - The text to be rendered as ASCII-Art.
      aWidth - the width
      aFont - the font
      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 given Font as ASCII-Art.
    • toInverseAsciiArt

      protected static String[] toInverseAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle, char[] aPalette)
      Same as toAsciiArt(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 width
      aFontName - 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_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 given Font as ASCII-Art.
    • toInverseAsciiArt

      protected static String[] toInverseAsciiArt(String aText, int aWidth, Font aFont, char[] aPalette)
      Same as toAsciiArt(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 width
      aFont - The Font 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 given Font as ASCII-Art.
    • toAsciiArt

      protected static String[] toAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle)
      This method creates an array of 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.
      Parameters:
      aText - The text to be rendered as ASCII-Art.
      aWidth - the width
      aFontName - The Font name to be used when rendering to ASCII-Art.
      aFontStyle - The Font 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 given Font as ASCII-Art.
    • toInverseAsciiArt

      protected static String[] toInverseAsciiArt(String aText, int aWidth, String aFontName, int aFontStyle)
      Same as toAsciiArt(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 width
      aFontName - The Font name to be used when rendering to ASCII-Art.
      aFontStyle - The Font 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 given Font as ASCII-Art.
    • toAsciiArt

      protected static String[] toAsciiArt(String aText, Font aFont)
      This method creates an array of String instances containing the given text rendered with the given Font as so called ASCII-Art.
      Parameters:
      aText - The text to be rendered as ASCII-Art.
      aFont - The Font to render the ASCII-Art.
      Returns:
      An array of String instances, when printed out in the order as returned, visualize the provided text in the given Font as ASCII-Art.
    • toInverseAsciiArt

      protected static String[] toInverseAsciiArt(String aText, Font aFont)
      Same as toAsciiArt(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 - The Font to render the ASCII-Art.
      Returns:
      An array of String instances, when printed out in the order as returned, visualize the provided text in the given Font as ASCII-Art.
    • toAsciiArt

      protected static String[] toAsciiArt(String aText, Font aFont, char[] aPalette)
      This method creates an array of String instances containing the given text rendered with the given Font as so called ASCII-Art.
      Parameters:
      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_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 given Font as ASCII-Art.
    • toInverseAsciiArt

      protected static String[] toInverseAsciiArt(String aText, Font aFont, char[] aPalette)
      Same as toAsciiArt(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 - The Font 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 given Font 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

      public String[] getText()
      Retrieves the text from the text property.
      Specified by:
      getText in interface TextAccessor
      Returns:
      The text stored by the text property.
    • setText

      public void setText(String... aText)
      Sets the text for the text property.
      Specified by:
      setText in interface TextAccessor.TextMutator
      Parameters:
      aText - The text to be stored by the text property.
    • withText

      public AsciiArtBuilder withText(String... aText)
      With text.
      Specified by:
      withText in interface Text<B extends Text<B>>
      Specified by:
      withText in interface TextAccessor.TextBuilder<B extends Text<B>>
      Parameters:
      aText - the text
      Returns:
      the b
    • withText

      public AsciiArtBuilder withText(Collection<String> aText)
      With text.
      Specified by:
      withText in interface TextAccessor.TextBuilder<B extends Text<B>>
      Parameters:
      aText - the text
      Returns:
      the b
    • toString

      public String toString()
      The 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).
      Specified by:
      toString in interface TextAccessor.TextProvider
      Overrides:
      toString in class Object
      Returns:
      The according resulting String
    • toString

      public String toString(String... aText)
      Race condition safe shortcut for using 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!
      Specified by:
      toString in interface Text<B extends Text<B>>
      Parameters:
      aText - The text to be processed.
      Returns:
      The according resulting String