Type Definition libnotcurses_sys::NcPixel[][src]

type NcPixel = u32;
Expand description

An ABGR pixel.

Diagram

AAAAAAAA GGGGGGGG BBBBBBBB 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.

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.