core: Add documentation to Color.
This commit is contained in:
parent
9de2abe8b8
commit
8c92cecb60
|
@ -33,6 +33,18 @@ impl LehmerRng {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An ARGB color value.
|
||||||
|
///
|
||||||
|
/// It can be in two forms:
|
||||||
|
/// - Pre-multiplied alpha, where the non-alpha values are pre-multiplied with
|
||||||
|
/// the alpha value.
|
||||||
|
/// - Non-pre-multiplied alpha, where the non-alpha values are not pre-multiplied
|
||||||
|
/// with the alpha value.
|
||||||
|
/// The type system as of this writing (May 2023) does not differentiate between
|
||||||
|
/// the two forms.
|
||||||
|
/// Notably, BitmapData stores internally its color values in pre-multiplied alpha form,
|
||||||
|
/// while the ActionScript interface uses non-pre-multiplied alpha form for color
|
||||||
|
/// values.
|
||||||
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Collect)]
|
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Collect)]
|
||||||
#[collect(no_drop)]
|
#[collect(no_drop)]
|
||||||
pub struct Color(i32);
|
pub struct Color(i32);
|
||||||
|
@ -126,6 +138,10 @@ impl Color {
|
||||||
Self::argb(alpha, self.red(), self.green(), self.blue())
|
Self::argb(alpha, self.red(), self.green(), self.blue())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// # Arguments
|
||||||
|
///
|
||||||
|
/// * `self` - Must be in pre-multiplied alpha form.
|
||||||
|
/// * `source` - Must be in pre-multiplied alpha form.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn blend_over(&self, source: &Self) -> Self {
|
pub fn blend_over(&self, source: &Self) -> Self {
|
||||||
let sa = source.alpha();
|
let sa = source.alpha();
|
||||||
|
|
Loading…
Reference in New Issue