[−][src]Struct pizarra::app::App
Implementations
impl App
[src]
pub fn new(dimensions: Point) -> App
[src]
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.
pub fn get_transform(&self) -> Transform
[src]
Returns a transform object needed for proper rendering. This object can translate a point from storage coordinates to screen coordinates.
pub fn visible_extent(&self) -> [Point; 2]
[src]
Compute the bounds of what is visible in the board according to current offset and zoom level
pub fn get_dimensions(&self) -> Point
[src]
Returns the dimensions of the screen
pub fn bgcolor(&self) -> Color
[src]
Returns current background color
pub fn draw_commands_for_screen(&self) -> Vec<DrawCommand>
[src]
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>
[src]
Returns an interator over the draw commands required to render the wole drawing
pub fn draw_commands_for_current_shape(&self) -> Option<DrawCommand>
[src]
pub fn to_screen_coordinates(&self, p: Point) -> Point
[src]
p is a point in the coordinate space of the shape storage, and this function translates it to drawing area's coordinate system.
pub fn handle_offset(&mut self, delta: Point)
[src]
Move the canvas by this offset
pub fn resize(&mut self, new_size: Point)
[src]
Notify the application that the screen size has changed
pub fn set_tool(&mut self, selected_tool: SelectedTool)
[src]
Set a new tool used to handle user input
pub fn set_stroke(&mut self, stroke: f64)
[src]
Set a new stroke that will be used in next shapes
pub fn set_bgcolor(&mut self, bgcolor: Color)
[src]
Set the background color of the drawing
pub fn set_erase_radius(&mut self, erase_radius: f64)
[src]
Set the radius of action for the eraser tool
pub fn handle_mouse_button_pressed(
&mut self,
button: MouseButton,
point: Point
) -> ShouldRedraw
[src]
&mut self,
button: MouseButton,
point: Point
) -> ShouldRedraw
Public method that the UI must call whenever a button of the mouse or pen is pressed.
pub fn handle_mouse_button_released(
&mut self,
button: MouseButton,
point: Point
) -> ShouldRedraw
[src]
&mut self,
button: MouseButton,
point: Point
) -> ShouldRedraw
Public method that the UI must call whenever a button of the mouse or pen is released.
pub fn handle_mouse_move(&mut self, pos: Point) -> ShouldRedraw
[src]
Public methid that the UI must call with updates on the cursor position
pub fn zoom_in(&mut self)
[src]
Zooms in the current view, so objects are bigger and the visible portion of the drawing gets reduced
pub fn zoom_out(&mut self)
[src]
Zooms out the current view, so objects are smaller and the visible portion of the drawing increases
pub fn go_home(&mut self)
[src]
Resets the center and zoom level of the view to its original place
pub fn set_color(&mut self, color: Color)
[src]
Sets the color for the new shapes
pub fn undo(&mut self)
[src]
Undoes the last action if any
pub fn redo(&mut self)
[src]
Redoes the last undone action, if any
pub fn shape_count(&self) -> usize
[src]
Return the drawing's total number of shapes
pub fn get_bounds(&self) -> Option<[Point; 2]>
[src]
Returns the bounding box that contains all the shapes in the drawing
pub fn get_save_status(&self) -> &SaveStatus
[src]
Returns a reference to this drawing's save status
pub fn set_saved(&mut self, path: PathBuf)
[src]
Notify the application that the drawing has been saved at path
pub fn reset(&mut self)
[src]
Resets the state of the drawing, undo, shapes etc so you can start drawing again.
pub fn open(&mut self, svg: &str) -> Result<(), Error>
[src]
impl App
[src]
Auto Trait Implementations
impl !RefUnwindSafe for App
[src]
impl !Send for App
[src]
impl !Sync for App
[src]
impl Unpin for App
[src]
impl !UnwindSafe for App
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,