pub struct Rgb {
pub r: f32,
pub g: f32,
pub b: f32,
}Expand description
A colour in the device’s RGB space, each channel nominally in 0..=1.
Not clamped on construction: several conversion paths deliberately return
out-of-range values (CalGray passes its input through untouched) and the
consumer clamps where PDFium clamps.
Fields§
§r: f32Red.
g: f32Green.
b: f32Blue.
Implementations§
Source§impl Rgb
impl Rgb
Sourcepub fn to_bytes(self) -> [u8; 3]
pub fn to_bytes(self) -> [u8; 3]
The eight-bit encoding used for colour references: clamp, then round to nearest.
Contrast Self::to_bytes_truncating, which the bulk image path
uses. The two differ by one on roughly half of all inputs, so calling
the wrong one is a visible bug.
Sourcepub fn to_bytes_truncating(self) -> [u8; 3]
pub fn to_bytes_truncating(self) -> [u8; 3]
The eight-bit encoding the image scanline path uses: clamp, then truncate.
Trait Implementations§
impl Copy for Rgb
impl StructuralPartialEq for Rgb
Auto Trait Implementations§
impl Freeze for Rgb
impl RefUnwindSafe for Rgb
impl Send for Rgb
impl Sync for Rgb
impl Unpin for Rgb
impl UnsafeUnpin for Rgb
impl UnwindSafe for Rgb
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