#[repr(transparent)]
pub struct NcChannel(pub NcChannel_u32);
Expand description

32 bits of context-dependent info containing NcRgb + NcAlpha + extra

It is composed of:

  • a 24-bit NcRgb value
  • plus 8 bits divided in:
    • 2 bits of NcAlpha
    • 6 bits of context-dependent info

The context details are documented in NcChannels

Diagram

~~AA~~~~ RRRRRRRR GGGGGGGG BBBBBBBB

type in C: channel (uint32_t)

See also

Tuple Fields§

§0: NcChannel_u32

Implementations§

If this bit is set, we are not using the default color.

Note: this is equivalent to NcChannels::BG_DEFAULT_MASK

Extract these bits to get the (background) NcAlpha mask.

Note: this is equivalent to NcChannels::BG_ALPHA_MASK

If this bit and DEFAULT_MASK are set, we’re using a palette-indexed background color

Note: this is equivalent to NcChannels::BG_PALETTE_MASK

Extract these bits to get the background NcRgb value.

Note: this is equivalent to NcChannels::BG_RGB_MASK

New NcChannel, set to black and NOT using the “default color”.

New NcChannel, set to black and using the “default color”.

New NcChannel, expects NcRgb.

New NcChannel, expects NcRgb & NcAlpha.

Combines this NcChannel as foreground, with another as background into an NcChannels.

C style function: channels_combine().

Combines this NcChannel as background, with another as foreground into an NcChannels.

C style function: channels_combine().

Gets the NcAlpha.

C style function: ncchannel_alpha().

Sets the NcAlpha.

C style function: ncchannel_set_alpha().

Returns true if the channel is set to RGB color.

C style function: ncchannel_rgb_p().

Gets the NcRgb.

C style function: ncchannel_rgb().

Sets the NcRgb, and marks the NcChannel as NOT using the “default color”, retaining the other bits unchanged.

C style function: ncchannel_set().

Gets the three components.

C style function: ncchannel_rgb8().

Sets the three components, and marks the NcChannel as NOT using the “default color”.

C style function: ncchannel_set_rgb8().

Gets the red component.

C style function: ncchannel_r().

Gets the green component.

C style function: ncchannel_g().

Gets the blue component.

C style function: ncchannel_b().

Sets the red component, and returns the new NcChannel.

C style function: ncchannel_set_r().

Sets the green component, and returns the new NcChannel.

C style function: ncchannel_set_g().

Sets the blue component, and returns the new NcChannel.

C style function: ncchannel_set_b().

Is this NcChannel using the “default color” rather than RGB/palette-indexed?

C style function: ncchannel_default_p().

Marks this NcChannel as using its “default color”, which also marks it opaque.

C style function: ncchannel_set_default().

Marks this NcChannel as not using its “default color”.

The following methods also marks the channel as NOT using the “default color”:

C style function: ncchannel_set_not_default().

Extracts the NcPaletteIndex from the NcChannel.

The channel must be palette-indexed, or the return value is meaningless. Verify palette indexing with palindex_p.

C style function: ncchannel_palindex().

Is this NcChannel using palette-indexed color rather a than RGB?

C style function: ncchannel_palindex_p().

Sets the NcPaletteIndex of the NcChannel, and the channel into palette-indexed mode.

C style function: ncchannel_set_palindex().

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.