pub struct VersionedImage { /* private fields */ }
Expand description
Image
with a log of applied ImageCommand
s.
Implementations§
Source§impl VersionedImage
impl VersionedImage
Sourcepub fn new() -> Self
pub fn new() -> Self
Makes a new VersionedImage
instance.
Sourcepub fn get_pixel(&self, point: Point) -> Option<Color>
pub fn get_pixel(&self, point: Point) -> Option<Color>
Gets the color of the pixel at the given point.
Sourcepub fn range_pixels<R>(
&self,
range: R,
) -> impl '_ + Iterator<Item = (Point, Color)>where
R: RangeBounds<Point>,
pub fn range_pixels<R>(
&self,
range: R,
) -> impl '_ + Iterator<Item = (Point, Color)>where
R: RangeBounds<Point>,
Gets an iterator over the pixels in the given range.
Sourcepub fn apply(&mut self, command: &ImageCommand) -> bool
pub fn apply(&mut self, command: &ImageCommand) -> bool
Applies the given command to this image.
Returns true
if the image is changed, otherwise false
.
If the command is applied, it is appended to the log.
Sourcepub fn applied_commands(&self, since: Version) -> &[ImageCommand]
pub fn applied_commands(&self, since: Version) -> &[ImageCommand]
Gets the applied commands since the given version.
Sourcepub fn diff(&self, version: Version) -> Option<PatchImageCommand>
pub fn diff(&self, version: Version) -> Option<PatchImageCommand>
Calculates the diff between the current image and the image at the given version.
Trait Implementations§
Source§impl Clone for VersionedImage
impl Clone for VersionedImage
Source§fn clone(&self) -> VersionedImage
fn clone(&self) -> VersionedImage
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 VersionedImage
impl Debug for VersionedImage
Source§impl Default for VersionedImage
impl Default for VersionedImage
Source§fn default() -> VersionedImage
fn default() -> VersionedImage
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for VersionedImage
impl RefUnwindSafe for VersionedImage
impl Send for VersionedImage
impl Sync for VersionedImage
impl Unpin for VersionedImage
impl UnwindSafe for VersionedImage
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