Struct freya_engine::prelude::svg::Canvas

pub struct Canvas { /* private fields */ }

Implementations§

§

impl Canvas

pub fn new(bounds: impl AsRef<Rect>, flags: impl Into<Option<Flags>>) -> Canvas

Creates a new SVG canvas.

pub fn end(self) -> RCHandle<SkData>

Ends the Canvas drawing and returns the resulting SVG. TODO: rename to into_svg() or into_svg_data()?

Methods from Deref<Target = Canvas>§

pub fn annotate_rect_with_url( &self, rect: impl AsRef<Rect>, data: &RCHandle<SkData>, ) -> &Canvas

pub fn annotate_named_destination( &self, point: impl Into<Point>, data: &RCHandle<SkData>, ) -> &Canvas

pub fn image_info(&self) -> Handle<SkImageInfo>

Returns ImageInfo for Canvas. If Canvas is not associated with raster surface or GPU surface, returned crate::ColorType is set to crate::ColorType::Unknown

Returns dimensions and crate::ColorType of Canvas

example: https://fiddle.skia.org/c/@Canvas_imageInfo

pub fn props(&self) -> Option<SurfaceProps>

Copies [SurfaceProps], if Canvas is associated with raster surface or GPU surface, and returns true. Otherwise, returns false and leave props unchanged.

  • props storage for writable [SurfaceProps]

Returns true if [SurfaceProps] was copied

example: https://fiddle.skia.org/c/@Canvas_getProps

pub fn base_props(&self) -> SurfaceProps

Returns the [SurfaceProps] associated with the canvas (i.e., at the base of the layer stack).

pub fn top_props(&self) -> SurfaceProps

Returns the [SurfaceProps] associated with the canvas that are currently active (i.e., at the top of the layer stack). This can differ from Self::base_props depending on the flags passed to saveLayer (see [SaveLayerFlags]).

pub fn base_layer_size(&self) -> ISize

Gets the size of the base or root layer in global canvas coordinates. The origin of the base layer is always (0,0). The area available for drawing may be smaller (due to clipping or saveLayer).

Returns integral size of base layer

example: https://fiddle.skia.org/c/@Canvas_getBaseLayerSize

pub fn new_surface( &self, info: &Handle<SkImageInfo>, props: Option<&SurfaceProps>, ) -> Option<RCHandle<SkSurface>>

Creates Surface matching info and props, and associates it with Canvas. Returns None if no match found.

If props is None, matches [SurfaceProps] in Canvas. If props is None and Canvas does not have [SurfaceProps], creates Surface with default [SurfaceProps].

Returns Surface matching info and props, or None if no match is available

example: https://fiddle.skia.org/c/@Canvas_makeSurface

pub fn recording_context(&self) -> Option<RCHandle<GrRecordingContext>>

Returns Ganesh context of the GPU surface associated with Canvas.

Returns GPU context, if available; None otherwise

example: https://fiddle.skia.org/c/@Canvas_recordingContext

pub fn direct_context(&self) -> Option<RCHandle<GrDirectContext>>

Returns the gpu::DirectContext. This is a rust-skia helper for that makes it simpler to call [Image::encode].

pub unsafe fn surface(&self) -> Option<RCHandle<SkSurface>>

Sometimes a canvas is owned by a surface. If it is, Self::surface() will return a bare pointer to that surface, else this will return None.

§Safety

This function is unsafe because it is not clear how exactly the lifetime of the canvas relates to surface returned. See also [OwnedCanvas], [RCHandle<SkSurface>::canvas()].

pub fn access_top_layer_pixels(&self) -> Option<TopLayerPixels<'_>>

Returns the pixel base address, ImageInfo, row_bytes, and origin if the pixels can be read directly.

  • info storage for writable pixels’ ImageInfo
  • row_bytes storage for writable pixels’ row bytes
  • origin storage for Canvas top layer origin, its top-left corner

Returns address of pixels, or None if inaccessible

example: https://fiddle.skia.org/c/@Canvas_accessTopLayerPixels_a example: https://fiddle.skia.org/c/@Canvas_accessTopLayerPixels_b

pub fn peek_pixels(&self) -> Option<Pixmap<'_>>

Returns true if Canvas has direct access to its pixels.

Pixels are readable when Device is raster. Pixels are not readable when Canvas is returned from GPU surface, returned by [crate::Document::begin_page()], returned by [Handle<SkPictureRecorder>::begin_recording()], or Canvas is the base of a utility class like DebugCanvas.

pixmap is valid only while Canvas is in scope and unchanged. Any Canvas or Surface call may invalidate the pixmap values.

Returns [Pixmap] if Canvas has direct access to pixels

example: https://fiddle.skia.org/c/@Canvas_peekPixels

pub fn read_pixels( &self, dst_info: &Handle<SkImageInfo>, dst_pixels: &mut [u8], dst_row_bytes: usize, src_point: impl Into<IPoint>, ) -> bool

Copies Rect of pixels from Canvas into dst_pixels. Matrix and clip are ignored.

