Struct egui::Rgba

pub struct Rgba(_);
Expand description

0-1 linear space RGBA color with premultiplied alpha.

Implementations§

§

impl Rgba

pub const TRANSPARENT: Rgba = Rgba::from_rgba_premultiplied(0.0, 0.0, 0.0, 0.0)

pub const BLACK: Rgba = Rgba::from_rgb(0.0, 0.0, 0.0)

pub const WHITE: Rgba = Rgba::from_rgb(1.0, 1.0, 1.0)

pub const RED: Rgba = Rgba::from_rgb(1.0, 0.0, 0.0)

pub const GREEN: Rgba = Rgba::from_rgb(0.0, 1.0, 0.0)

pub const BLUE: Rgba = Rgba::from_rgb(0.0, 0.0, 1.0)

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

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

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

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

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

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

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

pub fn from_black_alpha(a: f32) -> Rgba

Transparent black

pub fn from_white_alpha(a: f32) -> Rgba

Transparent white

pub fn additive(self) -> Rgba

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

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

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

pub fn r(&self) -> f32

pub fn g(&self) -> f32

pub fn b(&self) -> f32

pub fn a(&self) -> f32

pub fn intensity(&self) -> f32

How perceptually intense (bright) is the color?

pub fn to_opaque(&self) -> Rgba

Returns an opaque version of self

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

Premultiplied RGBA

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

Premultiplied RGBA

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

unmultiply the alpha

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

unmultiply the alpha

Trait Implementations§

§

impl Add<Rgba> for Rgba

§

type Output = Rgba

The resulting type after applying the + operator.
§

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

Performs the + operation. Read more
§

impl Clone for Rgba

§

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
§

impl ColorInterop for Rgba

§

type CintTy = PremultipliedAlpha<LinearSrgb<f32>>

§

fn from_cint(col: Self::CintTy) -> Self

Convert self into its canonical cint type.
§

fn into_cint(self) -> Self::CintTy

Create a Self from its canonical cint type.
§

impl Debug for Rgba

§

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

Formats the value using the given formatter. Read more
§

impl Default for Rgba

§

fn default() -> Rgba

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

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

§

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
§

impl From<Color32> for Rgba

§

fn from(srgba: Color32) -> Rgba

Converts to this type from the input type.
§

impl From<Hsva> for Rgba

§

fn from(hsva: Hsva) -> Rgba

Converts to this type from the input type.
§

impl From<HsvaGamma> for Rgba

§

fn from(hsvag: HsvaGamma) -> Rgba

Converts to this type from the input type.
§

impl From<PremultipliedAlpha<LinearSrgb<f32>>> for Rgba

§

fn from(srgba: PremultipliedAlpha<LinearSrgb<f32>>) -> Rgba

Converts to this type from the input type.
§

impl From<Rgba> for Color32

§

fn from(rgba: Rgba) -> Color32

Converts to this type from the input type.
§

impl Hash for Rgba

§

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
§

impl Index<usize> for Rgba

§

type Output = f32

The returned type after indexing.
§

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

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

impl IndexMut<usize> for Rgba

§

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

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

impl Mul<Rgba> for Rgba

§

type Output = Rgba

The resulting type after applying the * operator.
§

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

Performs the * operation. Read more
§

impl Mul<f32> for Rgba

§

type Output = Rgba

The resulting type after applying the * operator.
§

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

Performs the * operation. Read more
§

impl PartialEq<Rgba> for Rgba

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for Rgba

§

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
§

impl Zeroable for Rgba

§

fn zeroed() -> Self

§

impl Copy for Rgba

§

impl Pod for Rgba

§

impl StructuralPartialEq for Rgba

Auto Trait Implementations§

§

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 Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,

§

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

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

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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 Twhere
T: Clone,

§

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 Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> AnyBitPattern for Twhere
T: Pod,

source§

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

§

impl<T> NoUninit for Twhere
T: Pod,

source§

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