pub struct WatermarkInput {
pub image: Artifact,
pub position: Position,
pub opacity: u8,
pub margin: u32,
}Expand description
A watermark image to composite onto the output.
The watermark is alpha-composited onto the main image after all other transforms (resize, blur) and before encoding.
use truss::{Artifact, ArtifactMetadata, MediaType, Position, WatermarkInput};
let wm = WatermarkInput {
image: Artifact::new(vec![0], MediaType::Png, ArtifactMetadata::default()),
position: Position::BottomRight,
opacity: 50,
margin: 10,
};
assert_eq!(wm.opacity, 50);Fields§
§image: ArtifactThe watermark image (already classified via sniff_artifact).
position: PositionWhere to place the watermark on the main image.
opacity: u8Opacity of the watermark (1–100). Default: 50.
margin: u32Margin in pixels from the nearest edge. Default: 10.
Trait Implementations§
Source§impl Clone for WatermarkInput
impl Clone for WatermarkInput
Source§fn clone(&self) -> WatermarkInput
fn clone(&self) -> WatermarkInput
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WatermarkInput
impl Debug for WatermarkInput
Source§impl PartialEq for WatermarkInput
impl PartialEq for WatermarkInput
impl Eq for WatermarkInput
impl StructuralPartialEq for WatermarkInput
Auto Trait Implementations§
impl Freeze for WatermarkInput
impl RefUnwindSafe for WatermarkInput
impl Send for WatermarkInput
impl Sync for WatermarkInput
impl Unpin for WatermarkInput
impl UnsafeUnpin for WatermarkInput
impl UnwindSafe for WatermarkInput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more