Source Rect corners are src_point and (image_info().width(), image_info().height()). Destination Rect corners are (0, 0) and (dst_Info.width(), dst_info.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to dst_info.color_type() and dst_info.alpha_type() if required.

Pixels are readable when Device is raster, or backed by a GPU. Pixels are not readable when Canvas is returned by [crate::Document::begin_page()], returned by [Handle<SkPictureRecorder>::begin_recording()], or Canvas is the base of a utility class like DebugCanvas.

The destination pixel storage must be allocated by the caller.

Pixel values are converted only if crate::ColorType and [crate::AlphaType] do not match. Only pixels within both source and destination rectangles are copied. dst_pixels contents outside Rect intersection are unchanged.

Pass negative values for src_point.x or src_point.y to offset pixels across or down destination.

Does not copy, and returns false if:

  • Source and destination rectangles do not intersect.

  • Canvas pixels could not be converted to dst_info.color_type() or dst_info.alpha_type().

  • Canvas pixels are not readable; for instance, Canvas is document-based.

  • dst_row_bytes is too small to contain one row of pixels.

  • dst_info width, height, crate::ColorType, and [crate::AlphaType] of dstPixels

  • dst_pixels storage for pixels; dst_info.height() times dst_row_bytes, or larger

  • dst_row_bytes size of one destination row; dst_info.width() times pixel size, or larger

  • src_point offset into readable pixels; may be negative

Returns true if pixels were copied

pub fn read_pixels_to_pixmap( &self, pixmap: &mut Pixmap<'_>, src: impl Into<IPoint>, ) -> bool

Copies Rect of pixels from Canvas into pixmap. Matrix and clip are ignored.

Source Rect corners are (src.x, src.y) and (image_info().width(), image_info().height()). Destination Rect corners are (0, 0) and (pixmap.width(), pixmap.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to pixmap.color_type() and pixmap.alpha_type() if required.

Pixels are readable when Device is raster, or backed by a GPU. Pixels are not readable when Canvas is returned by [crate::Document::begin_page()], returned by [Handle<SkPictureRecorder>::begin_recording()], or Canvas is the base of a utility class like DebugCanvas.

Caller must allocate pixel storage in pixmap if needed.

Pixel values are converted only if crate::ColorType and [crate::AlphaType] do not match. Only pixels within both source and destination Rect are copied. pixmap pixels contents outside Rect intersection are unchanged.

Pass negative values for src.x or src.y to offset pixels across or down pixmap.

Does not copy, and returns false if:

  • Source and destination rectangles do not intersect.

  • Canvas pixels could not be converted to pixmap.color_type() or pixmap.alpha_type().

  • Canvas pixels are not readable; for instance, Canvas is document-based.

  • [Pixmap] pixels could not be allocated.

  • pixmap.row_bytes() is too small to contain one row of pixels.

  • pixmap storage for pixels copied from Canvas

  • src offset into readable pixels ; may be negative

Returns true if pixels were copied

example: https://fiddle.skia.org/c/@Canvas_readPixels_2

pub fn read_pixels_to_bitmap( &self, bitmap: &mut Handle<SkBitmap>, src: impl Into<IPoint>, ) -> bool

Copies Rect of pixels from Canvas into bitmap. Matrix and clip are ignored.

Source Rect corners are (src.x, src.y) and (image_info().width(), image_info().height()). Destination Rect corners are (0, 0) and (bitmap.width(), bitmap.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to bitmap.color_type() and bitmap.alpha_type() if required.

Pixels are readable when Device is raster, or backed by a GPU. Pixels are not readable when Canvas is returned by [crate::Document::begin_page()], returned by [Handle<SkPictureRecorder>::begin_recording()], or Canvas is the base of a utility class like DebugCanvas.

Caller must allocate pixel storage in bitmap if needed.

Bitmap values are converted only if crate::ColorType and [crate::AlphaType] do not match. Only pixels within both source and destination rectangles are copied. Bitmap pixels outside Rect intersection are unchanged.

Pass negative values for srcX or srcY to offset pixels across or down bitmap.

Does not copy, and returns false if:

  • Source and destination rectangles do not intersect.

  • Canvas pixels could not be converted to bitmap.color_type() or bitmap.alpha_type().

  • Canvas pixels are not readable; for instance, Canvas is document-based.

  • bitmap pixels could not be allocated.

  • bitmap.row_bytes() is too small to contain one row of pixels.

  • bitmap storage for pixels copied from Canvas

  • src offset into readable pixels; may be negative

Returns true if pixels were copied

example: https://fiddle.skia.org/c/@Canvas_readPixels_3

pub fn write_pixels( &self, info: &Handle<SkImageInfo>, pixels: &[u8], row_bytes: usize, offset: impl Into<IPoint>, ) -> bool

Copies Rect from pixels to Canvas. Matrix and clip are ignored. Source Rect corners are (0, 0) and (info.width(), info.height()). Destination Rect corners are (offset.x, offset.y) and (image_info().width(), image_info().height()).

Copies each readable pixel intersecting both rectangles, without scaling, converting to image_info().color_type() and image_info().alpha_type() if required.

Pixels are writable when Device is raster, or backed by a GPU. Pixels are not writable when Canvas is returned by [crate::Document::begin_page()], returned by [Handle<SkPictureRecorder>::begin_recording()], or Canvas is the base of a utility class like DebugCanvas.

Pixel values are converted only if crate::ColorType and [crate::AlphaType] do not match. Only pixels within both source and destination rectangles are copied. Canvas pixels outside Rect intersection are unchanged.

Pass negative values for offset.x or offset.y to offset pixels to the left or above Canvas pixels.

Does not copy, and returns false if:

  • Source and destination rectangles do not intersect.

  • pixels could not be converted to Canvas image_info().color_type() or image_info().alpha_type().

  • Canvas pixels are not writable; for instance, Canvas is document-based.

  • row_bytes is too small to contain one row of pixels.

  • info width, height, crate::ColorType, and [crate::AlphaType] of pixels

  • pixels pixels to copy, of size info.height() times row_bytes, or larger

  • row_bytes size of one row of pixels; info.width() times pixel size, or larger

  • offset offset into Canvas writable pixels; may be negative

Returns true if pixels were written to Canvas

example: https://fiddle.skia.org/c/@Canvas_writePixels

pub fn write_pixels_from_bitmap( &self, bitmap: &Handle<SkBitmap>, offset: impl Into<IPoint>, ) -> bool

Copies Rect from pixels to Canvas. Matrix and clip are ignored. Source Rect corners are (0, 0) and (bitmap.width(), bitmap.height()).

Destination Rect corners are (offset.x, offset.y) and (image_info().width(), image_info().height()).

Copies each readable pixel intersecting both rectangles, without scaling, converting to image_info().color_type() and image_info().alpha_type() if required.

Pixels are writable when Device is raster, or backed by a GPU. Pixels are not writable when Canvas is returned by [crate::Document::begin_page()], returned by [Handle<SkPictureRecorder>::begin_recording()], or Canvas is the base of a utility class like DebugCanvas.

Pixel values are converted only if crate::ColorType and [crate::AlphaType] do not match. Only pixels within both source and destination rectangles are copied. Canvas pixels outside Rect intersection are unchanged.

Pass negative values for offset to offset pixels to the left or above Canvas pixels.

Does not copy, and returns false if:

  • Source and destination rectangles do not intersect.

  • bitmap does not have allocated pixels.

  • bitmap pixels could not be converted to Canvas image_info().color_type() or image_info().alpha_type().

  • Canvas pixels are not writable; for instance, Canvas is document based.

  • bitmap pixels are inaccessible; for instance, bitmap wraps a texture.

  • bitmap contains pixels copied to Canvas

  • offset offset into Canvas writable pixels; may be negative

Returns true if pixels were written to Canvas

example: https://fiddle.skia.org/c/@Canvas_writePixels_2 example: https://fiddle.skia.org/c/@State_Stack_a example: https://fiddle.skia.org/c/@State_Stack_b

pub fn save(&self) -> usize

Saves Matrix and clip. Calling Self::restore() discards changes to Matrix and clip, restoring the Matrix and clip to their state when Self::save() was called.

Matrix may be changed by Self::translate(), Self::scale(), Self::rotate(), Self::skew(), Self::concat(), Self::set_matrix(), and Self::reset_matrix(). Clip may be changed by Self::clip_rect(), Self::clip_rrect(), Self::clip_path(), Self::clip_region().

Saved Canvas state is put on a stack; multiple calls to Self::save() should be balance by an equal number of calls to Self::restore().

Call Self::restore_to_count() with result to restore this and subsequent saves.

Returns depth of saved stack

example: https://fiddle.skia.org/c/@Canvas_save

pub fn save_layer_alpha_f( &self, bounds: impl Into<Option<Rect>>, alpha: f32, ) -> usize

Saves Matrix and clip, and allocates Surface for subsequent drawing.

Calling Self::restore() discards changes to Matrix and clip, and blends layer with alpha opacity onto prior layer.

Matrix may be changed by Self::translate(), Self::scale(), Self::rotate(), Self::skew(), Self::concat(), Self::set_matrix(), and Self::reset_matrix(). Clip may be changed by Self::clip_rect(), Self::clip_rrect(), Self::clip_path(), Self::clip_region().

Rect bounds suggests but does not define layer size. To clip drawing to a specific rectangle, use Self::clip_rect().

alpha of zero is fully transparent, 1.0 is fully opaque.

Call Self::restore_to_count() with result to restore this and subsequent saves.

  • bounds hint to limit the size of layer; may be None
  • alpha opacity of layer

Returns depth of saved stack

example: https://fiddle.skia.org/c/@Canvas_saveLayerAlpha

pub fn save_layer_alpha( &self, bounds: impl Into<Option<Rect>>, alpha: u32, ) -> usize

Helper that accepts an int between 0 and 255, and divides it by 255.0

pub fn save_layer(&self, layer_rec: &SaveLayerRec<'_>) -> usize

Saves Matrix and clip, and allocates Surface for subsequent drawing.

Calling Self::restore() discards changes to Matrix and clip, and blends Surface with alpha opacity onto the prior layer.

Matrix may be changed by Self::translate(), Self::scale(), Self::rotate(), Self::skew(), Self::concat(), Self::set_matrix(), and Self::reset_matrix(). Clip may be changed by Self::clip_rect(), Self::clip_rrect(), Self::clip_path(), Self::clip_region().

[SaveLayerRec] contains the state used to create the layer.

Call Self::restore_to_count() with result to restore this and subsequent saves.

  • layer_rec layer state

Returns depth of save state stack before this call was made.

example: https://fiddle.skia.org/c/@Canvas_saveLayer_3

pub fn restore(&self) -> &Canvas

Removes changes to Matrix and clip since Canvas state was last saved. The state is removed from the stack.

Does nothing if the stack is empty.

example: https://fiddle.skia.org/c/@AutoCanvasRestore_restore

example: https://fiddle.skia.org/c/@Canvas_restore

pub fn save_count(&self) -> usize

Returns the number of saved states, each containing: Matrix and clip. Equals the number of Self::save() calls less the number of Self::restore() calls plus one. The save count of a new canvas is one.

Returns depth of save state stack

example: https://fiddle.skia.org/c/@Canvas_getSaveCount

pub fn restore_to_count(&self, save_count: usize) -> &Canvas

Restores state to Matrix and clip values when Self::save(), Self::save_layer(), or Self::save_layer_alpha() returned save_count.

Does nothing if save_count is greater than state stack count. Restores state to initial values if save_count is less than or equal to one.

  • saveCount depth of state stack to restore

example: https://fiddle.skia.org/c/@Canvas_restoreToCount

pub fn translate(&self, d: impl Into<Point>) -> &Canvas

Translates Matrix by d.

Mathematically, replaces Matrix with a translation matrix premultiplied with Matrix.

This has the effect of moving the drawing by (d.x, d.y) before transforming the result with Matrix.

  • d distance to translate

example: https://fiddle.skia.org/c/@Canvas_translate

pub fn scale(&self, _: (f32, f32)) -> &Canvas

Scales Matrix by sx on the x-axis and sy on the y-axis.

Mathematically, replaces Matrix with a scale matrix premultiplied with Matrix.

This has the effect of scaling the drawing by (sx, sy) before transforming the result with Matrix.

  • sx amount to scale on x-axis
  • sy amount to scale on y-axis

example: https://fiddle.skia.org/c/@Canvas_scale

pub fn rotate(&self, degrees: f32, p: Option<Point>) -> &Canvas

Rotates Matrix by degrees about a point at (p.x, p.y). Positive degrees rotates clockwise.

Mathematically, constructs a rotation matrix; premultiplies the rotation matrix by a translation matrix; then replaces Matrix with the resulting matrix premultiplied with Matrix.

This has the effect of rotating the drawing about a given point before transforming the result with Matrix.

  • degrees amount to rotate, in degrees
  • p the point to rotate about

example: https://fiddle.skia.org/c/@Canvas_rotate_2

pub fn skew(&self, _: (f32, f32)) -> &Canvas

Skews Matrix by sx on the x-axis and sy on the y-axis. A positive value of sx skews the drawing right as y-axis values increase; a positive value of sy skews the drawing down as x-axis values increase.

Mathematically, replaces Matrix with a skew matrix premultiplied with Matrix.

This has the effect of skewing the drawing by (sx, sy) before transforming the result with Matrix.

  • sx amount to skew on x-axis
  • sy amount to skew on y-axis

example: https://fiddle.skia.org/c/@Canvas_skew

pub fn concat(&self, matrix: &Matrix) -> &Canvas

Replaces Matrix with matrix premultiplied with existing Matrix.

This has the effect of transforming the drawn geometry by matrix, before transforming the result with existing Matrix.

  • matrix matrix to premultiply with existing Matrix

example: https://fiddle.skia.org/c/@Canvas_concat

pub fn concat_44(&self, m: &M44) -> &Canvas

pub fn set_matrix(&self, matrix: &M44) -> &Canvas

Replaces Matrix with matrix. Unlike Self::concat(), any prior matrix state is overwritten.

  • matrix matrix to copy, replacing existing Matrix

example: https://fiddle.skia.org/c/@Canvas_setMatrix

pub fn reset_matrix(&self) -> &Canvas

Sets Matrix to the identity matrix. Any prior matrix state is overwritten.

example: https://fiddle.skia.org/c/@Canvas_resetMatrix

pub fn clip_rect( &self, rect: impl AsRef<Rect>, op: impl Into<Option<SkClipOp>>, do_anti_alias: impl Into<Option<bool>>, ) -> &Canvas

Replaces clip with the intersection or difference of clip and rect, with an aliased or anti-aliased clip edge. rect is transformed by Matrix before it is combined with clip.

  • rect Rect to combine with clip
  • op ClipOp to apply to clip
  • do_anti_alias true if clip is to be anti-aliased

example: https://fiddle.skia.org/c/@Canvas_clipRect

pub fn clip_irect( &self, irect: impl AsRef<IRect>, op: impl Into<Option<SkClipOp>>, ) -> &Canvas

pub fn clip_rrect( &self, rrect: impl AsRef<RRect>, op: impl Into<Option<SkClipOp>>, do_anti_alias: impl Into<Option<bool>>, ) -> &Canvas

Replaces clip with the intersection or difference of clip and rrect, with an aliased or anti-aliased clip edge. rrect is transformed by Matrix before it is combined with clip.

  • rrect RRect to combine with clip
  • op ClipOp to apply to clip
  • do_anti_alias true if clip is to be anti-aliased

example: https://fiddle.skia.org/c/@Canvas_clipRRect

pub fn clip_path( &self, path: &Handle<SkPath>, op: impl Into<Option<SkClipOp>>, do_anti_alias: impl Into<Option<bool>>, ) -> &Canvas

Replaces clip with the intersection or difference of clip and path, with an aliased or anti-aliased clip edge. crate::path::FillType determines if path describes the area inside or outside its contours; and if path contour overlaps itself or another path contour, whether the overlaps form part of the area. path is transformed by Matrix before it is combined with clip.

  • path Path to combine with clip
  • op ClipOp to apply to clip
  • do_anti_alias true if clip is to be anti-aliased

example: https://fiddle.skia.org/c/@Canvas_clipPath

pub fn clip_shader( &self, shader: impl Into<RCHandle<SkShader>>, op: impl Into<Option<SkClipOp>>, ) -> &Canvas

pub fn clip_region( &self, device_rgn: &Handle<SkRegion>, op: impl Into<Option<SkClipOp>>, ) -> &Canvas

Replaces clip with the intersection or difference of clip and [Region] device_rgn. Resulting clip is aliased; pixels are fully contained by the clip. device_rgn is unaffected by Matrix.

  • device_rgn [Region] to combine with clip
  • op ClipOp to apply to clip

example: https://fiddle.skia.org/c/@Canvas_clipRegion

pub fn local_clip_bounds(&self) -> Option<Rect>

Returns bounds of clip, transformed by inverse of Matrix. If clip is empty, return Rect::new_empty(), where all Rect sides equal zero.

Rect returned is outset by one to account for partial pixel coverage if clip is anti-aliased.

Returns bounds of clip in local coordinates

example: https://fiddle.skia.org/c/@Canvas_getLocalClipBounds

pub fn device_clip_bounds(&self) -> Option<IRect>

Returns IRect bounds of clip, unaffected by Matrix. If clip is empty, return Rect::new_empty(), where all Rect sides equal zero.

Unlike Self::local_clip_bounds(), returned IRect is not outset.

Returns bounds of clip in Device coordinates

example: https://fiddle.skia.org/c/@Canvas_getDeviceClipBounds

pub fn draw_color( &self, color: impl Into<Color4f>, mode: impl Into<Option<SkBlendMode>>, ) -> &Canvas

Fills clip with color color. mode determines how ARGB is combined with destination.

  • color [Color4f] representing unpremultiplied color.
  • mode [BlendMode] used to combine source color and destination

pub fn clear(&self, color: impl Into<Color4f>) -> &Canvas

Fills clip with color color using [BlendMode::Src]. This has the effect of replacing all pixels contained by clip with color.

  • color [Color4f] representing unpremultiplied color.

pub fn discard(&self) -> &Canvas

Makes Canvas contents undefined. Subsequent calls that read Canvas pixels, such as drawing with [BlendMode], return undefined results. discard() does not change clip or Matrix.

discard() may do nothing, depending on the implementation of Surface or Device that created Canvas.

discard() allows optimized performance on subsequent draws by removing cached data associated with Surface or Device. It is not necessary to call discard() once done with Canvas; any cached data is deleted when owning Surface or Device is deleted.

pub fn draw_paint(&self, paint: &Handle<SkPaint>) -> &Canvas

Fills clip with Paint paint. Paint components, Shader, [crate::ColorFilter], [ImageFilter], and [BlendMode] affect drawing; crate::MaskFilter and [crate::PathEffect] in paint are ignored.

  • paint graphics state used to fill Canvas

example: https://fiddle.skia.org/c/@Canvas_drawPaint

pub fn draw_points( &self, mode: SkCanvas_PointMode, pts: &[Point], paint: &Handle<SkPaint>, ) -> &Canvas

Draws pts using clip, Matrix and Paint pain. if the number of points is less than one, has no effect. mode may be one of: [PointMode::Points], [PointMode::Lines], or [PointMode::Polygon]

If mode is [PointMode::Points], the shape of point drawn depends on paint [crate::paint::Cap]. If paint is set to [crate::paint::Cap::Round], each point draws a circle of diameter Paint stroke width. If paint is set to [crate::paint::Cap::Square] or [crate::paint::Cap::Butt], each point draws a square of width and height Paint stroke width.

If mode is [PointMode::Lines], each pair of points draws a line segment. One line is drawn for every two points; each point is used once. If count is odd, the final point is ignored.

If mode is [PointMode::Polygon], each adjacent pair of points draws a line segment. count minus one lines are drawn; the first and last point are used once.

Each line segment respects paint [crate::paint::Cap] and Paint stroke width. crate::paint::Style is ignored, as if were set to crate::paint::Style::Stroke.

Always draws each element one at a time; is not affected by [crate::paint::Join], and unlike Self::draw_path(), does not create a mask from all points and lines before drawing.

  • mode whether pts draws points or lines
  • pts array of points to draw
  • paint stroke, blend, color, and so on, used to draw

example: https://fiddle.skia.org/c/@Canvas_drawPoints

pub fn draw_point( &self, p: impl Into<Point>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws point p using clip, Matrix and Paint paint.

The shape of point drawn depends on paint [crate::paint::Cap]. If paint is set to [crate::paint::Cap::Round], draw a circle of diameter Paint stroke width. If paint is set to [crate::paint::Cap::Square] or [crate::paint::Cap::Butt], draw a square of width and height Paint stroke width. crate::paint::Style is ignored, as if were set to crate::paint::Style::Stroke.

  • p top-left edge of circle or square
  • paint stroke, blend, color, and so on, used to draw

pub fn draw_line( &self, p1: impl Into<Point>, p2: impl Into<Point>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws line segment from p1 to p2 using clip, Matrix, and Paint paint. In paint: Paint stroke width describes the line thickness; [crate::paint::Cap] draws the end rounded or square; crate::paint::Style is ignored, as if were set to crate::paint::Style::Stroke.

  • p1 start of line segment
  • p2 end of line segment
  • paint stroke, blend, color, and so on, used to draw

pub fn draw_rect( &self, rect: impl AsRef<Rect>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws Rect rect using clip, Matrix, and Paint paint. In paint: crate::paint::Style determines if rectangle is stroked or filled; if stroked, Paint stroke width describes the line thickness, and [crate::paint::Join] draws the corners rounded or square.

  • rect rectangle to draw
  • paint stroke or fill, blend, color, and so on, used to draw

example: https://fiddle.skia.org/c/@Canvas_drawRect

pub fn draw_irect( &self, rect: impl AsRef<IRect>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws IRect rect using clip, Matrix, and Paint paint. In paint: crate::paint::Style determines if rectangle is stroked or filled; if stroked, Paint stroke width describes the line thickness, and [crate::paint::Join] draws the corners rounded or square.

  • rect rectangle to draw
  • paint stroke or fill, blend, color, and so on, used to draw

pub fn draw_region( &self, region: &Handle<SkRegion>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws [Region] region using clip, Matrix, and Paint paint. In paint: crate::paint::Style determines if rectangle is stroked or filled; if stroked, Paint stroke width describes the line thickness, and [crate::paint::Join] draws the corners rounded or square.

  • region region to draw
  • paint Paint stroke or fill, blend, color, and so on, used to draw

example: https://fiddle.skia.org/c/@Canvas_drawRegion

pub fn draw_oval( &self, oval: impl AsRef<Rect>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws oval oval using clip, Matrix, and Paint. In paint: crate::paint::Style determines if oval is stroked or filled; if stroked, Paint stroke width describes the line thickness.

  • oval Rect bounds of oval
  • paint Paint stroke or fill, blend, color, and so on, used to draw

example: https://fiddle.skia.org/c/@Canvas_drawOval

pub fn draw_rrect( &self, rrect: impl AsRef<RRect>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws RRect rrect using clip, Matrix, and Paint paint. In paint: crate::paint::Style determines if rrect is stroked or filled; if stroked, Paint stroke width describes the line thickness.

rrect may represent a rectangle, circle, oval, uniformly rounded rectangle, or may have any combination of positive non-square radii for the four corners.

  • rrect RRect with up to eight corner radii to draw
  • paint Paint stroke or fill, blend, color, and so on, used to draw

example: https://fiddle.skia.org/c/@Canvas_drawRRect

pub fn draw_drrect( &self, outer: impl AsRef<RRect>, inner: impl AsRef<RRect>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws RRect outer and inner using clip, Matrix, and Paint paint. outer must contain inner or the drawing is undefined. In paint: crate::paint::Style determines if RRect is stroked or filled; if stroked, Paint stroke width describes the line thickness. If stroked and RRect corner has zero length radii, [crate::paint::Join] can draw corners rounded or square.

GPU-backed platforms optimize drawing when both outer and inner are concave and outer contains inner. These platforms may not be able to draw Path built with identical data as fast.

  • outer RRect outer bounds to draw
  • inner RRect inner bounds to draw
  • paint Paint stroke or fill, blend, color, and so on, used to draw

example: https://fiddle.skia.org/c/@Canvas_drawDRRect_a example: https://fiddle.skia.org/c/@Canvas_drawDRRect_b

pub fn draw_circle( &self, center: impl Into<Point>, radius: f32, paint: &Handle<SkPaint>, ) -> &Canvas

Draws circle at center with radius using clip, Matrix, and Paint paint. If radius is zero or less, nothing is drawn. In paint: crate::paint::Style determines if circle is stroked or filled; if stroked, Paint stroke width describes the line thickness.

  • center circle center
  • radius half the diameter of circle
  • paint Paint stroke or fill, blend, color, and so on, used to draw

pub fn draw_arc( &self, oval: impl AsRef<Rect>, start_angle: f32, sweep_angle: f32, use_center: bool, paint: &Handle<SkPaint>, ) -> &Canvas

Draws arc using clip, Matrix, and Paint paint.

Arc is part of oval bounded by oval, sweeping from start_angle to start_angle plus sweep_angle. start_angle and sweep_angle are in degrees.

start_angle of zero places start point at the right middle edge of oval. A positive sweep_angle places arc end point clockwise from start point; a negative sweep_angle places arc end point counterclockwise from start point. sweep_angle may exceed 360 degrees, a full circle. If use_center is true, draw a wedge that includes lines from oval center to arc end points. If use_center is false, draw arc between end points.

If Rect oval is empty or sweep_angle is zero, nothing is drawn.

  • oval Rect bounds of oval containing arc to draw
  • start_angle angle in degrees where arc begins
  • sweep_angle sweep angle in degrees; positive is clockwise
  • use_center if true, include the center of the oval
  • paint Paint stroke or fill, blend, color, and so on, used to draw

pub fn draw_arc_2(&self, arc: &Arc, paint: &Handle<SkPaint>) -> &Canvas

Draws arc using clip, Matrix, and Paint paint.

Arc is part of oval bounded by oval, sweeping from start_angle to start_angle plus sweep_angle. start_angle and sweep_angle are in degrees.

start_angle of zero places start point at the right middle edge of oval. A positive sweep_angle places arc end point clockwise from start point; a negative sweep_angle places arc end point counterclockwise from start point. sweep_angle may exceed 360 degrees, a full circle. If use_center is true, draw a wedge that includes lines from oval center to arc end points. If use_center is false, draw arc between end points.

If Rect oval is empty or sweep_angle is zero, nothing is drawn.

  • arc [Arc] SkArc specifying oval, startAngle, sweepAngle, and arc-vs-wedge
  • paint Paint stroke or fill, blend, color, and so on, used to draw

pub fn draw_round_rect( &self, rect: impl AsRef<Rect>, rx: f32, ry: f32, paint: &Handle<SkPaint>, ) -> &Canvas

Draws RRect bounded by Rect rect, with corner radii (rx, ry) using clip, Matrix, and Paint paint.

In paint: crate::paint::Style determines if RRect is stroked or filled; if stroked, Paint stroke width describes the line thickness. If rx or ry are less than zero, they are treated as if they are zero. If rx plus ry exceeds rect width or rect height, radii are scaled down to fit. If rx and ry are zero, RRect is drawn as Rect and if stroked is affected by [crate::paint::Join].

  • rect Rect bounds of RRect to draw
  • rx axis length on x-axis of oval describing rounded corners
  • ry axis length on y-axis of oval describing rounded corners
  • paint stroke, blend, color, and so on, used to draw

example: https://fiddle.skia.org/c/@Canvas_drawRoundRect

pub fn draw_path( &self, path: &Handle<SkPath>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws Path path using clip, Matrix, and Paint paint. Path contains an array of path contour, each of which may be open or closed.

In paint: crate::paint::Style determines if RRect is stroked or filled: if filled, crate::path::FillType determines whether path contour describes inside or outside of fill; if stroked, Paint stroke width describes the line thickness, [crate::paint::Cap] describes line ends, and [crate::paint::Join] describes how corners are drawn.

  • path Path to draw
  • paint stroke, blend, color, and so on, used to draw

example: https://fiddle.skia.org/c/@Canvas_drawPath

pub fn draw_image( &self, image: impl AsRef<RCHandle<SkImage>>, left_top: impl Into<Point>, paint: Option<&Handle<SkPaint>>, ) -> &Canvas

pub fn draw_image_rect( &self, image: impl AsRef<RCHandle<SkImage>>, src: Option<(&Rect, SkCanvas_SrcRectConstraint)>, dst: impl AsRef<Rect>, paint: &Handle<SkPaint>, ) -> &Canvas

pub fn draw_image_with_sampling_options( &self, image: impl AsRef<RCHandle<SkImage>>, left_top: impl Into<Point>, sampling: impl Into<SamplingOptions>, paint: Option<&Handle<SkPaint>>, ) -> &Canvas

pub fn draw_image_rect_with_sampling_options( &self, image: impl AsRef<RCHandle<SkImage>>, src: Option<(&Rect, SkCanvas_SrcRectConstraint)>, dst: impl AsRef<Rect>, sampling: impl Into<SamplingOptions>, paint: &Handle<SkPaint>, ) -> &Canvas

pub fn draw_image_nine( &self, image: impl AsRef<RCHandle<SkImage>>, center: impl AsRef<IRect>, dst: impl AsRef<Rect>, filter_mode: SkFilterMode, paint: Option<&Handle<SkPaint>>, ) -> &Canvas

Draws Image image stretched proportionally to fit into Rect dst. IRect center divides the image into nine sections: four sides, four corners, and the center. Corners are unmodified or scaled down proportionately if their sides are larger than dst; center and four sides are scaled to fit remaining space, if any.

Additionally transform draw using clip, Matrix, and optional Paint paint.

If Paint paint is supplied, apply [crate::ColorFilter], alpha, [ImageFilter], and [BlendMode]. If image is crate::ColorType::Alpha8, apply Shader. If paint contains crate::MaskFilter, generate mask from image bounds. Any crate::MaskFilter on paint is ignored as is paint anti-aliasing state.

If generated mask extends beyond image bounds, replicate image edge colors, just as Shader made from [RCHandle<Image>::to_shader()] with crate::TileMode::Clamp set replicates the image edge color when it samples outside of its bounds.

  • image Image containing pixels, dimensions, and format
  • center IRect edge of image corners and sides
  • dst destination Rect of image to draw to
  • filter what technique to use when sampling the image
  • paint Paint containing [BlendMode], [crate::ColorFilter], [ImageFilter], and so on; or None

pub fn draw_image_lattice( &self, image: impl AsRef<RCHandle<SkImage>>, lattice: &Lattice<'_>, dst: impl AsRef<Rect>, filter: SkFilterMode, paint: Option<&Handle<SkPaint>>, ) -> &Canvas

Draws Image image stretched proportionally to fit into Rect dst.

[lattice::Lattice] lattice divides image into a rectangular grid. Each intersection of an even-numbered row and column is fixed; fixed lattice elements never scale larger than their initial size and shrink proportionately when all fixed elements exceed the bitmap dimension. All other grid elements scale to fill the available space, if any.

Additionally transform draw using clip, Matrix, and optional Paint paint.

If Paint paint is supplied, apply [crate::ColorFilter], alpha, [ImageFilter], and [BlendMode]. If image is crate::ColorType::Alpha8, apply Shader. If paint contains crate::MaskFilter, generate mask from image bounds. Any crate::MaskFilter on paint is ignored as is paint anti-aliasing state.

If generated mask extends beyond bitmap bounds, replicate bitmap edge colors, just as Shader made from SkShader::MakeBitmapShader with crate::TileMode::Clamp set replicates the bitmap edge color when it samples outside of its bounds.

  • image Image containing pixels, dimensions, and format
  • lattice division of bitmap into fixed and variable rectangles
  • dst destination Rect of image to draw to
  • filter what technique to use when sampling the image
  • paint Paint containing [BlendMode], [crate::ColorFilter], [ImageFilter], and so on; or None

pub fn draw_str( &self, str: impl AsRef<str>, origin: impl Into<Point>, font: &Handle<SkFont>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws String, with origin at (origin.x, origin.y), using clip, Matrix, [Font] font, and Paint paint.

This function uses the default character-to-glyph mapping from the crate::Typeface in font. It does not perform typeface fallback for characters not found in the crate::Typeface. It does not perform kerning; glyphs are positioned based on their default advances.

Text size is affected by Matrix and [Font] text size. Default text size is 12 point.

All elements of paint: [crate::PathEffect], crate::MaskFilter, Shader, [crate::ColorFilter], and [ImageFilter]; apply to text. By default, draws filled black glyphs.

  • str character code points drawn, ending with a char value of zero
  • origin start of string on x,y-axis
  • font typeface, text size and so, used to describe the text
  • paint blend, color, and so on, used to draw

pub fn draw_glyphs_utf8( &self, glyphs: &[u16], positions: &[Point], clusters: &[u32], utf8_text: impl AsRef<str>, origin: impl Into<Point>, font: &Handle<SkFont>, paint: &Handle<SkPaint>, )

Draws glyphs at positions relative to origin styled with font and paint with supporting utf8 and cluster information.

This function draw glyphs at the given positions relative to the given origin. It does not perform typeface fallback for glyphs not found in the crate::Typeface in font.

The drawing obeys the current transform matrix and clipping.

All elements of paint: [crate::PathEffect], crate::MaskFilter, Shader, [crate::ColorFilter], and [ImageFilter]; apply to text. By default, draws filled black glyphs.

  • count number of glyphs to draw
  • glyphs the array of glyphIDs to draw
  • positions where to draw each glyph relative to origin
  • clusters array of size count of cluster information
  • utf8_text utf8text supporting information for the glyphs
  • origin the origin of all the positions
  • font typeface, text size and so, used to describe the text
  • paint blend, color, and so on, used to draw

pub fn draw_glyphs_at<'a>( &self, glyphs: &[u16], positions: impl Into<GlyphPositions<'a>>, origin: impl Into<Point>, font: &Handle<SkFont>, paint: &Handle<SkPaint>, )

Draws count glyphs, at positions relative to origin styled with font and paint.

This function draw glyphs at the given positions relative to the given origin. It does not perform typeface fallback for glyphs not found in the crate::Typeface] in font.

The drawing obeys the current transform matrix and clipping.

All elements of paint: [crate::PathEffect], crate::MaskFilter, Shader, [crate::ColorFilter], and [ImageFilter]; apply to text. By default, draws filled black glyphs.

  • count number of glyphs to draw
  • glyphs the array of glyphIDs to draw
  • positions where to draw each glyph relative to origin, either a &[Point] or &[RSXform] slice
  • origin the origin of all the positions
  • font typeface, text size and so, used to describe the text
  • paint blend, color, and so on, used to draw

pub fn draw_text_blob( &self, blob: impl AsRef<RCHandle<SkTextBlob>>, origin: impl Into<Point>, paint: &Handle<SkPaint>, ) -> &Canvas

Draws [TextBlob] blob at (origin.x, origin.y), using clip, Matrix, and Paint paint.

blob contains glyphs, their positions, and paint attributes specific to text: crate::Typeface, Paint text size, Paint text scale x, Paint text skew x, Paint align, Paint hinting, anti-alias, Paint fake bold, Paint font embedded bitmaps, Paint full hinting spacing, LCD text, Paint linear text, and Paint subpixel text.

[TextEncoding] must be set to [TextEncoding::GlyphId].

Elements of paint: [crate::PathEffect], crate::MaskFilter, Shader, [crate::ColorFilter], and [ImageFilter]; apply to blob.

  • blob glyphs, positions, and their paints’ text size, typeface, and so on
  • origin horizontal and vertical offset applied to blob
  • paint blend, color, stroking, and so on, used to draw

pub fn draw_picture( &self, picture: impl AsRef<RCHandle<SkPicture>>, matrix: Option<&Matrix>, paint: Option<&Handle<SkPaint>>, ) -> &Canvas

Draws [Picture] picture, using clip and Matrix; transforming picture with Matrix matrix, if provided; and use Paint paint alpha, [crate::ColorFilter], [ImageFilter], and [BlendMode], if provided.

If paint is not None, then the picture is always drawn into a temporary layer before actually landing on the canvas. Note that drawing into a layer can also change its appearance if there are any non-associative blend modes inside any of the pictures elements.

  • picture recorded drawing commands to play
  • matrix Matrix to rotate, scale, translate, and so on; may be None
  • paint Paint to apply transparency, filtering, and so on; may be None

pub fn draw_vertices( &self, vertices: &RCHandle<SkVertices>, mode: SkBlendMode, paint: &Handle<SkPaint>, ) -> &Canvas

Draws [Vertices] vertices, a triangle mesh, using clip and Matrix. If paint contains an Shader and vertices does not contain tex coords, the shader is mapped using the vertices’ positions.

[BlendMode] is ignored if [Vertices] does not have colors. Otherwise, it combines

as the src of the blend and the interpolated vertex colors as the dst.

crate::MaskFilter, [crate::PathEffect], and antialiasing on Paint are ignored.

  • vertices triangle mesh to draw
  • mode combines vertices’ colors with Shader if present or Paint opaque color if not. Ignored if the vertices do not contain color.
  • paint specifies the Shader, used as [Vertices] texture, and [crate::ColorFilter].

example: https://fiddle.skia.org/c/@Canvas_drawVertices example: https://fiddle.skia.org/c/@Canvas_drawVertices_2

pub fn draw_patch<'a>( &self, cubics: &[Point; 12], colors: impl Into<Option<&'a [Color; 4]>>, tex_coords: Option<&[Point; 4]>, mode: SkBlendMode, paint: &Handle<SkPaint>, ) -> &Canvas

Draws a Coons patch: the interpolation of four cubics with shared corners, associating a color, and optionally a texture Point, with each corner.

Point array cubics specifies four Path cubic starting at the top-left corner, in clockwise order, sharing every fourth point. The last Path cubic ends at the first point.

Color array color associates colors with corners in top-left, top-right, bottom-right, bottom-left order.

If paint contains Shader, Point array tex_coords maps Shader as texture to corners in top-left, top-right, bottom-right, bottom-left order. If tex_coords is None, Shader is mapped using positions (derived from cubics).

[BlendMode] is ignored if colors is None. Otherwise, it combines

as the src of the blend and the interpolated patch colors as the dst.

crate::MaskFilter, [crate::PathEffect], and antialiasing on Paint are ignored.

  • cubics Path cubic array, sharing common points
  • colors color array, one for each corner
  • tex_coords Point array of texture coordinates, mapping Shader to corners; may be None
  • mode combines patch’s colors with Shader if present or Paint opaque color if not. Ignored if colors is None.
  • paint Shader, [crate::ColorFilter], [BlendMode], used to draw

pub fn draw_atlas<'a>( &self, atlas: &RCHandle<SkImage>, xform: &[RSXform], tex: &[Rect], colors: impl Into<Option<&'a [Color]>>, mode: SkBlendMode, sampling: impl Into<SamplingOptions>, cull_rect: impl Into<Option<Rect>>, paint: impl Into<Option<&'a Handle<SkPaint>>>, )

Draws a set of sprites from atlas, using clip, Matrix, and optional Paint paint. paint uses anti-alias, alpha, [crate::ColorFilter], [ImageFilter], and [BlendMode] to draw, if present. For each entry in the array, Rect tex locates sprite in atlas, and [RSXform] xform transforms it into destination space.

crate::MaskFilter and [crate::PathEffect] on paint are ignored.

xform, tex, and colors if present, must contain the same number of entries. Optional colors are applied for each sprite using [BlendMode] mode, treating sprite as source and colors as destination. Optional cull_rect is a conservative bounds of all transformed sprites. If cull_rect is outside of clip, canvas can skip drawing.

  • atlas - Image containing sprites
  • xform - [RSXform] mappings for sprites in atlas
  • tex - Rect locations of sprites in atlas
  • colors - one per sprite, blended with sprite using [BlendMode]; may be None
  • count - number of sprites to draw
  • mode - [BlendMode] combining colors and sprites
  • sampling - SamplingOptions used when sampling from the atlas image
  • cull_rect - bounds of transformed sprites for efficient clipping; may be None
  • paint - [crate::ColorFilter], [ImageFilter], [BlendMode], and so on; may be None

pub fn draw_drawable( &self, drawable: &mut RCHandle<SkDrawable>, matrix: Option<&Matrix>, )

Draws [Drawable] drawable using clip and Matrix, concatenated with optional matrix.

If Canvas has an asynchronous implementation, as is the case when it is recording into [Picture], then drawable will be referenced, so that [RCHandle<Drawable>::draw()] can be called when the operation is finalized. To force immediate drawing, call [RCHandle<Drawable>::draw()] instead.

  • drawable custom struct encapsulating drawing commands
  • matrix transformation applied to drawing; may be None

example: https://fiddle.skia.org/c/@Canvas_drawDrawable

pub fn draw_drawable_at( &self, drawable: &mut RCHandle<SkDrawable>, offset: impl Into<Point>, )

Draws [Drawable] drawable using clip and Matrix, offset by (offset.x, offset.y).

If Canvas has an asynchronous implementation, as is the case when it is recording into [Picture], then drawable will be referenced, so that [RCHandle<Drawable>::draw()] can be called when the operation is finalized. To force immediate drawing, call [RCHandle<Drawable>::draw()] instead.

  • drawable custom struct encapsulating drawing commands
  • offset offset into Canvas writable pixels on x,y-axis

example: https://fiddle.skia.org/c/@Canvas_drawDrawable_2

pub fn draw_annotation( &self, rect: impl AsRef<Rect>, key: &str, value: &RCHandle<SkData>, ) -> &Canvas

Associates Rect on Canvas when an annotation; a key-value pair, where the key is a UTF-8 string, and optional value is stored as Data.

Only some canvas implementations, such as recording to [Picture], or drawing to document PDF, use annotations.

  • rect Rect extent of canvas to annotate
  • key string used for lookup
  • value data holding value stored in annotation

pub fn is_clip_empty(&self) -> bool

Returns true if clip is empty; that is, nothing will draw.

May do work when called; it should not be called more often than needed. However, once called, subsequent calls perform no work until clip changes.

Returns true if clip is empty

example: https://fiddle.skia.org/c/@Canvas_isClipEmpty

pub fn is_clip_rect(&self) -> bool

Returns true if clip is Rect and not empty. Returns false if the clip is empty, or if it is not Rect.

Returns true if clip is Rect and not empty

example: https://fiddle.skia.org/c/@Canvas_isClipRect

pub fn local_to_device(&self) -> M44

Returns the current transform from local coordinates to the ‘device’, which for most purposes means pixels.

Returns transformation from local coordinates to device / pixels.

pub fn local_to_device_as_3x3(&self) -> Matrix

Throws away the 3rd row and column in the matrix, so be warned.

pub fn total_matrix(&self) -> Matrix

👎Deprecated since 0.38.0: use local_to_device() or local_to_device_as_3x3() instead

DEPRECATED Legacy version of Self::local_to_device(), which strips away any Z information, and just returns a 3x3 version.

Returns 3x3 version of Self::local_to_device()

example: https://fiddle.skia.org/c/@Canvas_getTotalMatrix example: https://fiddle.skia.org/c/@Clip

pub fn draw_shadow( &self, path: &Handle<SkPath>, z_plane_params: impl Into<Point3>, light_pos: impl Into<Point3>, light_radius: f32, ambient_color: impl Into<Color>, spot_color: impl Into<Color>, flags: impl Into<Option<ShadowFlags>>, ) -> &Canvas

pub fn draw_str_align( &self, text: impl AsRef<str>, p: impl Into<Point>, font: &Handle<SkFont>, paint: &Handle<SkPaint>, align: SkTextUtils_Align, ) -> &Canvas

pub fn draw_text_align( &self, text: impl EncodedText, p: impl Into<Point>, font: &Handle<SkFont>, paint: &Handle<SkPaint>, align: SkTextUtils_Align, ) -> &Canvas

Trait Implementations§

§

impl Debug for Canvas

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Deref for Canvas

§

type Target = Canvas

The resulting type after dereferencing.
§

fn deref(&self) -> &<Canvas as Deref>::Target

Dereferences the value.
§

impl Drop for Canvas

§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Canvas

§

impl !RefUnwindSafe for Canvas

§

impl !Send for Canvas

§

impl !Sync for Canvas

§

impl Unpin for Canvas

§

impl !UnwindSafe for Canvas

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.