32-bit XRGB8888, little-endian: bytes are blue, green, red, then an unused byte written as 255. A common Linux framebuffer depth; RasterExRatatui.Framebuffer.format_for/1 picks it from the device instead of assuming it.
Cell colours resolve through a RasterExRatatui.Palette (named and indexed colours via its theme, :reset via its default foreground and background, :bold and :reversed applied); region pixels are packed as they come. Margins and skipped cells take the palette's default background.
Options
Every RasterExRatatui.Palette.new/1 option: :theme, :reset_fg, :reset_bg, :bold_bright.
Examples
iex> alias ExRatatui.CellSession.Cell
iex> alias RasterExRatatui.PixelFormat.XRGB8888
iex> config = XRGB8888.init([])
iex> XRGB8888.cell_paints(%Cell{fg: {:rgb, 255, 0, 0}, bg: {:rgb, 0, 255, 0}}, config)
{<<0, 0, 255, 255>>, <<0, 255, 0, 255>>}
Summary
Functions
The palette's default background.
4 bytes per pixel.
The cell's foreground and background, resolved through the palette and packed.
Builds the palette from opts.
:xrgb8888: regions are packed natively by ExRatatui.Pixels.pack_rgb8/5, which writes the same bytes as rgb_pixel/6.
Packs an RGB pixel; the position is ignored.
Packs a row of RGB pixels in one pass; the position is ignored.
Each 32-bit pixel as RGB8.
Functions
@spec blank(RasterExRatatui.Palette.t()) :: binary()
The palette's default background.
Examples
iex> RasterExRatatui.PixelFormat.XRGB8888.blank(RasterExRatatui.Palette.new(reset_bg: {0, 255, 0}))
<<0, 255, 0, 255>>
@spec bytes_per_pixel(RasterExRatatui.Palette.t()) :: 4
4 bytes per pixel.
Examples
iex> RasterExRatatui.PixelFormat.XRGB8888.bytes_per_pixel(RasterExRatatui.Palette.new())
4
@spec cell_paints(ExRatatui.CellSession.Cell.t(), RasterExRatatui.Palette.t()) :: {binary(), binary()}
The cell's foreground and background, resolved through the palette and packed.
Examples
iex> alias ExRatatui.CellSession.Cell
iex> RasterExRatatui.PixelFormat.XRGB8888.cell_paints(%Cell{fg: :reset, bg: :reset, modifiers: [:reversed]}, RasterExRatatui.Palette.new(reset_fg: {255, 0, 0}, reset_bg: {0, 255, 0}))
{<<0, 255, 0, 255>>, <<0, 0, 255, 255>>}
@spec init(keyword()) :: RasterExRatatui.Palette.t()
Builds the palette from opts.
Examples
iex> RasterExRatatui.PixelFormat.XRGB8888.init(reset_bg: {1, 2, 3}).reset_bg
{1, 2, 3}
@spec native_format(RasterExRatatui.Palette.t()) :: :xrgb8888
:xrgb8888: regions are packed natively by ExRatatui.Pixels.pack_rgb8/5, which writes the same bytes as rgb_pixel/6.
Examples
iex> RasterExRatatui.PixelFormat.XRGB8888.native_format(RasterExRatatui.Palette.new())
:xrgb8888
@spec rgb_pixel( 0..255, 0..255, 0..255, non_neg_integer(), non_neg_integer(), RasterExRatatui.Palette.t() ) :: binary()
Packs an RGB pixel; the position is ignored.
Examples
iex> RasterExRatatui.PixelFormat.XRGB8888.rgb_pixel(255, 0, 0, 0, 0, RasterExRatatui.Palette.new())
<<0, 0, 255, 255>>
@spec rgb_row( binary(), non_neg_integer(), non_neg_integer(), RasterExRatatui.Palette.t() ) :: binary()
Packs a row of RGB pixels in one pass; the position is ignored.
Examples
iex> RasterExRatatui.PixelFormat.XRGB8888.rgb_row(<<255, 0, 0, 0, 0, 255>>, 0, 0, RasterExRatatui.Palette.new())
<<0, 0, 255, 255, 255, 0, 0, 255>>
Each 32-bit pixel as RGB8.
Examples
iex> RasterExRatatui.PixelFormat.XRGB8888.unpack_row(<<0, 128, 255, 255>>, RasterExRatatui.Palette.new())
<<255, 128, 0>>