pub struct Ditherer<T: ImageContainer + 'static> {
pub inner: T,
pub dither: Option<Vec<Vec<u64>>>,
pub dither_in_time: f64,
pub dither_out_time: f64,
pub dither_fn: Box<dyn Fn(&T, (usize, usize)) -> u64>,
pub direction: DitherDirection,
/* private fields */
}
Expand description
The ditherer itself. The inner type T
is the thing to be dithered
Fields
inner: T
The inner object to be dithered
dither: Option<Vec<Vec<u64>>>
The time each pixel will be dithered in
dither_in_time: f64
How long the ditherer has been dithering in for
dither_out_time: f64
How long the ditherer has been dithering out for
dither_fn: Box<dyn Fn(&T, (usize, usize)) -> u64>
The function to determine what regionso to dither first
direction: DitherDirection
The direction to dither in
Implementations
sourceimpl<T: ImageContainer> Ditherer<T>
impl<T: ImageContainer> Ditherer<T>
sourcepub fn new(inner: T) -> Ditherer<T>
pub fn new(inner: T) -> Ditherer<T>
Create a new ditherer instance, dithering using alpha_dither_fn
.
sourcepub fn dithered_in(inner: T) -> Ditherer<T>
pub fn dithered_in(inner: T) -> Ditherer<T>
Create a new ditherer that is already dithered in
sourcepub fn with_dither_fn<F: Fn(&T, (usize, usize)) -> u64>(
self,
f: F
) -> Ditherer<T>where
F: 'static,
pub fn with_dither_fn<F: Fn(&T, (usize, usize)) -> u64>(
self,
f: F
) -> Ditherer<T>where
F: 'static,
Convert a ditherer to use a specific dither function
sourcepub fn with_direction(self, dir: DitherDirection) -> Ditherer<T>
pub fn with_direction(self, dir: DitherDirection) -> Ditherer<T>
Convert a ditherer to use a specific direction function
sourcepub fn dither_out(&mut self)
pub fn dither_out(&mut self)
Start dither out this object
Trait Implementations
sourceimpl<T: ImageContainer> Drawable for Ditherer<T>
impl<T: ImageContainer> Drawable for Ditherer<T>
sourcefn content_mut(&mut self) -> Vec<&mut dyn Drawable>
fn content_mut(&mut self) -> Vec<&mut dyn Drawable>
What this object contains, mutably
sourcefn step(&mut self)
fn step(&mut self)
When the user presses space, the state of the presentation is advanced. This
method is what is called. Read more
sourcefn draw(&self, canvas: &mut Canvas<Window>, pos: &Position, settings: DrawSettings)
fn draw(&self, canvas: &mut Canvas<Window>, pos: &Position, settings: DrawSettings)
Draw everything
sourceimpl<T: ImageContainer + KnownSize> ImageContainer for Ditherer<T>
impl<T: ImageContainer + KnownSize> ImageContainer for Ditherer<T>
sourcefn get_data_mut(&mut self) -> &mut Vec<u8>
fn get_data_mut(&mut self) -> &mut Vec<u8>
Retrieve the data in the image, mutably
sourcefn as_knownsize(&self) -> &dyn KnownSize
fn as_knownsize(&self) -> &dyn KnownSize
Convert the object to a dynamic KnownSize object, as rust doesn’t support calling KnownSize
-methods directly on this object Read more
sourceimpl<T: ImageContainer + KnownSize> KnownSize for Ditherer<T>
impl<T: ImageContainer + KnownSize> KnownSize for Ditherer<T>
impl<T: ImageContainer> Send for Ditherer<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for Ditherer<T>
impl<T> !Sync for Ditherer<T>
impl<T> Unpin for Ditherer<T>where
T: Unpin,
impl<T> !UnwindSafe for Ditherer<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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