Package jexer.backend
Class LegacySixelEncoder
- java.lang.Object
-
- jexer.backend.LegacySixelEncoder
-
- All Implemented Interfaces:
SixelEncoder
public class LegacySixelEncoder extends java.lang.Object implements SixelEncoder
LegacySixelEncoder turns a BufferedImage into String of sixel image data, using a "uniform" color quantizer.
-
-
Constructor Summary
Constructors Constructor Description LegacySixelEncoder()Public constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearPalette()Clear the sixel palette.voidemitPalette(java.lang.StringBuilder sb)If the palette is shared for the entire terminal, emit it to a StringBuilder.intgetPaletteSize()Get the number of colors in the sixel palette.booleanhasSharedPalette()Get the sixel shared palette option.static voidmain(java.lang.String[] args)Convert all filenames to sixel.voidreloadOptions()Reload options from System properties.voidsetPaletteSize(int paletteSize)Set the number of colors in the sixel palette.voidsetSharedPalette(boolean sharedPalette)Set the sixel shared palette option.java.lang.StringtoSixel(java.awt.image.BufferedImage bitmap)Create a sixel string representing a bitmap.
-
-
-
Method Detail
-
reloadOptions
public void reloadOptions()
Reload options from System properties.- Specified by:
reloadOptionsin interfaceSixelEncoder
-
toSixel
public java.lang.String toSixel(java.awt.image.BufferedImage bitmap)
Create a sixel string representing a bitmap. The returned string does NOT include the DCS start or ST end sequences.- Specified by:
toSixelin interfaceSixelEncoder- Parameters:
bitmap- the bitmap data- Returns:
- the string to emit to an ANSI / ECMA-style terminal
-
emitPalette
public void emitPalette(java.lang.StringBuilder sb)
If the palette is shared for the entire terminal, emit it to a StringBuilder.- Specified by:
emitPalettein interfaceSixelEncoder- Parameters:
sb- the StringBuilder to write the shared palette to
-
hasSharedPalette
public boolean hasSharedPalette()
Get the sixel shared palette option.- Specified by:
hasSharedPalettein interfaceSixelEncoder- Returns:
- true if all sixel output is using the same palette that is set in one DCS sequence and used in later sequences
-
setSharedPalette
public void setSharedPalette(boolean sharedPalette)
Set the sixel shared palette option.- Specified by:
setSharedPalettein interfaceSixelEncoder- Parameters:
sharedPalette- if true, then all sixel output will use the same palette that is set in one DCS sequence and used in later sequences
-
getPaletteSize
public int getPaletteSize()
Get the number of colors in the sixel palette.- Specified by:
getPaletteSizein interfaceSixelEncoder- Returns:
- the palette size
-
setPaletteSize
public void setPaletteSize(int paletteSize)
Set the number of colors in the sixel palette.- Specified by:
setPaletteSizein interfaceSixelEncoder- Parameters:
paletteSize- the new palette size
-
clearPalette
public void clearPalette()
Clear the sixel palette. It will be regenerated on the next image encode.- Specified by:
clearPalettein interfaceSixelEncoder
-
main
public static void main(java.lang.String[] args)
Convert all filenames to sixel.- Parameters:
args- [] the filenames to read
-
-