Struct lodepng::Grey[][src]

#[repr(C)]
pub struct Grey<ComponentType>(pub ComponentType);
Expand description

Grayscale. Use .0 or * (deref) to access the value.

Implementations

impl<T> Gray<T>[src]

pub const fn new(brightness: T) -> Gray<T>[src]

New grayscale pixel

Trait Implementations

impl<T> Add<Gray<T>> for Gray<T> where
    T: Add<T>, 
[src]

px + px

type Output = Gray<<T as Add<T>>::Output>

The resulting type after applying the + operator.

pub fn add(self, other: Gray<T>) -> <Gray<T> as Add<Gray<T>>>::Output[src]

Performs the + operation. Read more

impl<T> Add<T> for Gray<T> where
    T: Copy + Add<T, Output = T>, 
[src]

px + 1

type Output = Gray<T>

The resulting type after applying the + operator.

pub fn add(self, r: T) -> <Gray<T> as Add<T>>::Output[src]

Performs the + operation. Read more

impl<T> AddAssign<Gray<T>> for Gray<T> where
    T: Add<T, Output = T> + Copy
[src]

px + px

pub fn add_assign(&mut self, other: Gray<T>)[src]

Performs the += operation. Read more

impl<T> AddAssign<T> for Gray<T> where
    T: Copy + Add<T, Output = T>, 
[src]

px + 1

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

Performs the += operation. Read more

impl<T> AsMut<T> for Gray<T>[src]

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

Performs the conversion.

impl<T> AsRef<T> for Gray<T>[src]

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

Performs the conversion.

impl<ComponentType> Clone for Gray<ComponentType> where
    ComponentType: Clone
[src]

