egui

Struct Rgba

Source
#[repr(C)]
pub struct Rgba(/* private fields */);
Expand description

0-1 linear space RGBA color with premultiplied alpha.

Implementations§

Source§

impl Rgba

Source

pub const TRANSPARENT: Rgba = _

Source

pub const BLACK: Rgba = _

Source

pub const WHITE: Rgba = _

Source

pub const RED: Rgba = _

Source

pub const GREEN: Rgba = _

Source

pub const BLUE: Rgba = _

Source

pub const fn from_rgba_premultiplied(r: f32, g: f32, b: f32, a: f32) -> Rgba

Source

pub fn from_rgba_unmultiplied(r: f32, g: f32, b: f32, a: f32) -> Rgba

Source

pub fn from_srgba_premultiplied(r: u8, g: u8, b: u8, a: u8) -> Rgba

Source

pub fn from_srgba_unmultiplied(r: u8, g: u8, b: u8, a: u8) -> Rgba

Source

pub const fn from_rgb(r: f32, g: f32, b: f32) -> Rgba

Source

pub const fn from_gray(l: f32) -> Rgba

Source

pub fn from_luminance_alpha(l: f32, a: f32) -> Rgba

Source

pub fn from_black_alpha(a: f32) -> Rgba

Transparent black

Source

pub fn from_white_alpha(a: f32) -> Rgba

Transparent white

Source

pub fn additive(self) -> Rgba

Return an additive version of this color (alpha = 0)

Source

pub fn is_additive(self) -> bool

Is the alpha=0 ?

Source

pub fn multiply(self, alpha: f32) -> Rgba

Multiply with e.g. 0.5 to make us half transparent

Source

pub fn r(&self) -> f32

Source

pub fn g(&self) -> f32

Source

pub fn b(&self) -> f32

Source

pub fn a(&self) -> f32

Source

pub fn intensity(&self) -> f32

How perceptually intense (bright) is the color?

Source

pub fn to_opaque(&self) -> Rgba

Returns an opaque version of self

Source

pub fn to_array(&self) -> [f32; 4]

Premultiplied RGBA

Source

pub fn to_tuple(&self) -> (f32, f32, f32, f32)

Premultiplied RGBA

Source

pub fn to_rgba_unmultiplied(&self) -> [f32; 4]

unmultiply the alpha

Source

pub fn to_srgba_unmultiplied(&self) -> [u8; 4]

unmultiply the alpha

Trait Implementations§

Source§

impl Add for Rgba

Source§

type Output = Rgba

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Rgba) -> Rgba

Performs the + operation. Read more
Source§

impl Clone for Rgba

Source§

fn clone(&self) -> Rgba

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 Debug for Rgba

Source§

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

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

impl Default for Rgba

Source§

fn default() -> Rgba

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

impl<'de> Deserialize<'de> for Rgba

Source§

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

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

impl From<Color32> for Rgba

Source§

fn from(srgba: Color32) -> Rgba

Converts to this type from the input type.
Source§

impl From<Hsva> for Rgba

Source§

fn from(hsva: Hsva) -> Rgba

Converts to this type from the input type.
Source§

impl From<HsvaGamma> for Rgba

Source§

fn from(hsvag: HsvaGamma) -> Rgba

Converts to this type from the input type.
Source§

impl From<Rgba> for Color32

Source§

fn from(rgba: Rgba) -> Color32

Converts to this type from the input type.
Source§

impl Hash for Rgba

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 Index<usize> for Rgba

Source§

type Output = f32

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &f32

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

impl IndexMut<usize> for Rgba

Source§

fn index_mut(&mut self, index: usize) -> &mut f32

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

impl Mul<f32> for Rgba

Source§

type Output = Rgba

The resulting type after applying the * operator.
Source§

fn mul(self, factor: f32) -> Rgba

Performs the * operation. Read more
Source§

impl Mul for Rgba

Source§

type Output = Rgba

The resulting type after applying the * operator.
Source§

fn mul(self, other: Rgba) -> Rgba

Performs the * operation. Read more
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 · 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 Serialize for Rgba

Source§

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

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

impl Zeroable for Rgba

Source§

fn zeroed() -> Self

Source§

impl Copy for Rgba

Source§

impl Pod 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§

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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

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

Source§

impl<T> NoUninit for T
where T: Pod,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,