Raxol.Terminal.Graphics.UnifiedGraphics (Raxol v0.5.0)

View Source

Provides unified graphics capabilities for the terminal emulator. This module handles graphics rendering, image display, and graphics state management.

Summary

Functions

Returns a specification to start this module under a supervisor.

Cleans up resources.

Clears the graphics context.

Closes a graphics context.

Creates a new graphics context with the given configuration.

Gets the active graphics context ID.

Gets the list of all graphics contexts.

Gets the state of a specific graphics context.

Renders graphics data to the specified context.

Sets the active graphics context.

Starts the graphics manager with the given options.

Updates the graphics manager configuration.

Updates the configuration of a specific graphics context.

Types

graphics_config()

@type graphics_config() :: %{
  optional(:width) => non_neg_integer(),
  optional(:height) => non_neg_integer(),
  optional(:format) => :rgb | :rgba | :grayscale,
  optional(:compression) => :none | :zlib | :lz4,
  optional(:quality) => 0..100
}

graphics_id()

@type graphics_id() :: non_neg_integer()

graphics_state()

@type graphics_state() :: :active | :inactive | :hidden

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cleanup()

@spec cleanup() :: :ok

Cleans up resources.

clear_graphics(graphics_id)

@spec clear_graphics(graphics_id()) :: :ok | {:error, term()}

Clears the graphics context.

close_graphics(graphics_id)

@spec close_graphics(graphics_id()) :: :ok | {:error, term()}

Closes a graphics context.

create_graphics(config \\ %{})

@spec create_graphics(map()) :: {:ok, graphics_id()} | {:error, term()}

Creates a new graphics context with the given configuration.

get_active_graphics()

@spec get_active_graphics() :: {:ok, graphics_id()} | {:error, :no_active_graphics}

Gets the active graphics context ID.

get_graphics()

@spec get_graphics() :: [graphics_id()]

Gets the list of all graphics contexts.

get_graphics_state(graphics_id)

@spec get_graphics_state(graphics_id()) :: {:ok, map()} | {:error, term()}

Gets the state of a specific graphics context.

render_graphics(graphics_id, data)

@spec render_graphics(graphics_id(), binary()) :: :ok | {:error, term()}

Renders graphics data to the specified context.

set_active_graphics(graphics_id)

@spec set_active_graphics(graphics_id()) :: :ok | {:error, term()}

Sets the active graphics context.

start_link(opts \\ %{})

@spec start_link(map()) :: GenServer.on_start()

Starts the graphics manager with the given options.

update_config(config)

@spec update_config(map()) :: :ok

Updates the graphics manager configuration.

update_graphics_config(graphics_id, config)

@spec update_graphics_config(graphics_id(), graphics_config()) ::
  :ok | {:error, term()}

Updates the configuration of a specific graphics context.