Struct image2::Pixel[][src]

pub struct Pixel<C: Color>(_, _);
Expand description

Normalized image data

Implementations

impl<C: Color> Pixel<C>[src]

pub fn new() -> Pixel<C>[src]

Create an empty pixel

pub fn data(&self) -> Data<'_, f64, C>[src]

Data

pub fn data_mut(&mut self) -> DataMut<'_, f64, C>[src]

Mutable Data

pub fn into_vec(self) -> Vec<f64>[src]

Convert into a Vec

pub fn to_vec(&self) -> Vec<f64>[src]

Copy and convert to a Vec

pub fn fill<T: Type>(&mut self, x: T) -> &mut Self[src]

Fill a pixel with a single value

pub fn len(&self) -> Channel[src]

Pixel channel count

pub fn is_empty(&self) -> bool[src]

Pixel has no channels

pub fn clamp(&mut self) -> &mut Self[src]

Clamp values betwen 0 and 1.0

pub fn is_alpha(&self, index: Channel) -> bool[src]

Returns true when the provided channel index matches the alpha channel index

pub fn alpha(&self) -> Option<f64>[src]

Get alpha value

pub fn with_alpha(&mut self, value: f64) -> &mut Self[src]

Set alpha value

pub fn convert_to<D: Color>(&self, dest: &mut Pixel<D>)[src]

Convert pixel color type to an existing pixel

pub fn convert<D: Color>(&self) -> Pixel<D>[src]

Convert pixel color type

pub fn copy_from_slice<T: Type>(&mut self, data: impl AsRef<[T]>) -> &mut Self[src]

Copy values from an existing slice

