pub struct Linear { /* private fields */ }Expand description
A per-channel linear map, value * a + b (sharp’s linear). b is in
8-bit units, as in sharp: an offset of 255 is the full range, at any
depth. Alpha is untouched.
Implementations§
Source§impl Linear
impl Linear
Sourcepub fn new(a: f32, b: f32) -> Result<Linear, PixelsError>
pub fn new(a: f32, b: f32) -> Result<Linear, PixelsError>
The same a and b for every colour channel.
§Errors
Returns PixelsError::InvalidArgument unless both are finite.
Sourcepub fn per_channel(a: [f32; 3], b: [f32; 3]) -> Result<Linear, PixelsError>
pub fn per_channel(a: [f32; 3], b: [f32; 3]) -> Result<Linear, PixelsError>
A separate a and b for red, green and blue. Greyscale images use
the first of each.
§Errors
As Linear::new.
Trait Implementations§
impl Copy for Linear
Source§impl Op for Linear
impl Op for Linear
Source§fn rescaled(&self) -> Option<Arc<dyn Op>>
fn rescaled(&self) -> Option<Arc<dyn Op>>
A copy of this op fit for a graph rebuilt at a reduced input
resolution, or
None if this op must not be. Read moreSource§fn output_descriptor(
&self,
inputs: &[ImageDescriptor],
) -> Result<ImageDescriptor, PixelsError>
fn output_descriptor( &self, inputs: &[ImageDescriptor], ) -> Result<ImageDescriptor, PixelsError>
Compute the output shape from the input shapes. Read more
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>
The input regions needed to produce
output. Read moreSource§fn compute(
&self,
inputs: &[Tile<'_>],
output: &mut TileMut<'_>,
) -> Result<(), PixelsError>
fn compute( &self, inputs: &[Tile<'_>], output: &mut TileMut<'_>, ) -> Result<(), PixelsError>
Source§fn access_pattern(&self) -> AccessPattern
fn access_pattern(&self) -> AccessPattern
How this op reads its inputs; drives tile negotiation (ADR-0003). Read more
impl StructuralPartialEq for Linear
Auto Trait Implementations§
impl Freeze for Linear
impl RefUnwindSafe for Linear
impl Send for Linear
impl Sync for Linear
impl Unpin for Linear
impl UnsafeUnpin for Linear
impl UnwindSafe for Linear
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more