Channel

Struct Channel 

Source
#[repr(transparent)]
pub struct Channel { pub nc: NcChannel, }
Expand description

The Rgb + Alpha of a Cell’s background or foreground.

Fields§

§nc: NcChannel

Implementations§

Source§

impl Channel

§Constructors

Source

pub fn new() -> Channel

Source

pub fn with_default() -> Channel

Creates a new channel with the default color.

Source

pub fn from_rgb(rgb: impl Into<Rgb>) -> Channel

Source

pub fn from_rgb_alpha(rgb: impl Into<Rgb>, alpha: Alpha) -> Channel

Source§

impl Channel

§Default color methods

Source

pub fn is_default(&self) -> bool

Is this channel using the default color? (vs. RGB or palette indexed).

Source

pub fn set_default(&mut self, default: bool)

(Un)Sets the usage of the default color.

Setting default to true also marks the channel as Opaque.

Source§

impl Channel

§Alpha and RGB methods

Source

pub fn alpha(&self) -> Alpha

Gets the Alpha.

Source

pub fn set_alpha(&mut self, alpha: Alpha)

Sets the Alpha.

Also marks the channel as NOT using the “default color”.

Source

pub fn is_rgb(&self) -> bool

Is this channel using RGB color? (vs. default or palette indexed).

Source

pub fn rgb(&self) -> Rgb

Gets the RGB values.

Source

pub fn r(&self) -> u8

Gets the red color component.

Source

pub fn g(&self) -> u8

Gets the green color component.

Source

pub fn b(&self) -> u8

Gets the blue color component.

Source

pub fn set_rgb(&mut self, rgb: impl Into<Rgb>)

Sets the RGB value.

Also marks the channel as NOT using the “default color”.

Source

pub fn set_r(&mut self, red: impl Into<u8>)

Sets the red color component.

Source

pub fn set_g(&mut self, green: impl Into<u8>)

Sets the green color component.

Source

pub fn set_b(&mut self, blue: impl Into<u8>)

Sets the blue color component.

Source§

impl Channel

§Indexed palette methods

Source

pub fn is_palindex(&self) -> bool

Is this channel using indexed palette colors? (vs. default or RGB)

Source

pub fn palindex(&self) -> u8

Gets the palette index from the channel.

Source

pub fn set_palindex(&mut self, index: impl Into<u8>)

Sets the palette index of the channel.

Also marks the channel as Opaque.

Trait Implementations§

Source§

impl Clone for Channel

Source§

fn clone(&self) -> Channel

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Channel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Channel

Source§

fn default() -> Channel

Returns the “default value” for a type. Read more
Source§

impl Display for Channel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<[i16; 3]> for Channel

Source§

fn from(arr: [i16; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[i32; 3]> for Channel

Source§

fn from(arr: [i32; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[i64; 3]> for Channel

Source§

fn from(arr: [i64; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[i8; 3]> for Channel

Source§

fn from(arr: [i8; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[isize; 3]> for Channel

Source§

fn from(arr: [isize; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[u16; 3]> for Channel

Source§

fn from(arr: [u16; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[u32; 3]> for Channel

Source§

fn from(arr: [u32; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[u64; 3]> for Channel

Source§

fn from(arr: [u64; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[u8; 3]> for Channel

Source§

fn from(arr: [u8; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<[usize; 3]> for Channel

Source§

fn from(arr: [usize; 3]) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(i16, i16, i16)> for Channel

Source§

fn from(tuple: (i16, i16, i16)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(i32, i32, i32)> for Channel

Source§

fn from(tuple: (i32, i32, i32)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(i64, i64, i64)> for Channel

Source§

fn from(tuple: (i64, i64, i64)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(i8, i8, i8)> for Channel

Source§

fn from(tuple: (i8, i8, i8)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(isize, isize, isize)> for Channel

Source§

fn from(tuple: (isize, isize, isize)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(u16, u16, u16)> for Channel

Source§

fn from(tuple: (u16, u16, u16)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(u32, u32, u32)> for Channel

Source§

fn from(tuple: (u32, u32, u32)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(u64, u64, u64)> for Channel

Source§

fn from(tuple: (u64, u64, u64)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(u8, u8, u8)> for Channel

Source§

fn from(tuple: (u8, u8, u8)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<(usize, usize, usize)> for Channel

Source§

fn from(tuple: (usize, usize, usize)) -> Channel

Performs a saturating cast to [u8; 3].

Source§

impl From<Channel> for NcChannel

Source§

fn from(channel: Channel) -> NcChannel

Converts to this type from the input type.
Source§

impl From<NcChannel> for Channel

Source§

fn from(nc: NcChannel) -> Channel

Converts to this type from the input type.
Source§

impl From<i16> for Channel

Source§

fn from(int: i16) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<i32> for Channel

Source§

fn from(int: i32) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<i64> for Channel

Source§

fn from(int: i64) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<i8> for Channel

Source§

fn from(int: i8) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<isize> for Channel

Source§

fn from(int: isize) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<u16> for Channel

Source§

fn from(int: u16) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<u32> for Channel

Source§

fn from(int: u32) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<u64> for Channel

Source§

fn from(int: u64) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<u8> for Channel

Source§

fn from(int: u8) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl From<usize> for Channel

Source§

fn from(int: usize) -> Channel

Performs a saturating cast to u32 and then extracts the components from the first three bytes.

Source§

impl PartialEq for Channel

Source§

fn eq(&self, other: &Channel) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Channel

Source§

impl Eq for Channel

Source§

impl StructuralPartialEq for Channel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.