Type Definition libnotcurses_sys::NcPixel[][src]

pub type NcPixel = u32;
Expand description

An ABGR pixel (alias of u32).

Diagram

AAAAAAAA BBBBBBBB GGGGGGGG RRRRRRRR

type in C: ncpixel (uint32_t)

NcPixel has 8 bits of alpha, more or less linear, contributing directly to the usual alpha blending equation.

We map the 8 bits of alpha to 2 bits of alpha via a level function

The NcPixel API facilitates direct management of the pixels within an NcVisual (NcVisuals keep a backing store of 32-bit RGBA pixels, and render them down to terminal graphics in NcVisual.render).

Per libav, we “store as BGRA on little-endian, and ARGB on big-endian”. This is an RGBA byte-order scheme. libav emits bytes, not words. Those bytes are R-G-B-A. When read as words, on little endian this will be ABGR, and on big-endian this will be RGBA. force everything to LE ABGR, a no-op on (and thus favoring) little-endian, which is the dominant ordering for processor architectures (x86, most ARM implementations, base RISC-V implementations) and their associated memory.

Trait Implementations

Constructs a libav-compatible ABGR pixel from RGB NcComponents.

Extracts the 8-bit alpha NcComponent from an ABGR pixel.

Extracts the 8 bit blue NcComponent from an ABGR pixel.

Extracts the 8 bit green NcComponent from an ABGR pixel.

Extracts the 8 bit red NcComponent from an ABGR pixel.

Sets the 8-bit alpha NcComponent of an ABGR pixel.

Sets the 8-bit green NcComponent of an ABGR pixel.

Sets the 8-bit blue NcComponent of an ABGR pixel.

Sets the 8-bit red NcComponent of an ABGR pixel.

Sets the RGB NcComponents of an ABGR pixel.