pub struct Rgb {}
Implementations§
source§impl Rgb
impl Rgb
sourcepub fn red<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn red<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the red component.
Example: RGB Red
use pix::chan::Ch32;
use pix::rgb::{Rgb, Rgb32};
let p = Rgb32::new(0.25, 0.5, 1.0);
assert_eq!(Rgb::red(p), Ch32::new(0.25));
sourcepub fn red_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn red_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the red component.
Example: Modify RGB Red
use pix::chan::Ch32;
use pix::rgb::{Rgb, Rgb32};
let mut p = Rgb32::new(0.25, 0.5, 1.0);
*Rgb::red_mut(&mut p) = Ch32::new(0.75);
assert_eq!(Rgb::red(p), Ch32::new(0.75));
sourcepub fn green<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn green<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the green component.
Example: RGB Green
use pix::chan::Ch16;
use pix::rgb::{Rgb, Rgb16};
let p = Rgb16::new(0x2000, 0x1234, 0x8000);
assert_eq!(Rgb::green(p), Ch16::new(0x1234));
sourcepub fn green_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn green_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the green component.
Example: Modify RGB Green
use pix::chan::Ch16;
use pix::rgb::{Rgb, Rgb16};
let mut p = Rgb16::new(0x2000, 0x1234, 0x8000);
*Rgb::green_mut(&mut p) = 0x4321.into();
assert_eq!(Rgb::green(p), Ch16::new(0x4321));
sourcepub fn blue<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn blue<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the blue component.
Example: RGB Blue
use pix::chan::Ch8;
use pix::rgb::{Rgb, Rgb8};
let p = Rgb8::new(0x93, 0x80, 0xA0);
assert_eq!(Rgb::blue(p), Ch8::new(0xA0));
sourcepub fn blue_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn blue_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the blue component.
Example: Modify RGB Blue
use pix::chan::Ch8;
use pix::rgb::{Rgb, Rgb8};
let mut p = Rgb8::new(0x88, 0x77, 0x66);
*Rgb::blue_mut(&mut p) = 0x55.into();
assert_eq!(Rgb::blue(p), Ch8::new(0x55));
sourcepub fn difference<P>(p: P, rhs: P) -> Pwhere
P: Pixel<Model = Self> + Pixel,
pub fn difference<P>(p: P, rhs: P) -> Pwhere P: Pixel<Model = Self> + Pixel,
Get channel-wise difference
sourcepub fn within_threshold<P>(p: P, rhs: P) -> boolwhere
P: Pixel<Model = Self> + Pixel,
pub fn within_threshold<P>(p: P, rhs: P) -> boolwhere P: Pixel<Model = Self> + Pixel,
Check if all Channel
s are within threshold
Trait Implementations§
source§impl ColorModel for Rgb
impl ColorModel for Rgb
impl Copy for Rgb
impl Eq for Rgb
impl StructuralEq for Rgb
impl StructuralPartialEq for Rgb
Auto Trait Implementations§
impl RefUnwindSafe for Rgb
impl Send for Rgb
impl Sync for Rgb
impl Unpin 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