Struct divoom::DivoomAnimationBuilder
source · [−]pub struct DivoomAnimationBuilder { /* private fields */ }
Expand description
Animation builder
This class holds a series of tiny_skia::Pixmap inside with the same size to provide an interface for building animations.
Implementations
sourceimpl DivoomAnimationBuilder
impl DivoomAnimationBuilder
sourcepub fn new(
canvas_size: u32,
speed: Duration
) -> DivoomAPIResult<DivoomAnimationBuilder>
pub fn new(
canvas_size: u32,
speed: Duration
) -> DivoomAPIResult<DivoomAnimationBuilder>
Create a new animation builder with canvas size and speed.
For Divoom devices, only 16, 32 and 64 pixels canvas are allowed. When other value is specified, we will return failure.
sourcepub fn canvas_size(&self) -> u32
pub fn canvas_size(&self) -> u32
Return canvas size
sourcepub fn build_frame(&mut self, index: usize) -> DivoomAnimationFrameBuilder<'_>
pub fn build_frame(&mut self, index: usize) -> DivoomAnimationFrameBuilder<'_>
Return a builder for the specified frame.
If the frame is not created or any previous frame is not created for the specified index, we will create all of them and return the builder for the last frame.
pub fn new_frame(&mut self) -> DivoomAnimationFrameBuilder<'_>
sourceimpl DivoomAnimationBuilder
impl DivoomAnimationBuilder
sourcepub fn draw_frames(self, frames: &[Pixmap], start_frame_index: usize) -> Self
pub fn draw_frames(self, frames: &[Pixmap], start_frame_index: usize) -> Self
Draw a series of frames to the canvas.
- Frames doesn’t need to be having the same size, as they will be drawn separately one by one.
- If we have more frames than what we have internally, the new frames will be automatically created.
sourcepub fn draw_frames_fit(
self,
frames: &[Pixmap],
start_frame_index: usize,
fit: DivoomDrawFitMode,
rotation: f32,
opacity: f32,
blend: BlendMode
) -> Self
pub fn draw_frames_fit(
self,
frames: &[Pixmap],
start_frame_index: usize,
fit: DivoomDrawFitMode,
rotation: f32,
opacity: f32,
blend: BlendMode
) -> Self
Draw a series of frames to the canvas with DivoomDrawFitMode
option and other options.
With DivoomDrawFitMode
option, we provided a few ways to calculate the position and size of each frame to simplify the usage.
sourceimpl DivoomAnimationBuilder
impl DivoomAnimationBuilder
sourcepub fn build(&self) -> DivoomImageAnimation
pub fn build(&self) -> DivoomImageAnimation
Create the final animation that is used for being sent to the device, and one animation builder can be reused to create multiple animations.
Auto Trait Implementations
impl RefUnwindSafe for DivoomAnimationBuilder
impl Send for DivoomAnimationBuilder
impl Sync for DivoomAnimationBuilder
impl Unpin for DivoomAnimationBuilder
impl UnwindSafe for DivoomAnimationBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more