Struct asdf_pixel_sort::PColor [−][src]
Expand description
Representation of a color with Processing compatible
Fields
red: u8green: u8blue: u8alpha: u8Implementations
Creates a new PColor struct from a signed integer.
This function expects an internal representation of Processing’s RGB color.
Example
let color = PColor::new(11, 220, 0);
assert_eq!(color, PColor::from_raw(-16000000));
assert_eq!(color, color.as_raw().into());Inverse operation
PColor::from_raw() method is an inverse operation for PColor::as_raw() function.
let value = -13000000;
assert_eq!(value, PColor::from_raw(value).as_raw());Returns an internal representation of Processing’s RGB color as a signed integer.
Ref. https://processing.org/reference/color_datatype.html
Example
let color = PColor::new(11, 220, 0);
assert_eq!(color.as_raw(), -16000000);
assert_eq!(color, color.as_raw().into());Inverse operation
PColor::as_raw() method is an inverse operation for PColor::from_raw() function.
let color = PColor::new(11, 220, 0);
assert_eq!(color, color.as_raw().into());
assert_eq!(color, PColor::from_raw(color.as_raw())); // Same aboveComputes a brightness value of Processing between 0 to 255.
Trait Implementations
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for PColor
impl UnwindSafe for PColor
Blanket Implementations
Mutably borrows from an owned value. Read more