pub fn clone(&self) -> Gray<ComponentType>[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<T, B> ComponentMap<Gray<B>, T, B> for Gray<T> where
    T: Copy
[src]

pub fn map<F>(&self, f: F) -> Gray<B> where
    F: FnMut(T) -> B, 
[src]

Convenience function (equivalent of self.iter().map().collect()) for applying the same formula to every component. Read more

impl<T> ComponentSlice<T> for Gray<T>[src]

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

The components interpreted as an array, e.g. one RGB expands to 3 elements. Read more

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

The components interpreted as a mutable array, e.g. one RGB expands to 3 elements. Read more

impl<ComponentType> Debug for Gray<ComponentType> where
    ComponentType: Debug
[src]

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

Formats the value using the given formatter. Read more

impl<ComponentType> Default for Gray<ComponentType> where
    ComponentType: Default
[src]

pub fn default() -> Gray<ComponentType>[src]

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

impl<T> Deref for Gray<T>[src]

type Target = T

The resulting type after dereferencing.

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

Dereferences the value.

impl<T> Div<T> for Gray<T> where
    T: Copy + Div<T, Output = T>, 
[src]

px / 1

type Output = Gray<T>

The resulting type after applying the / operator.

pub fn div(self, r: T) -> <Gray<T> as Div<T>>::Output[src]

Performs the / operation. Read more

impl<T> DivAssign<T> for Gray<T> where
    T: Copy + Div<T, Output = T>, 
[src]

px * 1

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

Performs the /= operation. Read more

impl<T> From<Gray<T>> for GrayAlpha<T, u8> where
    T: Copy
[src]

Assumes 255 is opaque

pub fn from(other: Gray<T>) -> GrayAlpha<T, u8>[src]

Performs the conversion.

impl<T> From<Gray<T>> for RGB<T> where
    T: Clone
[src]

pub fn from(other: Gray<T>) -> RGB<T>[src]

Performs the conversion.

impl<T> From<Gray<T>> for GrayAlpha<T, u16> where
    T: Copy
[src]

Assumes 65535 is opaque

pub fn from(other: Gray<T>) -> GrayAlpha<T, u16>[src]

Performs the conversion.

impl<T> From<T> for Gray<T> where
    T: Copy
[src]

pub fn from(component: T) -> Gray<T>[src]

Performs the conversion.

impl<ComponentType> Hash for Gray<ComponentType> where
    ComponentType: Hash
[src]

pub fn hash<__H>(&self, state: &mut __H) where
    __H: Hasher
[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<T> Mul<T> for Gray<T> where
    T: Copy + Mul<T, Output = T>, 
[src]

px * 1

type Output = Gray<T>

The resulting type after applying the * operator.

pub fn mul(self, r: T) -> <Gray<T> as Mul<T>>::Output[src]

Performs the * operation. Read more

impl<T> MulAssign<T> for Gray<T> where
    T: Copy + Mul<T, Output = T>, 
[src]

px * 1

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

Performs the *= operation. Read more

impl<ComponentType> Ord for Gray<ComponentType> where
    ComponentType: Ord
[src]

pub fn cmp(&self, other: &Gray<ComponentType>) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl<ComponentType> PartialEq<Gray<ComponentType>> for Gray<ComponentType> where
    ComponentType: PartialEq<ComponentType>, 
[src]

pub fn eq(&self, other: &Gray<ComponentType>) -> bool[src]

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

pub fn ne(&self, other: &Gray<ComponentType>) -> bool[src]

This method tests for !=.

impl<ComponentType> PartialOrd<Gray<ComponentType>> for Gray<ComponentType> where
    ComponentType: PartialOrd<ComponentType>, 
[src]

pub fn partial_cmp(&self, other: &Gray<ComponentType>) -> 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<T> Sub<Gray<T>> for Gray<T> where
    T: Sub<T>, 
[src]

px - px

type Output = Gray<<T as Sub<T>>::Output>

The resulting type after applying the - operator.

pub fn sub(self, other: Gray<T>) -> <Gray<T> as Sub<Gray<T>>>::Output[src]

Performs the - operation. Read more

impl<T> Sub<T> for Gray<T> where
    T: Copy + Sub<T, Output = T>, 
[src]

px - 1

type Output = Gray<<T as Sub<T>>::Output>

The resulting type after applying the - operator.

pub fn sub(self, r: T) -> <Gray<T> as Sub<T>>::Output[src]

Performs the - operation. Read more

impl<T> SubAssign<Gray<T>> for Gray<T> where
    T: Sub<T, Output = T> + Copy
[src]

px - px

pub fn sub_assign(&mut self, other: Gray<T>)[src]

Performs the -= operation. Read more

impl<T> SubAssign<T> for Gray<T> where
    T: Copy + Sub<T, Output = T>, 
[src]

px - 1

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

Performs the -= operation. Read more

impl<T> Sum<Gray<T>> for Gray<T> where
    T: Default + Add<T, Output = T>, 
[src]

pub fn sum<I>(iter: I) -> Gray<T> where
    I: Iterator<Item = Gray<T>>, 
[src]

Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more

impl<T> Zeroable for Gray<T> where
    T: Zeroable, 
[src]

fn zeroed() -> Self

impl<ComponentType> Copy for Gray<ComponentType> where
    ComponentType: Copy
[src]

impl<ComponentType> Eq for Gray<ComponentType> where
    ComponentType: Eq
[src]

impl<T> Pod for Gray<T> where
    T: Pod
[src]

impl<ComponentType> StructuralEq for Gray<ComponentType>[src]

impl<ComponentType> StructuralPartialEq for Gray<ComponentType>[src]

Auto Trait Implementations

impl<ComponentType> RefUnwindSafe for Gray<ComponentType> where
    ComponentType: RefUnwindSafe

impl<ComponentType> Send for Gray<ComponentType> where
    ComponentType: Send

impl<ComponentType> Sync for Gray<ComponentType> where
    ComponentType: Sync

impl<ComponentType> Unpin for Gray<ComponentType> where
    ComponentType: Unpin

impl<ComponentType> UnwindSafe for Gray<ComponentType> where
    ComponentType: 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> CallHasher for T where
    T: Hash

pub fn get_hash<H>(&self, hasher: H) -> u64 where
    H: Hasher

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

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

Performs the conversion.

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