Function photon_rs::channels::selective_hue_rotate
source · pub fn selective_hue_rotate(
photon_image: &mut PhotonImage,
ref_color: Rgb,
degrees: f32
)
Expand description
Selective hue rotation.
Only rotate the hue of a pixel if its RGB values are within a specified range. This function only rotates a pixel’s hue to another if it is visually similar to the colour specified. For example, if a user wishes all pixels that are blue to be changed to red, they can selectively specify only the blue pixels to be changed.
Arguments
img
- A PhotonImage.ref_color
- TheRGB
value of the reference color (to be compared to)degrees
- The amount of degrees to hue rotate by.
Example
// For example, to only rotate the pixels that are of RGB value RGB{20, 40, 60}:
use photon_rs::Rgb;
use photon_rs::channels::selective_hue_rotate;
use photon_rs::native::open_image;
let ref_color = Rgb::new(20_u8, 40_u8, 60_u8);
let mut img = open_image("img.jpg").expect("File should open");
selective_hue_rotate(&mut img, ref_color, 180_f32);