Skip to main content

Composite

Struct Composite 

Source
pub struct Composite { /* private fields */ }
Expand description

Draw an overlay over a base.

Input order is [base, overlay], matching the reading order of “composite this over that”. The two may differ in format: the result has the base’s depth, gains colour when the overlay has it and the base is grey, and gains alpha when the blend can make an opaque base translucent.

Implementations§

Source§

impl Composite

Source

pub const fn new(placement: Placement, blend: Blend) -> Composite

Draw the overlay where placement says, combined by blend.

Source

pub const fn at(x: i64, y: i64, blend: Blend) -> Composite

Draw the overlay with its top-left corner at (x, y) in base coordinates.

Negative offsets are allowed: the overlay is clipped to the base rather than rejected, which is what makes “centre a watermark” expressible without the caller doing the clipping arithmetic.

Source

pub const fn over() -> Composite

Draw the overlay over the base at the origin with source-over.

Source

pub const fn placement(&self) -> Placement

Where the overlay goes.

Source

pub const fn blend(&self) -> Blend

The blend mode.

Trait Implementations§

Source§

impl Clone for Composite

Source§

fn clone(&self) -> Composite

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Composite

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Op for Composite

Source§

fn rescaled(&self) -> Option<Arc<dyn Op>>

Never rescaled, for two independent reasons: the overlay position is in pixels, and the second input is a separate image that would not be reduced alongside the first.

Source§

fn name(&self) -> &'static str

A short, stable name for this op, used in diagnostics.
Source§

fn arity(&self) -> usize

The number of inputs this op consumes.
Source§

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>

The input regions needed to produce output. Read more
Source§

fn compute( &self, inputs: &[Tile<'_>], output: &mut TileMut<'_>, ) -> Result<(), PixelsError>

Fill output from inputs — the kernel entry point. Read more
Source§

fn access_pattern(&self) -> AccessPattern

How this op reads its inputs; drives tile negotiation (ADR-0003). Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.