Struct kas_resvg::Canvas [−][src]
pub struct Canvas<P: CanvasDrawable> {
pub program: P,
// some fields omitted
}
canvas
only.Expand description
A canvas widget over the tiny-skia
library
Note that the tiny-skia
API is re-exported as crate::tiny_skia
.
Canvas size is controlled by the sizing arguments passed to the constructor,
as well as the stretch
factor and the display’s scale factor sf
.
Minimum size is min_size * sf
. Ideal size is ideal_size * sf
except that
if fix_aspect
is true, then the ideal height is the one that preserves
aspect ratio for the given width. The canvas may also exceed the ideal size
if a Stretch
factor greater than None
is used.
The canvas (re)creates the backing pixmap when the size is set and draws
to the new pixmap immediately. If the canvas program is modified then
Canvas::redraw
must be called to update the pixmap.
Fields
program: P
The program drawing to the canvas
Implementations
Construct with given size
Creates a new canvas with a given size. The size is adjusted according to the display’s scale factor.
Adjust scaling
Adjust scaling
Trait Implementations
Get the number of child widgets
Get a reference to a child widget by index, or None
if the index is
out of bounds. Read more
Mutable variant of get Read more
Record first identifier Read more
Check whether id
is a descendant Read more
Find the child which is an ancestor of this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Walk through all widgets, calling f
once on each. Read more
Walk through all widgets, calling f
once on each. Read more
Get self as type Any
(mutable)
Get the name of the widget struct
Erase type
Erase type
Get whether the widget is disabled
Set the disabled state of a widget Read more
Set disabled state (chaining) Read more
Construct InputState
Read more
Auto Trait Implementations
impl<P> RefUnwindSafe for Canvas<P> where
P: RefUnwindSafe,
impl<P> UnwindSafe for Canvas<P> where
P: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more