Struct GrayA

Source
#[repr(C)]
pub struct GrayA<T, A = T> { pub v: T, pub a: A, }
Expand description

A Value (brightness) + Alpha pixel (rgb crate v0.9)

This pixel is commonly used for grayscale images.

Fields§

§v: T

Value - the brightness component. May be luma or luminance.

§a: A

Alpha Component

Implementations§

Source§

impl<T> GrayA<T>
where T: Copy,

Source

pub fn value(self) -> T

Reads the .v field

This function isn’t necessary, but it is forwards-compatible with the next major version of the RGB crate.

Source

pub fn value_mut(&mut self) -> &mut T

Exposes the .v field for writing

This function isn’t necessary, but it is forwards-compatible with the next major version of the RGB crate.

Source§

impl<T> GrayA<T>
where T: Copy,

Source

pub const fn new(value: T, alpha: T) -> GrayA<T>

Creates a new GrayA pixel type from its components.

Alternatively, you can use struct literal syntax to create the new pixel type:

use rgb::GrayA;

let pixel = GrayA {v : value, a : alpha};

Trait Implementations§

Source§

impl<T, A> Clone for GrayA<T, A>
where T: Clone, A: Clone,

Source§

fn clone(&self) -> GrayA<T, A>

Returns a copy 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<T, A> Debug for GrayA<T, A>
where T: Debug, A: Debug,

Source§

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

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

impl<T, A> Default for GrayA<T, A>
where T: Default, A: Default,

Source§

fn default() -> GrayA<T, A>

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

impl<T, A> Hash for GrayA<T, A>
where T: Hash, A: Hash,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

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

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

impl<T, A> Ord for GrayA<T, A>
where T: Ord, A: Ord,

Source§

fn cmp(&self, other: &GrayA<T, A>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T, A> PartialEq for GrayA<T, A>
where T: PartialEq, A: PartialEq,

Source§

fn eq(&self, other: &GrayA<T, A>) -> 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<T, A> PartialOrd for GrayA<T, A>
where T: PartialOrd, A: PartialOrd,

Source§

fn partial_cmp(&self, other: &GrayA<T, A>) -> Option<Ordering>

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

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T, A> Copy for GrayA<T, A>
where T: Copy, A: Copy,

Source§

impl<T, A> Eq for GrayA<T, A>
where T: Eq, A: Eq,

Source§

impl<T, A> StructuralPartialEq for GrayA<T, A>

Auto Trait Implementations§

§

impl<T, A> Freeze for GrayA<T, A>
where T: Freeze, A: Freeze,

§

impl<T, A> RefUnwindSafe for GrayA<T, A>

§

impl<T, A> Send for GrayA<T, A>
where T: Send, A: Send,

§

impl<T, A> Sync for GrayA<T, A>
where T: Sync, A: Sync,

§

impl<T, A> Unpin for GrayA<T, A>
where T: Unpin, A: Unpin,

§

impl<T, A> UnwindSafe for GrayA<T, A>
where T: UnwindSafe, A: UnwindSafe,

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<Target, Original> Into2<Target> for Original
where Target: From2<Original>,

Source§

fn into2(self) -> Target

Performs the conversion.
Source§

impl<T> IntoResult<T> for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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.
Source§

impl<Target, Original> VectorizedInto<Target> for Original
where Target: VectorizedFrom<Original>,

Source§

fn vectorized_into(self) -> Target

Performs the conversion.