Pix2

Struct Pix2 

Source
pub struct Pix2<C, M, A, G>
where C: Channel, M: ColorModel, A: Alpha, G: Gamma,
{ /* private fields */ }
Expand description

Pixel with two channels in its color model.

Implementations§

Source§

impl<C, M, A, G> Pix2<C, M, A, G>
where C: Channel, M: ColorModel, A: Alpha, G: Gamma,

Source

pub fn new<H>(one: H, two: H) -> Self
where C: From<H>,

Create a two-channel color.

§Example
use pix::gray::Graya8;

let translucent_gray = Graya8::new(128, 200);

Trait Implementations§

Source§

impl<C, M, A, G> Clone for Pix2<C, M, A, G>
where C: Channel + Clone, M: ColorModel + Clone, A: Alpha + Clone, G: Gamma + Clone,

Source§

fn clone(&self) -> Pix2<C, M, A, G>

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<C, M, A, G> Debug for Pix2<C, M, A, G>
where C: Channel + Debug, M: ColorModel + Debug, A: Alpha + Debug, G: Gamma + Debug,

Source§

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

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

impl<C, M, A, G> Default for Pix2<C, M, A, G>
where C: Channel + Default, M: ColorModel + Default, A: Alpha + Default, G: Gamma + Default,

Source§

fn default() -> Pix2<C, M, A, G>

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

impl<C, M, A, G> PartialEq for Pix2<C, M, A, G>

Source§

fn eq(&self, other: &Pix2<C, M, A, G>) -> 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<C, M, A, G> Pixel for Pix2<C, M, A, G>
where C: Channel, M: ColorModel, A: Alpha, G: Gamma,

Source§

type Chan = C

Channel type
Source§

type Model = M

Color model
Source§

type Alpha = A

Alpha mode
Source§

type Gamma = G

Gamma mode
Source§

fn from_channels(ch: &[C]) -> Self

Make a pixel from a slice of channels.
Source§

fn from_bit_depth<P>(p: P) -> Self
where P: Pixel, Self::Chan: From<P::Chan>,

Convert from a pixel with a different bit depth.
Source§

fn channels(&self) -> &[Self::Chan]

Get the channels.
Source§

fn channels_mut(&mut self) -> &mut [Self::Chan]

Get the channels mutably.
Source§

fn one(self) -> Self::Chan

Get the first channel.
Source§

fn one_mut(&mut self) -> &mut Self::Chan

Get a mutable reference to the first channel
Source§

fn two(self) -> Self::Chan

Get the second channel.
Source§

fn two_mut(&mut self) -> &mut Self::Chan

Get a mutable reference to the second channel
Source§

fn three(self) -> Self::Chan

Get the third channel.
Source§

fn three_mut(&mut self) -> &mut Self::Chan

Get a mutable reference to the third channel
Source§

fn four(self) -> Self::Chan

Get the fourth channel.
Source§

fn four_mut(&mut self) -> &mut Self::Chan

Get a mutable reference to the fourth channel
Source§

fn alpha(self) -> Self::Chan

Get the alpha channel. Read more
Source§

fn alpha_mut(&mut self) -> &mut Self::Chan

Get a mutable reference to the alpha channel. Read more
Source§

fn convert<D>(self) -> D
where D: Pixel, D::Chan: From<Self::Chan>,

Convert a pixel to another format Read more
Source§

fn copy_color(dst: &mut [Self], clr: &Self)

Copy a color to a pixel slice
Source§

fn copy_slice(dst: &mut [Self], src: &[Self])

Copy a slice to another
Source§

fn composite_color<O>(dst: &mut [Self], clr: &Self, op: O)
where Self: Pixel<Alpha = Premultiplied, Gamma = Linear>, O: Blend,

Composite a color with a pixel slice
Source§

fn composite_matte<M, O>(dst: &mut [Self], src: &[M], clr: &Self, op: O)
where Self: Pixel<Alpha = Premultiplied, Gamma = Linear>, M: Pixel<Chan = Self::Chan, Model = Matte, Gamma = Linear>, O: Blend,

Composite matte with color to destination pixel slice
Source§

fn composite_slice<O>(dst: &mut [Self], src: &[Self], op: O)
where Self: Pixel<Alpha = Premultiplied, Gamma = Linear>, O: Blend,

Composite two slices of pixels
Source§

fn composite_channels<O>(&mut self, src: &Self, op: O)
where Self: Pixel<Alpha = Premultiplied, Gamma = Linear>, O: Blend,

Composite the channels of two pixels
Source§

fn composite_channels_alpha<O>(&mut self, src: &Self, op: O, alpha: &Self::Chan)
where Self: Pixel<Alpha = Premultiplied, Gamma = Linear>, O: Blend,

Composite the channels of two pixels with alpha
Source§

impl<C, M, A, G> Copy for Pix2<C, M, A, G>
where C: Channel + Copy, M: ColorModel + Copy, A: Alpha + Copy, G: Gamma + Copy,

Source§

impl<C, M, A, G> Eq for Pix2<C, M, A, G>
where C: Channel + Eq, M: ColorModel + Eq, A: Alpha + Eq, G: Gamma + Eq,

Source§

impl<C, M, A, G> StructuralPartialEq for Pix2<C, M, A, G>
where C: Channel, M: ColorModel, A: Alpha, G: Gamma,

Auto Trait Implementations§

§

impl<C, M, A, G> Freeze for Pix2<C, M, A, G>
where C: Freeze,

§

impl<C, M, A, G> RefUnwindSafe for Pix2<C, M, A, G>

§

impl<C, M, A, G> Send for Pix2<C, M, A, G>
where C: Send, M: Send, A: Send, G: Send,

§

impl<C, M, A, G> Sync for Pix2<C, M, A, G>
where C: Sync, M: Sync, A: Sync, G: Sync,

§

impl<C, M, A, G> Unpin for Pix2<C, M, A, G>
where C: Unpin, M: Unpin, A: Unpin, G: Unpin,

§

impl<C, M, A, G> UnwindSafe for Pix2<C, M, A, G>

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, 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.