PixelCanvasModel

Struct PixelCanvasModel 

Source
pub struct PixelCanvasModel { /* private fields */ }

Implementations§

Source§

impl PixelCanvasModel

Source

pub fn state_version(&self) -> i64

Source

pub fn draw_pixels( &mut self, config: &ConfigModel, pixels: impl Iterator<Item = Pixel>, ) -> Result<()>

Source

pub fn erase_pixels( &mut self, config: &ConfigModel, pixels: impl Iterator<Item = PixelPosition>, ) -> Result<()>

Source

pub fn erase_and_draw_pixels( &mut self, config: &ConfigModel, erase_pixels: impl Iterator<Item = PixelPosition>, draw_pixels: impl Iterator<Item = Pixel>, ) -> Result<()>

Source

pub fn replace_color( &mut self, config: &ConfigModel, old: Rgba, new: Rgba, ) -> Result<()>

Source

pub fn region(&self) -> PixelRegion

Source

pub fn get_layers(&self, config: &ConfigModel) -> u16

Source

pub fn get_frames(&self, config: &ConfigModel) -> u16

Source

pub fn get_pixels( &self, config: &ConfigModel, region: PixelRegion, ) -> impl '_ + Iterator<Item = Pixel>

Source

pub fn get_pixel( &self, config: &ConfigModel, position: PixelPosition, ) -> Option<Rgba>

Source

pub fn get_pixel_with_alpha( &self, config: &ConfigModel, position: PixelPosition, alpha: u8, ) -> Option<Rgba>

Source

pub fn get_direct_pixel(&self, position: PixelPosition) -> Option<Rgba>

Source

pub fn raw_pixels(&self) -> impl '_ + Iterator<Item = (PixelPosition, Rgba)>

Source

pub fn undo_command(&mut self, config: &ConfigModel) -> Result<()>

Source

pub fn redo_command(&mut self, config: &ConfigModel) -> Result<()>

Source

pub fn forget_oldest_command(&mut self)

Source

pub fn command_log_tail(&self) -> usize

Source

pub fn command_log(&self) -> &VecDeque<PixelCanvasCommand>

Source

pub fn take_dirty_positions(&mut self) -> BTreeSet<PixelPosition>

Source

pub fn dirty_positions(&self) -> &BTreeSet<PixelPosition>

Trait Implementations§

Source§

impl Debug for PixelCanvasModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PixelCanvasModel

Source§

fn default() -> PixelCanvasModel

Returns the “default value” for a type. Read more
Source§

impl Deserialize for PixelCanvasModel

Source§

fn deserialize<R: Read>(reader: &mut R) -> Result<Self>

Source§

fn deserialize_or_default<R: Read>(reader: &mut R) -> Result<Self>
where Self: Default,

Source§

impl Serialize for PixelCanvasModel

Source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>

Source§

fn serialized_size(&self) -> Result<usize>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V