pub struct Trim { /* private fields */ }Expand description
Options for finding a trim box.
Implementations§
Source§impl Trim
impl Trim
Sourcepub const fn with_background(self, rgba: [u8; 4]) -> Trim
pub const fn with_background(self, rgba: [u8; 4]) -> Trim
Trim this RGBA colour rather than the top-left pixel’s.
Sourcepub fn with_threshold(self, threshold: f32) -> Result<Trim, PixelsError>
pub fn with_threshold(self, threshold: f32) -> Result<Trim, PixelsError>
How far, in 8-bit units at any depth, a channel may differ from the background and still be background.
§Errors
Returns PixelsError::InvalidArgument unless threshold is finite
and not negative.
Sourcepub const fn line_art(self, line_art: bool) -> Trim
pub const fn line_art(self, line_art: bool) -> Trim
Skip the median, so a line one pixel wide counts as content (sharp’s
lineArt).
Sourcepub fn find(&self, tile: &Tile<'_>) -> Result<Option<Region>, PixelsError>
pub fn find(&self, tile: &Tile<'_>) -> Result<Option<Region>, PixelsError>
The box of tile that is not background, in the tile’s coordinates,
or None if every pixel is background (sharp then leaves the image
alone).
§Errors
Returns PixelsError::InvalidArgument for an image narrower and
shorter than 3 pixels, which sharp refuses too.
Trait Implementations§
impl Copy for Trim
impl StructuralPartialEq for Trim
Auto Trait Implementations§
impl Freeze for Trim
impl RefUnwindSafe for Trim
impl Send for Trim
impl Sync for Trim
impl Unpin for Trim
impl UnsafeUnpin for Trim
impl UnwindSafe for Trim
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