pub struct SkColor(/* private fields */);engine only.Expand description
32-bit ARGB color value, unpremultiplied. Color components are always in a known order. This is
different from SkPMColor, which has its bytes in a configuration dependent order, to match
the format of BGRA 8888 color type bitmaps. Color is the type used to specify colors in
crate::Paint and in gradients.
Color that is premultiplied has the same component values as color that is unpremultiplied if alpha is 255, fully opaque, although it may have the component values in a different order.
Implementations§
Source§impl Color
impl Color
Sourcepub const TRANSPARENT: Color
pub const TRANSPARENT: Color
Represents a fully transparent color. May be used to initialize a destination containing a mask or a non-rectangular image.
Sourcepub const DARK_GRAY: Color
pub const DARK_GRAY: Color
Represents fully opaque dark gray. Note that SVG dark gray is equivalent to 0xFFA9A9A9.
Sourcepub const GRAY: Color
pub const GRAY: Color
Represents fully opaque gray. Note that HTML gray is equivalent to 0xFF808080.
Sourcepub const LIGHT_GRAY: Color
pub const LIGHT_GRAY: Color
Represents fully opaque light gray. HTML silver is equivalent to 0xFFC0C0C0. Note that
SVG light gray is equivalent to 0xFFD3D3D3.
Sourcepub const GREEN: Color
pub const GREEN: Color
Represents fully opaque green. HTML lime is equivalent. Note that HTML green is equivalent
to 0xFF008000.
pub const fn new(argb: u32) -> Color
Sourcepub const fn from_argb(a: u8, r: u8, g: u8, b: u8) -> Color
pub const fn from_argb(a: u8, r: u8, g: u8, b: u8) -> Color
Returns a color value from 8-bit component values. Asserts if a, r, g, or b exceed
255. Since the color is unpremultiplied, a may be smaller than the largest of r, g,
and b.
aamount of alpha, from fully transparent (0) to fully opaque (255)ramount of red, from no red (0) to full red (255)gamount of green, from no green (0) to full green (255)bamount of blue, from no blue (0) to full blue (255)
Sourcepub const fn from_rgb(r: u8, g: u8, b: u8) -> Color
pub const fn from_rgb(r: u8, g: u8, b: u8) -> Color
Returns a color value from 8-bit component values, with alpha set fully opaque to 255.
ramount of red, from no red (0) to full red (255)gamount of green, from no green (0) to full green (255)bamount of blue, from no blue (0) to full blue (255)
Sourcepub fn with_a(self, a: u8) -> Color
pub fn with_a(self, a: u8) -> Color
Returns an unpremultiplied color with red, blue, and green set from this color, and alpha
set from a. The alpha component of this color is ignored and is replaced by a in the
result.
aalpha: transparent at zero, fully opaque at 255
pub fn to_rgb(self) -> RGB
pub fn to_hsv(self) -> HSV
Trait Implementations§
impl Copy for Color
impl Eq for Color
Source§impl Pixel for Color
impl Pixel for Color
Source§fn matches_color_type(ct: ColorType) -> bool
fn matches_color_type(ct: ColorType) -> bool
true if the type matches the color type’s format.impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Forget for Color
impl Freeze for Color
impl Move for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ComponentProps for T
impl<T> ComponentProps for T
fn changed(&self, other: &(dyn ComponentProps + 'static)) -> bool
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> IntoReadable<T> for Twhere
T: 'static + PartialEq,
impl<T> IntoReadable<T> for Twhere
T: 'static + PartialEq,
fn into_readable(self) -> Readable<T>
Source§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Source§impl<N, T> NativeTransmutableWrapper<N> for Twhere
T: NativeTransmutable<N>,
impl<N, T> NativeTransmutableWrapper<N> for Twhere
T: NativeTransmutable<N>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().