pub struct Bgr {}
Expand description
Implementations§
source§impl Bgr
impl Bgr
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: Get BGR Blue
use pix::bgr::{Bgr, Bgr8};
use pix::chan::Ch8;
let p = Bgr8::new(0x93, 0x80, 0xA0);
assert_eq!(Bgr::blue(p), Ch8::new(0x93));
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 BGR Blue
use pix::bgr::{Bgr, Bgr8};
use pix::chan::Ch8;
let mut p = Bgr8::new(0x88, 0x77, 0x66);
*Bgr::blue_mut(&mut p) = 0x55.into();
assert_eq!(Bgr::blue(p), Ch8::new(0x55));
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: BGR Green
use pix::bgr::{Bgr, Bgr16};
use pix::chan::Ch16;
let p = Bgr16::new(0x2000, 0x1234, 0x8000);
assert_eq!(Bgr::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 BGR Green
use pix::bgr::{Bgr, Bgr16};
use pix::chan::Ch16;
let mut p = Bgr16::new(0x2000, 0x1234, 0x8000);
*Bgr::green_mut(&mut p) = 0x4321.into();
assert_eq!(Bgr::green(p), Ch16::new(0x4321));
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: BGR Red
use pix::bgr::{Bgr, Bgr32};
use pix::chan::Ch32;
let p = Bgr32::new(0.25, 0.5, 1.0);
assert_eq!(Bgr::red(p), Ch32::new(1.0));
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 BGR Red
use pix::bgr::{Bgr, Bgr32};
use pix::chan::Ch32;
let mut p = Bgr32::new(0.25, 0.5, 1.0);
*Bgr::red_mut(&mut p) = Ch32::new(0.75);
assert_eq!(Bgr::red(p), Ch32::new(0.75));
Trait Implementations§
source§impl ColorModel for Bgr
impl ColorModel for Bgr
impl Copy for Bgr
impl Eq for Bgr
impl StructuralEq for Bgr
impl StructuralPartialEq for Bgr
Auto Trait Implementations§
impl RefUnwindSafe for Bgr
impl Send for Bgr
impl Sync for Bgr
impl Unpin for Bgr
impl UnwindSafe for Bgr
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