pub fn copy_from_data<T: Type>(&mut self, data: &Data<'_, T, C>) -> &mut Self[src]

Copy values from an existing slice

pub fn convert_from_data<T: Type, D: Color>(&mut self, data: &Data<'_, T, D>)[src]

Convert color and copy to slice

pub fn convert_to_data<T: Type, D: Color>(&self, data: &mut DataMut<'_, T, D>)[src]

Convert color and copy to slice

pub fn copy_to_slice<T: Type>(&self, data: impl AsMut<[T]>)[src]

Copy values to an existing slice

pub fn from_slice<T: Type>(data: impl AsRef<[T]>) -> Pixel<C>[src]

Create from slice

pub fn from_data<T: Type>(data: &Data<'_, T, C>) -> Pixel<C>[src]

Create from slice

pub fn copy_from(&mut self, other: &Pixel<C>) -> &mut Self[src]

Create from another pixel

pub fn blend_alpha(&mut self) -> &mut Self[src]

Blend alpha value

pub fn map(&mut self, f: impl Fn(f64) -> f64) -> &mut Self[src]

Create a new pixel by applying f over an existing pixel

pub fn map2(
    &mut self,
    other: &Pixel<C>,
    f: impl Fn(f64, f64) -> f64
) -> &mut Self
[src]

Zip two pixels, apply f and return a new pixel with the results

pub fn for_each(&self, f: impl FnMut(usize, f64))[src]

Apply f for each channel in a pixel

pub fn iter(&self) -> impl Iterator<Item = &f64>[src]

Get iterator over pixel data, ignoring alpha channel

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut f64>[src]

Get a mutable iterator over the pixel data, ignoring alpha channel

pub fn gamma(&mut self, value: f64) -> &mut Self[src]

Gamma correction

pub fn gamma_log(&mut self) -> &mut Self[src]

Convert to log RGB

pub fn gamma_lin(&mut self) -> &mut Self[src]

Convert to linear RGB

Trait Implementations

impl<'a, C: Color> Add<&'a Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the + operator.

fn add(self, other: &'a Pixel<C>) -> Pixel<C>[src]

Performs the + operation. Read more

impl<C: Color> Add<Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the + operator.

fn add(self, other: Pixel<C>) -> Pixel<C>[src]

Performs the + operation. Read more

impl<T: Type, C: Color> Add<T> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the + operator.

fn add(self, other: T) -> Pixel<C>[src]

Performs the + operation. Read more

impl<'a, T: Type, C: Color> Add<T> for &'a Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the + operator.

fn add(self, other: T) -> Pixel<C>[src]

Performs the + operation. Read more

impl<'a, C: Color> AddAssign<&'a Pixel<C>> for Pixel<C>[src]

fn add_assign(&mut self, other: &'a Pixel<C>)[src]

Performs the += operation. Read more

impl<C: Color> AddAssign<Pixel<C>> for Pixel<C>[src]

fn add_assign(&mut self, other: Pixel<C>)[src]

Performs the += operation. Read more

impl<T: Type, C: Color> AddAssign<T> for Pixel<C>[src]

fn add_assign(&mut self, other: T)[src]

Performs the += operation. Read more

impl<C: Color> AsMut<[f64]> for Pixel<C>[src]

fn as_mut(&mut self) -> &mut [f64][src]

Performs the conversion.

impl<C: Color> AsRef<[f64]> for Pixel<C>[src]

fn as_ref(&self) -> &[f64][src]

Performs the conversion.

impl<C: Clone + Color> Clone for Pixel<C>[src]

fn clone(&self) -> Pixel<C>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<C: Debug + Color> Debug for Pixel<C>[src]

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

Formats the value using the given formatter. Read more

impl<C: Color> Default for Pixel<C>[src]

fn default() -> Self[src]

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

impl<'a, C: Color> Div<&'a Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the / operator.

fn div(self, other: &'a Pixel<C>) -> Pixel<C>[src]

Performs the / operation. Read more

impl<C: Color> Div<Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the / operator.

fn div(self, other: Pixel<C>) -> Pixel<C>[src]

Performs the / operation. Read more

impl<T: Type, C: Color> Div<T> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the / operator.

fn div(self, other: T) -> Pixel<C>[src]

Performs the / operation. Read more

impl<'a, T: Type, C: Color> Div<T> for &'a Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the / operator.

fn div(self, other: T) -> Pixel<C>[src]

Performs the / operation. Read more

impl<'a, C: Color> DivAssign<&'a Pixel<C>> for Pixel<C>[src]

fn div_assign(&mut self, other: &'a Pixel<C>)[src]

Performs the /= operation. Read more

impl<C: Color> DivAssign<Pixel<C>> for Pixel<C>[src]

fn div_assign(&mut self, other: Pixel<C>)[src]

Performs the /= operation. Read more

impl<T: Type, C: Color> DivAssign<T> for Pixel<C>[src]

fn div_assign(&mut self, other: T)[src]

Performs the /= operation. Read more

impl<T: Type, C: Color> FromIterator<T> for Pixel<C>[src]

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self[src]

Creates a value from an iterator. Read more

impl<C: Color> Index<usize> for Pixel<C>[src]

type Output = f64

The returned type after indexing.

fn index(&self, index: Channel) -> &f64[src]

Performs the indexing (container[index]) operation. Read more

impl<'a, C: Color> Index<usize> for &'a Pixel<C>[src]

type Output = f64

The returned type after indexing.

fn index(&self, index: Channel) -> &f64[src]

Performs the indexing (container[index]) operation. Read more

impl<'a, C: Color> Index<usize> for &'a mut Pixel<C>[src]

type Output = f64

The returned type after indexing.

fn index(&self, index: Channel) -> &f64[src]

Performs the indexing (container[index]) operation. Read more

impl<C: Color> IndexMut<usize> for Pixel<C>[src]

fn index_mut(&mut self, index: Channel) -> &mut f64[src]

Performs the mutable indexing (container[index]) operation. Read more

impl<'a, C: Color> IndexMut<usize> for &'a mut Pixel<C>[src]

fn index_mut(&mut self, index: Channel) -> &mut f64[src]

Performs the mutable indexing (container[index]) operation. Read more

impl<C: Color> IntoIterator for Pixel<C>[src]

type Item = f64

The type of the elements being iterated over.

type IntoIter = IntoIter<Self::Item>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

impl<'a, C: Color> Mul<&'a Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the * operator.

fn mul(self, other: &'a Pixel<C>) -> Pixel<C>[src]

Performs the * operation. Read more

impl<C: Color> Mul<Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the * operator.

fn mul(self, other: Pixel<C>) -> Pixel<C>[src]

Performs the * operation. Read more

impl<T: Type, C: Color> Mul<T> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the * operator.

fn mul(self, other: T) -> Pixel<C>[src]

Performs the * operation. Read more

impl<'a, T: Type, C: Color> Mul<T> for &'a Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the * operator.

fn mul(self, other: T) -> Pixel<C>[src]

Performs the * operation. Read more

impl<'a, C: Color> MulAssign<&'a Pixel<C>> for Pixel<C>[src]

fn mul_assign(&mut self, other: &'a Pixel<C>)[src]

Performs the *= operation. Read more

impl<C: Color> MulAssign<Pixel<C>> for Pixel<C>[src]

fn mul_assign(&mut self, other: Pixel<C>)[src]

Performs the *= operation. Read more

impl<T: Type, C: Color> MulAssign<T> for Pixel<C>[src]

fn mul_assign(&mut self, other: T)[src]

Performs the *= operation. Read more

impl<C: PartialEq + Color> PartialEq<Pixel<C>> for Pixel<C>[src]

fn eq(&self, other: &Pixel<C>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Pixel<C>) -> bool[src]

This method tests for !=.

impl<C: PartialOrd + Color> PartialOrd<Pixel<C>> for Pixel<C>[src]

fn partial_cmp(&self, other: &Pixel<C>) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'a, C: Color> Rem<&'a Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the % operator.

fn rem(self, other: &'a Pixel<C>) -> Pixel<C>[src]

Performs the % operation. Read more

impl<C: Color> Rem<Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the % operator.

fn rem(self, other: Pixel<C>) -> Pixel<C>[src]

Performs the % operation. Read more

impl<T: Type, C: Color> Rem<T> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the % operator.

fn rem(self, other: T) -> Pixel<C>[src]

Performs the % operation. Read more

impl<'a, T: Type, C: Color> Rem<T> for &'a Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the % operator.

fn rem(self, other: T) -> Pixel<C>[src]

Performs the % operation. Read more

impl<'a, C: Color> RemAssign<&'a Pixel<C>> for Pixel<C>[src]

fn rem_assign(&mut self, other: &'a Pixel<C>)[src]

Performs the %= operation. Read more

impl<C: Color> RemAssign<Pixel<C>> for Pixel<C>[src]

fn rem_assign(&mut self, other: Pixel<C>)[src]

Performs the %= operation. Read more

impl<T: Type, C: Color> RemAssign<T> for Pixel<C>[src]

fn rem_assign(&mut self, other: T)[src]

Performs the %= operation. Read more

impl<'a, C: Color> Sub<&'a Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the - operator.

fn sub(self, other: &'a Pixel<C>) -> Pixel<C>[src]

Performs the - operation. Read more

impl<C: Color> Sub<Pixel<C>> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the - operator.

fn sub(self, other: Pixel<C>) -> Pixel<C>[src]

Performs the - operation. Read more

impl<T: Type, C: Color> Sub<T> for Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the - operator.

fn sub(self, other: T) -> Pixel<C>[src]

Performs the - operation. Read more

impl<'a, T: Type, C: Color> Sub<T> for &'a Pixel<C>[src]

type Output = Pixel<C>

The resulting type after applying the - operator.

fn sub(self, other: T) -> Pixel<C>[src]

Performs the - operation. Read more

impl<'a, C: Color> SubAssign<&'a Pixel<C>> for Pixel<C>[src]

fn sub_assign(&mut self, other: &'a Pixel<C>)[src]

Performs the -= operation. Read more

impl<C: Color> SubAssign<Pixel<C>> for Pixel<C>[src]

fn sub_assign(&mut self, other: Pixel<C>)[src]

Performs the -= operation. Read more

impl<T: Type, C: Color> SubAssign<T> for Pixel<C>[src]

fn sub_assign(&mut self, other: T)[src]

Performs the -= operation. Read more

impl<C: Color> StructuralPartialEq for Pixel<C>[src]

Auto Trait Implementations

impl<C> RefUnwindSafe for Pixel<C> where
    C: RefUnwindSafe

impl<C> Send for Pixel<C>

impl<C> Sync for Pixel<C>

impl<C> Unpin for Pixel<C>

impl<C> UnwindSafe for Pixel<C> where
    C: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, Rhs> NumAssignOps<Rhs> for T where
    T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>, 
[src]

impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[src]

impl<T, Base> RefNum<Base> for T where
    T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>, 
[src]