pub struct Extend { /* private fields */ }Expand description
Add top, right, bottom and left pixels around an image.
Like crate::Resize, an instance belongs to one graph edge: copy,
repeat and mirror wrap around the input’s size, which is bound when the
op is chained, and chaining the same instance onto a differently sized
image is a PixelsError::Graph.
Implementations§
Source§impl Extend
impl Extend
Sourcepub const fn new(top: u32, right: u32, bottom: u32, left: u32) -> Extend
pub const fn new(top: u32, right: u32, bottom: u32, left: u32) -> Extend
Margins of top, right, bottom and left pixels, filled with
opaque black, sharp’s default.
Sourcepub const fn extend_with(self, with: ExtendWith) -> Extend
pub const fn extend_with(self, with: ExtendWith) -> Extend
Fill the margin by with instead of the background colour.
Sourcepub const fn with_background(self, rgba: [u8; 4]) -> Extend
pub const fn with_background(self, rgba: [u8; 4]) -> Extend
The RGBA colour ExtendWith::Background paints. Grey formats take
its luma, and formats without alpha ignore its alpha.
Sourcepub const fn margins(&self) -> (u32, u32, u32, u32)
pub const fn margins(&self) -> (u32, u32, u32, u32)
The margins, as (top, right, bottom, left).
Sourcepub const fn method(&self) -> ExtendWith
pub const fn method(&self) -> ExtendWith
How the margin is filled.
Sourcepub const fn background(&self) -> [u8; 4]
pub const fn background(&self) -> [u8; 4]
The background colour.
Trait Implementations§
Source§impl Op for Extend
impl Op for Extend
Source§fn rescaled(&self) -> Option<Arc<dyn Op>>
fn rescaled(&self) -> Option<Arc<dyn Op>>
Never rescaled: the margins are in output pixels, and a margin of 10 around a source decoded eight times smaller would be 80 at full size.
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