Class BrailleEncoder

java.lang.Object
org.aesh.charts.canvas.BrailleEncoder

public final class BrailleEncoder extends Object
Encodes sub-cell coordinates into Unicode Braille characters (U+2800-U+28FF).

Each braille character represents a 2-wide x 4-tall dot matrix, giving 2x horizontal and 4x vertical resolution per terminal character cell.

Dot positions and bit mapping:

   Col 0  Col 1       Bit 0  Bit 3
   Row 0  Row 0       Bit 1  Bit 4
   Row 1  Row 1       Bit 2  Bit 5
   Row 2  Row 2       Bit 6  Bit 7
 
Character = U+2800 + (bit0 | bit1 | ... | bit7)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Height of a braille cell in sub-pixels.
    static final int
    Width of a braille cell in sub-pixels.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    dotBit(int row, int col)
    Get the bit mask for a specific dot position.
    static char
    Return the empty braille character (no dots set).
    static char
    toChar(int bits)
    Convert a bit pattern to the corresponding braille character.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CELL_WIDTH

      public static final int CELL_WIDTH
      Width of a braille cell in sub-pixels.
      See Also:
    • CELL_HEIGHT

      public static final int CELL_HEIGHT
      Height of a braille cell in sub-pixels.
      See Also:
  • Method Details

    • dotBit

      public static int dotBit(int row, int col)
      Get the bit mask for a specific dot position.
      Parameters:
      row - row within the cell (0-3, top to bottom)
      col - column within the cell (0-1, left to right)
      Returns:
      the bit mask
    • toChar

      public static char toChar(int bits)
      Convert a bit pattern to the corresponding braille character.
      Parameters:
      bits - the combined bit pattern (0x00-0xFF)
      Returns:
      the braille character
    • empty

      public static char empty()
      Return the empty braille character (no dots set).