#[non_exhaustive]pub struct Modulate {
pub brightness: f32,
pub saturation: f32,
pub hue: f32,
}Expand description
Brightness, saturation and hue adjustment (SPEC §Core ops).
Saturation and hue are defined in HSV, which is what modulate means
everywhere else in this corner of the ecosystem. That is a deliberate
compatibility choice rather than a claim that HSV is the right colour
model: it is not perceptually uniform, and v2’s ICC work is where a
principled version belongs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.brightness: f32Multiplier on value/lightness. 1.0 leaves it unchanged.
saturation: f32Multiplier on saturation. 1.0 leaves it unchanged, 0.0 is greyscale.
hue: f32Rotation of hue in degrees.
Implementations§
Source§impl Modulate
impl Modulate
Sourcepub fn with_brightness(self, factor: f32) -> Result<Modulate, PixelsError>
pub fn with_brightness(self, factor: f32) -> Result<Modulate, PixelsError>
Scale brightness by factor.
§Errors
Returns PixelsError::InvalidArgument if factor is negative or not
finite — a NaN multiplier would propagate silently into every pixel.
Sourcepub fn with_saturation(self, factor: f32) -> Result<Modulate, PixelsError>
pub fn with_saturation(self, factor: f32) -> Result<Modulate, PixelsError>
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Whether this modulation is the identity, and can be skipped entirely.
Trait Implementations§
impl Copy for Modulate
Source§impl Op for Modulate
impl Op for Modulate
Source§fn rescaled(&self) -> Option<Arc<dyn Op>>
fn rescaled(&self) -> Option<Arc<dyn Op>>
Pointwise: every output pixel depends on the one input pixel beneath it, with no length or coordinate anywhere, so resolution is irrelevant to what this op means, and there is no bound state to discard.
Source§fn output_descriptor(
&self,
inputs: &[ImageDescriptor],
) -> Result<ImageDescriptor, PixelsError>
fn output_descriptor( &self, inputs: &[ImageDescriptor], ) -> Result<ImageDescriptor, PixelsError>
Source§fn input_regions(
&self,
output: Region,
_inputs: &[ImageDescriptor],
) -> Result<Vec<Region>, PixelsError>
fn input_regions( &self, output: Region, _inputs: &[ImageDescriptor], ) -> Result<Vec<Region>, PixelsError>
output. Read more