RGBA

Struct RGBA 

Source
pub struct RGBA {
    pub r: f64,
    pub g: f64,
    pub b: f64,
    pub a: f64,
}
Expand description

§Red Green Blue Alpha container

§Description

RGBA data in 0->1 range floats

These values remove gamma-corrected values so that you can apply maths on them

This means the RGBA values are in linear space

§Usage

Methods that are available:

Fields§

§r: f64

Gamma corrected Red between 0 and 1

§g: f64

Gamma corrected Green between 0 and 1

§b: f64

Gamma corrected Blue between 0 and 1

§a: f64

Opacity between 0 and 1 (not gamma corrected as opacity is linear)

Implementations§

Source§

impl RGBA

Source

pub fn new(r: f64, g: f64, b: f64, a: f64) -> Self

Create a new RGBA value

Source

pub fn from_gamma(r: f64, g: f64, b: f64, a: f64) -> Self

Create a new RGBA value from gamma-corrected values

Source

pub fn to_gamma(self) -> (f64, f64, f64, f64)

Convert RGBA to gamma-corrected values

Source

pub fn from_u8s(r: u8, g: u8, b: u8, a: u8) -> Self

Create a new RGBA value from 4 u8 values

Source

pub fn to_u8s(self) -> (u8, u8, u8, u8)

Convert RGBA to 4 u8 values in Gamma corrected 0->255 range

Source

pub fn from_reader<R: Reader>(reader: &R, offset: Option<u64>) -> Self

Create a new RGBA value from 4 u16 values

Source

pub fn from_u16s(r: u16, g: u16, b: u16, a: u16) -> Self

Create a new RGBA value from 4 u16 values

Source

pub fn to_u16s(&self) -> (u16, u16, u16, u16)

Convert RGBA to 4 u16 values in Gamma corrected 0->65,535 range

Source

pub fn from_u32(value: u32) -> Self

Convert a 32-bit integer to RGBA

Source

pub fn to_u32s(&self) -> u32

Convert RGBA to a 32-bit integer (Big-endian: 0xRRGGBBAA) big-endian is more common in graphics formats like BMP, PNG, etc.

Source

pub fn from_u64(value: u64) -> Self

Convert an unsigned 64-bit integer to RGBA

Source

pub fn to_u64s(&self) -> u64

Convert RGBA to an unsigned 64-bit integer

Source

pub fn from_hex(hex: &str) -> Self

Create an RGBA color from a hex string. Accepts formats: “#RRGGBB”, “#RRGGBBAA”, “RRGGBB”, “RRGGBBAA” (case-insensitive). Panics on invalid input.

Trait Implementations§

Source§

impl Add for RGBA

Source§

type Output = RGBA

The resulting type after applying the + operator.
Source§

fn add(self, rhs: RGBA) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<f64> for RGBA

Source§

fn add_assign(&mut self, rhs: f64)

Performs the += operation. Read more
Source§

impl AddAssign for RGBA

Source§

fn add_assign(&mut self, rhs: RGBA)

Performs the += operation. Read more
Source§

impl Clone for RGBA

Source§

fn clone(&self) -> RGBA

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RGBA

Source§

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

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

impl Default for RGBA

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for RGBA

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Div for RGBA

Source§

type Output = RGBA

The resulting type after applying the / operator.
Source§

fn div(self, rhs: RGBA) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<f64> for RGBA

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl DivAssign for RGBA

Source§

fn div_assign(&mut self, rhs: RGBA)

Performs the /= operation. Read more
Source§

impl<T: Reader> FeatureReader<GeoTIFFMetadata, Map<String, ValueType>, RGBA> for GeoTIFFReader<T>

A feature reader trait with a callback-based approach

Source§

type FeatureIterator<'a> = GeoTIFFIterator<'a, T> where T: 'a

The Feature Reader should implement an iterator of some kind
Source§

fn iter(&self) -> Self::FeatureIterator<'_>

All readers have an iter function that returns a Iterator struct
Source§

fn par_iter( &self, pool_size: usize, thread_id: usize, ) -> Self::FeatureIterator<'_>

All readers have a par_iter function that returns a ParallelIterator struct
Source§

impl From<&Map<String, PrimitiveValue>> for RGBA

Starting from a ref to an ValuePrimitive, convert to a struct

Source§

fn from(m: &ValuePrimitive) -> Self

Converts to this type from the input type.
Source§

impl From<&Map<String, ValueType>> for RGBA

Source§

fn from(mvalue: &MValue) -> Self

Converts to this type from the input type.
Source§

impl From<&ValuePrimitiveType> for RGBA
where RGBA: Default,

Starting from an ValuePrimitiveType ref, pull out the struct and apply the conversions

Source§

fn from(m: &ValuePrimitiveType) -> Self

Converts to this type from the input type.
Source§

impl From<&ValueType> for RGBA

Source§

fn from(value: &ValueType) -> Self

Converts to this type from the input type.
Source§

impl From<Map<String, PrimitiveValue>> for RGBA

Starting from an ValuePrimitive, convert to a struct

Source§

fn from(m: ValuePrimitive) -> Self

Converts to this type from the input type.
Source§

impl From<Map<String, ValueType>> for RGBA

Source§

fn from(mvalue: MValue) -> Self

Converts to this type from the input type.
Source§

impl From<RGBA> for ValuePrimitive

Starting from a struct, convert to an ValuePrimitive

Source§

fn from(value: RGBA) -> ValuePrimitive

Converts to this type from the input type.
Source§

impl From<RGBA> for MValue

Source§

fn from(value: RGBA) -> Self

Converts to this type from the input type.
Source§

impl From<RGBA> for ValuePrimitiveType

Starting from a struct, convert to an ValuePrimitiveType for Vec types

Source§

fn from(m: RGBA) -> Self

Converts to this type from the input type.
Source§

impl From<RGBA> for ValueType

Source§

fn from(value: RGBA) -> Self

Converts to this type from the input type.
Source§

impl From<ValuePrimitiveType> for RGBA
where RGBA: Default,

Starting from an ValuePrimitiveType, pull out the struct and apply the conversions

Source§

fn from(m: ValuePrimitiveType) -> Self

Converts to this type from the input type.
Source§

impl GetM<RGBA> for RGBA

Source§

fn m(&self) -> Option<&RGBA>

Returns the m value
Source§

impl GetRasterTileValue for RGBA

Available on crate feature std only.
Source§

fn get_raster_tile_value(r: u8, g: u8, b: u8, a: Option<u8>) -> Self

Get the value of a raster tile pixel
Source§

impl Mul for RGBA

Source§

type Output = RGBA

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: RGBA) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<f64> for RGBA

Source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
Source§

impl MulAssign for RGBA

Source§

fn mul_assign(&mut self, rhs: RGBA)

Performs the *= operation. Read more
Source§

impl PartialEq<f64> for RGBA

Source§

fn eq(&self, rhs: &f64) -> bool

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

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 PartialEq for RGBA

Source§

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

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

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 Serialize for RGBA

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub for RGBA

Source§

type Output = RGBA

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: RGBA) -> Self::Output

Performs the - operation. Read more
Source§

impl Copy for RGBA

Source§

impl MValueCompatible for RGBA

Source§

impl StructuralPartialEq for RGBA

Auto Trait Implementations§

§

impl Freeze for RGBA

§

impl RefUnwindSafe for RGBA

§

impl Send for RGBA

§

impl Sync for RGBA

§

impl Unpin for RGBA

§

impl UnwindSafe for RGBA

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Interpolatable for T