[−][src]Struct pix::hsv::Hsv
HSV hexcone color model, also known as HSB.
The components are hue, saturation, value (or brightness) and optional alpha.
Methods
impl Hsv
[src]
pub fn hue<P: Pixel>(p: P) -> P::Chan where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Get the hue component.
Hue is divided into 6 equal intervals arranged into a circle of degrees:
- 0: Red
- 60: Yellow
- 120: Green
- 180: Cyan
- 240: Blue
- 300: Magenta
The degrees are mapped from Channel::MIN (0) to Channel::MAX (360)
Example: HSV Hue
use pix::chan::Ch32; use pix::hsv::{Hsv, Hsv32}; let p = Hsv32::new(0.25, 0.5, 1.0); assert_eq!(Hsv::hue(p), Ch32::new(0.25));
pub fn hue_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Get a mutable reference to the hue component.
Example: Modify HSV Hue
use pix::chan::{Ch32, Channel}; use pix::hsv::{Hsv, Hsv32}; let mut p = Hsv32::new(0.2, 0.75, 0.5); let mut h = Hsv::hue_mut(&mut p); *h = h.wrapping_sub(Ch32::new(0.4)); assert_eq!(Hsv::hue(p), Ch32::new(0.8));
pub fn saturation<P: Pixel>(p: P) -> P::Chan where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Get the saturation component.
Lower values are more gray (desaturated), while higher values are more colorful. NOTE: HSV saturation is slightly different from HSL saturation.
Example: HSV Saturation
use pix::chan::Ch16; use pix::hsv::{Hsv, Hsv16}; let p = Hsv16::new(0x2000, 0x1234, 0x8000); assert_eq!(Hsv::saturation(p), Ch16::new(0x1234));
pub fn saturation_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Get a mutable reference to the saturation component.
Example: Modify HSV Saturation
use pix::chan::Ch16; use pix::hsv::{Hsv, Hsv16}; let mut p = Hsv16::new(0x2000, 0x1234, 0x8000); *Hsv::saturation_mut(&mut p) = Ch16::new(0x4321); assert_eq!(Hsv::saturation(p), Ch16::new(0x4321));
pub fn value<P: Pixel>(p: P) -> P::Chan where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Get the value (or brightness) component.
Lower values are closer to black, while higher values are closer to fully bright colors.
Example: HSV Value
use pix::chan::Ch8; use pix::hsv::{Hsv, Hsv8}; let p = Hsv8::new(0x93, 0x80, 0xA0); assert_eq!(Hsv::value(p), Ch8::new(0xA0));
pub fn value_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Get a mutable reference to the value component.
Example: Modify HSV Value
use pix::chan::Ch8; use pix::hsv::{Hsv, Hsv8}; let mut p = Hsv8::new(0x93, 0x80, 0xA0); *Hsv::value_mut(&mut p) = Ch8::new(0xBB); assert_eq!(Hsv::value(p), Ch8::new(0xBB));
Trait Implementations
impl Clone for Hsv
[src]
impl ColorModel for Hsv
[src]
const CIRCULAR: Range<usize>
[src]
const LINEAR: Range<usize>
[src]
const ALPHA: usize
[src]
fn into_rgba<P>(p: P) -> PixRgba<P> where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Convert into red, green, blue and alpha components
fn from_rgba<P>(rgba: PixRgba<P>) -> P where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Convert from red, green, blue and alpha components
impl Copy for Hsv
[src]
impl Debug for Hsv
[src]
impl Default for Hsv
[src]
impl PartialEq<Hsv> for Hsv
[src]
impl StructuralPartialEq for Hsv
[src]
Auto Trait Implementations
impl RefUnwindSafe for Hsv
impl Send for Hsv
impl Sync for Hsv
impl Unpin for Hsv
impl UnwindSafe for Hsv
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,