Function photon_rs::monochrome::monochrome
source · pub fn monochrome(
img: &mut PhotonImage,
r_offset: u32,
g_offset: u32,
b_offset: u32
)
Expand description
Apply a monochrome effect of a certain colour.
It does so by averaging the R, G, and B values of a pixel, and then adding a separate value to that averaged value for each channel to produce a tint.
Arguments
photon_image
- A PhotonImage.r_offset
- The value to add to the Red channel per pixel.g_offset
- The value to add to the Green channel per pixel.b_offset
- The value to add to the Blue channel per pixel.
Example
// For example, to apply a monochrome effect to an image:
use photon_rs::monochrome::monochrome;
use photon_rs::native::open_image;
let mut img = open_image("img.jpg").expect("File should open");
monochrome(&mut img, 40_u32, 50_u32, 100_u32);