Raxol.Terminal.ANSI.SixelGraphics (Raxol v0.3.0)

View Source

Handles Sixel graphics for the terminal emulator. Supports:

  • Sixel color palette management
  • Sixel image rendering
  • Sixel image scaling
  • Sixel image positioning
  • Sixel image attributes

Summary

Functions

Creates a new Sixel state with default values.

Processes a Sixel sequence (DCS P...q DATA ST) and returns the updated state.

Types

sixel_attribute()

@type sixel_attribute() :: :normal | :double_width | :double_height | :double_size

sixel_state()

@type sixel_state() :: %{
  palette: map(),
  current_color: integer(),
  position: {integer(), integer()},
  attributes: map(),
  pixel_buffer: map()
}

Functions

new()

@spec new() :: %{
  palette: map(),
  current_color: 0,
  position: {0, 0},
  attributes: %{width: :normal, height: :normal, size: :normal},
  pixel_buffer: %{}
}

Creates a new Sixel state with default values.

process_sequence(state, other_sequence)

@spec process_sequence(sixel_state(), binary()) ::
  {sixel_state(), :ok | {:error, term()}}

Processes a Sixel sequence (DCS P...q DATA ST) and returns the updated state.

The pixel data is stored in state.pixel_buffer.