Emerge.Config.BinaryFrames (Emerge v0.5.1)

Copy Markdown View Source

Owned pixel data for headless output. Set this record as Emerge.Config.Headless.frames. The recipient does not need to release frames.

%Emerge.Config{
  output: %Emerge.Config.Headless{
    target: self(),
    frames: %Emerge.Config.BinaryFrames{pixel_format: :bw1, dither: true}
  },
  renderer: %Emerge.Config.Renderer{api: :raster},
  assets: %Emerge.Config.Assets{otp_app: :my_app}
}

Fields

  • pixel_format — :rgba8888 (default), :bgra8888, :rgb888, :gray8, :gray2 or :bw1. RGBA/BGRA use four bytes per pixel; RGB uses three; Gray8 uses one. Gray2 packs four pixels per byte and BW1 packs eight, most-significant pixel first in each row. BGRA uses premultiplied alpha.
  • bw1_polarity — :one_is_black (default) or :one_is_white. This chooses what a set bit means in BW1 output; it does not affect other formats.
  • dither — false by default. Set true to improve grayscale approximation in raster BW1/Gray2 output. Other formats and GPU renderers do not support it.

Read the frame's stride rather than assuming tightly packed rows. All fields require a new viewport to change.

Summary

Types

Canonical form after nested keyword records have been expanded.

Frame pixel encoding.

Meaning of a set bit in BW1 output.

t()

Types

normalized_t()

@type normalized_t() :: t()

Canonical form after nested keyword records have been expanded.

pixel_format()

@type pixel_format() :: :rgba8888 | :bgra8888 | :rgb888 | :gray8 | :gray2 | :bw1

Frame pixel encoding.

polarity()

@type polarity() :: :one_is_black | :one_is_white

Meaning of a set bit in BW1 output.

t()

@type t() :: %Emerge.Config.BinaryFrames{
  bw1_polarity: polarity(),
  dither: boolean(),
  pixel_format: pixel_format()
}