pub struct NcPixel(pub NcPixel_u32);
Expand description

An ABGR pixel.

Diagram

AAAAAAAA BBBBBBBB GGGGGGGG RRRRRRRR

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.

Tuple Fields§

§0: NcPixel_u32

Implementations§

Returns a new NcPixel.

Constructs a libav-compatible ABGR pixel from RGB components.

Constructs a libav-compatible ABGR pixel from RGBA components.

Converts to an RGB pixel.

Converts to an RGBA pixel.

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

Extracts the 8 bit blue component from an ABGR pixel.

Extracts the 8 bit green component from an ABGR pixel.

Extracts the 8 bit red component from an ABGR pixel.

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

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

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

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

Sets the RGB components of an ABGR pixel.

Trait Implementations§

Formats the value using the given formatter.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Formats the value using the given formatter.
Formats the value using the given formatter.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Formats the value using the given formatter.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.