pub struct RgbaColor {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}Expand description
An RGBA color value with 8 bits per component.
Fields§
§r: u8Red component.
g: u8Green component.
b: u8Blue component.
a: u8Alpha component (255 = fully opaque).
Implementations§
Source§impl RgbaColor
impl RgbaColor
Sourcepub const TRANSPARENT: Self
pub const TRANSPARENT: Self
Fully transparent.
Sourcepub fn from_pdf_color(color: &Color, alpha: f32) -> Self
pub fn from_pdf_color(color: &Color, alpha: f32) -> Self
Convert a PDF color to RGBA.
The alpha parameter is in the range [0.0, 1.0].
Color components are interpreted based on the number of components:
- 1 component: DeviceGray
- 3 components: DeviceRGB
- 4 components: DeviceCMYK (simple subtractive conversion)
Sourcepub fn from_resolved_color(
color: &Color,
cs: &ResolvedColorSpace,
alpha: f32,
) -> Self
pub fn from_resolved_color( color: &Color, cs: &ResolvedColorSpace, alpha: f32, ) -> Self
Convert a color using a resolved color space to RGBA.
This handles advanced color spaces (CalGray, CalRGB, Lab, ICCBased, Indexed, Separation, DeviceN) by converting through intermediate device-independent steps to sRGB.
Trait Implementations§
impl Copy for RgbaColor
impl Eq for RgbaColor
impl StructuralPartialEq for RgbaColor
Auto Trait Implementations§
impl Freeze for RgbaColor
impl RefUnwindSafe for RgbaColor
impl Send for RgbaColor
impl Sync for RgbaColor
impl Unpin for RgbaColor
impl UnsafeUnpin for RgbaColor
impl UnwindSafe for RgbaColor
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
Mutably borrows from an owned value. Read more