Struct pizarra::app::Pizarra[][src]

pub struct Pizarra { /* fields omitted */ }
Expand description

Main controller of the pizarra application.

This struct keeps the state of a drawing and exposes the methods necessary to mutate it according to events in the interface.

Implementations

Create a new instance of Pizarra’s controller. Only one is needed and it can be put inside an Rc<RefCell<_>> to use it inside event callbacks in UI implementations.

Returns a transform object needed for proper rendering. This object can translate a point from storage coordinates to screen coordinates.

Returns the current config

Returns the dimensions of the screen

Returns current background color

Returns an iterator over the draw commands required to render the visible portion of the drawing

Returns an interator over the draw commands required to render the wole drawing. Used for exporting to png

returns only the draw commands needed to paint the current shape on the screen.

Notify the application that the screen size has changed

Set a new tool used to handle user input

Set a new stroke that will be used in next shapes

Set the background color of the drawing

Set the radius of action for the eraser tool

Public method that the UI must call whenever a button of the mouse or pen is pressed.

Public method that the UI must call whenever a button of the mouse or pen is released.

Public methid that the UI must call with updates on the cursor position

Zooms in the current view, so objects are bigger and the visible portion of the drawing gets reduced

Zooms out the current view, so objects are smaller and the visible portion of the drawing increases

Resets the center and zoom level of the view to its original place

Sets the color for the new shapes

Undoes the last action if any

Redoes the last undone action, if any

Returns the bounding box that contains all the shapes in the drawing

Returns a reference to this drawing’s save status

Notify the application that the drawing has been saved at path

Resets the state of the drawing, undo, shapes etc so you can start drawing again.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.