pub struct ImageDocument {
pub id: String,
pub width: u32,
pub height: u32,
pub layers: Vec<ImageLayer>,
pub active_layer: usize,
pub selections: BTreeMap<String, Selection>,
}Expand description
An image document with multiple layers.
Fields§
§id: String§width: u32§height: u32§layers: Vec<ImageLayer>§active_layer: usize§selections: BTreeMap<String, Selection>Implementations§
Source§impl ImageDocument
impl ImageDocument
Sourcepub fn new(id: &str, width: u32, height: u32) -> Self
pub fn new(id: &str, width: u32, height: u32) -> Self
Creates a widthxheight document with one default layer.
Sourcepub fn add_layer(&mut self, name: &str) -> &mut ImageLayer
pub fn add_layer(&mut self, name: &str) -> &mut ImageLayer
Appends a layer named name and makes it active; returns it mutably.
Sourcepub fn remove_layer(&mut self, index: usize) -> bool
pub fn remove_layer(&mut self, index: usize) -> bool
Removes layer index; false when out of range.
Sourcepub fn active_layer_mut(&mut self) -> Option<&mut ImageLayer>
pub fn active_layer_mut(&mut self) -> Option<&mut ImageLayer>
Mutable access to the active layer, or None.
Sourcepub fn layer_count(&self) -> usize
pub fn layer_count(&self) -> usize
Number of layers.
Sourcepub fn try_composite(
&self,
limits: ImageLimits,
) -> Result<Vec<[u8; 4]>, ImageError>
pub fn try_composite( &self, limits: ImageLimits, ) -> Result<Vec<[u8; 4]>, ImageError>
Fallible, bounded cold authoring composition. Source layers remain immutable.
Sourcepub fn composite_into(
&self,
out: &mut [[u8; 4]],
limits: ImageLimits,
) -> Result<(), ImageError>
pub fn composite_into( &self, out: &mut [[u8; 4]], limits: ImageLimits, ) -> Result<(), ImageError>
Caller-buffered composition; admission finishes before any output changes.
Sourcepub fn composite(&self) -> Vec<[u8; 4]>
pub fn composite(&self) -> Vec<[u8; 4]>
Composite valid layers with their blend modes, masks and signed placement.
§Panics
A malformed/out-of-budget legacy document panics before producing output. Use try_composite or composite_into for explicit non-panicking refusal.
Sourcepub fn add_selection(&mut self, selection: Selection)
pub fn add_selection(&mut self, selection: Selection)
Adds a selection region.
Sourcepub fn clear_selections(&mut self)
pub fn clear_selections(&mut self)
Clears all selection regions.
Trait Implementations§
Source§impl Clone for ImageDocument
impl Clone for ImageDocument
Auto Trait Implementations§
impl Freeze for ImageDocument
impl RefUnwindSafe for ImageDocument
impl Send for ImageDocument
impl Sync for ImageDocument
impl Unpin for ImageDocument
impl UnsafeUnpin for ImageDocument
impl UnwindSafe for ImageDocument
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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