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 dimensions of the screen
pub fn draw_commands_for_screen(&self) -> Vec<DrawCommand>ⓘ
pub fn draw_commands_for_screen(&self) -> Vec<DrawCommand>ⓘ
Returns an iterator over the draw commands required to render the visible portion of the drawing
pub fn draw_commands_for_drawing(&self) -> Vec<DrawCommand>ⓘ
pub fn draw_commands_for_drawing(&self) -> Vec<DrawCommand>ⓘ
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
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.