pub struct Canvas<'a> {
pub document: &'a Document,
pub pictures: &'a mut Pictures,
pub page: Rect,
pub scale: f32,
pub palette: Palette,
pub edit_mode: bool,
pub editor: Option<&'a mut Editor>,
pub clicked: Option<Vec<usize>>,
pub outcome: Option<Outcome>,
/* private fields */
}Expand description
A page, and where on screen it is being drawn.
Fields§
§document: &'a DocumentThe document, for its styles and its pictures.
pictures: &'a mut PicturesPictures decoded so far.
page: RectThe rectangle the page occupies on screen.
scale: f32Screen points per ODF point.
palette: PaletteThe colours to draw in where the document names none.
edit_mode: boolWhether a click on a label’s paragraph opens it for editing.
editor: Option<&'a mut Editor>The paragraph being edited, as a path from the page: the shape’s index among the page’s children, then the way down to the paragraph.
clicked: Option<Vec<usize>>The paragraph a person clicked this frame in edit mode, as a path from the page.
outcome: Option<Outcome>What the editor asked for this frame, if it closed.
Implementations§
Source§impl<'a> Canvas<'a>
impl<'a> Canvas<'a>
Sourcepub fn new(
document: &'a Document,
pictures: &'a mut Pictures,
page: Rect,
scale: f32,
palette: Palette,
) -> Self
pub fn new( document: &'a Document, pictures: &'a mut Pictures, page: Rect, scale: f32, palette: Palette, ) -> Self
A canvas over a page, drawing nothing editable until told otherwise.
Sourcepub fn slide_shape(&mut self, ui: &mut Ui, index: usize, shape: &Element)
pub fn slide_shape(&mut self, ui: &mut Ui, index: usize, shape: &Element)
One of the slide’s own shapes, by its index among the page’s children, which is what a label inside it is edited under.
Source§impl Canvas<'_>
impl Canvas<'_>
Sourcepub fn background(&mut self, ui: &Ui, fill: &Fill)
pub fn background(&mut self, ui: &Ui, fill: &Fill)
Fill the page.
Sourcepub fn shape(&mut self, ui: &mut Ui, shape: &Element)
pub fn shape(&mut self, ui: &mut Ui, shape: &Element)
One shape, at the place on the page the document puts it.
Drawn: draw:rect, draw:ellipse, draw:circle, draw:polygon,
draw:polyline, draw:line, draw:custom-shape and draw:path — the
last two have their outlines worked out by Geometry, from ODF’s own
command language and from SVG’s respectively — a draw:frame holding a
picture or a text box, draw:connector, whose route between the two
shapes it joins the producer has already worked out, and draw:g, which
is a group and is descended into. Left undrawn: draw:measure.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Canvas<'a>
impl<'a> !Send for Canvas<'a>
impl<'a> !Sync for Canvas<'a>
impl<'a> !UnwindSafe for Canvas<'a>
impl<'a> Freeze for Canvas<'a>
impl<'a> Unpin for Canvas<'a>
impl<'a> UnsafeUnpin for Canvas<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more