skia_safe

Struct Handle

Source
pub struct Handle<N: NativeDrop>(/* private fields */);
Expand description

Wraps a native type that can be represented in Rust memory.

This type requires an implementation of the NativeDrop trait.

Implementations§

Source§

impl Handle<SkCodecs_Decoder>

Source

pub fn id(&self) -> &'static str

Source

pub fn is_format(&self, data: &[u8]) -> bool

Source

pub fn from_stream<'a>( &self, stream: &'a mut impl Read, ) -> Result<Codec<'a>, Result>

Source§

impl Handle<SkBitmap>

Source

pub fn new() -> Self

Creates an empty Bitmap without pixels, with ColorType::Unknown, AlphaType::Unknown, and with a width and height of zero. PixelRef origin is set to (0, 0).

Use Self::set_info() to associate ColorType, AlphaType, width, and height after Bitmap has been created.

Source

pub fn swap(&mut self, other: &mut Self)

Swaps the fields of the two bitmaps.

Source

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

Returns a constant reference to the Pixmap holding the Bitmap pixel address, row bytes, and ImageInfo.

Source

pub fn info(&self) -> &ImageInfo

Returns width, height, AlphaType, ColorType, and ColorSpace.

Source

pub fn width(&self) -> i32

Returns pixel count in each row. Should be equal or less than row_bytes() / info().bytes_per_pixel().

May be less than pixel_ref().width(). Will not exceed pixel_ref().width() less pixel_ref_origin().x.

Source

pub fn height(&self) -> i32

Returns pixel row count.

Maybe be less than pixel_ref().height(). Will not exceed pixel_ref().height() less pixel_ref_origin().y.

Source

pub fn color_type(&self) -> ColorType

Source

pub fn alpha_type(&self) -> AlphaType

Source

pub fn color_space(&self) -> Option<ColorSpace>

Returns ColorSpace, the range of colors, associated with ImageInfo. The returned ColorSpace is immutable.

Source

pub fn bytes_per_pixel(&self) -> usize

Returns number of bytes per pixel required by ColorType.

Returns zero if color_type() is ColorType::Unknown.

Source

pub fn row_bytes_as_pixels(&self) -> usize

Returns number of pixels that fit on row. Should be greater than or equal to width().

Source

pub fn shift_per_pixel(&self) -> usize

Returns bit shift converting row bytes to row pixels.

Returns zero for ColorType::Unknown.

Source

pub fn is_empty(&self) -> bool

Returns true if either width() or height() are zero.

Does not check if PixelRef is None; call draws_nothing() to check width(), height(), and PixelRef.

Source

pub fn is_null(&self) -> bool

Returns true if PixelRef is None.

Does not check if width() or height() are zero; call draws_nothing() to check width(), height(), and PixelRef.

Source

pub fn draws_nothing(&self) -> bool

Returns true if width() or height() are zero, or if PixelRef is None.

If true, Bitmap has no effect when drawn or drawn into.

Source

pub fn row_bytes(&self) -> usize

Returns row bytes, the interval from one pixel row to the next. Row bytes is at least as large as: width() * info().bytes_per_pixel().

Returns zero if color_type() is ColorType::Unknown, or if row bytes supplied to set_info() is not large enough to hold a row of pixels.

Source

pub fn set_alpha_type(&mut self, alpha_type: AlphaType) -> bool

Sets AlphaType, if alpha_type is compatible with ColorType. Returns true unless alpha_type is AlphaType::Unknown and current AlphaType is not AlphaType::Unknown.

Returns true if ColorType is ColorType::Unknown. alpha_type is ignored, and AlphaType remains AlphaType::Unknown.

Returns true if ColorType is ColorType::RGB565 or ColorType::Gray8. alpha_type is ignored, and AlphaType remains AlphaType::Opaque.

If ColorType is ColorType::ARGB4444, ColorType::RGBA8888, ColorType::BGRA8888, or ColorType::RGBAF16: returns true unless alpha_type is AlphaType::Unknown and AlphaType is not AlphaType::Unknown. If AlphaType is AlphaType::Unknown, alpha_type is ignored.

If ColorType is ColorType::Alpha8, returns true unless alpha_type is AlphaType::Unknown and AlphaType is not AlphaType::Unknown. If AlphaType is kUnknown_SkAlphaType, alpha_type is ignored. If alpha_type is AlphaType::Unpremul, it is treated as AlphaType::Premul.

This changes AlphaType in PixelRef; all bitmaps sharing PixelRef are affected.

Source

pub fn set_color_space(&mut self, color_space: impl Into<Option<ColorSpace>>)

Sets the ColorSpace associated with this Bitmap.

The raw pixel data is not altered by this call; no conversion is performed.

This changes ColorSpace in PixelRef; all bitmaps sharing PixelRef are affected.

Source

pub fn pixels(&mut self) -> *mut c_void

Returns pixel address, the base address corresponding to the pixel origin.

Source

pub fn compute_byte_size(&self) -> usize

Returns minimum memory required for pixel storage.
Does not include unused memory on last row when row_bytes_as_pixels() exceeds width().
Returns usize::MAX if result does not fit in usize.
Returns zero if height() or width() is 0.
Returns height() times row_bytes() if color_type() is ColorType::Unknown.

Source

pub fn is_immutable(&self) -> bool

Returns true if pixels can not change.

Most immutable Bitmap checks trigger an assert only on debug builds.

Source

pub fn set_immutable(&mut self)

Sets internal flag to mark Bitmap as immutable. Once set, pixels can not change. Any other bitmap sharing the same PixelRef are also marked as immutable.

Once PixelRef is marked immutable, the setting cannot be cleared.

Writing to immutable Bitmap pixels triggers an assert on debug builds.

Source

pub fn is_opaque(&self) -> bool

Returns true if AlphaType is set to hint that all pixels are opaque; their alpha value is implicitly or explicitly 1.0. If true, and all pixels are not opaque, Skia may draw incorrectly.

Does not check if ColorType allows alpha, or if any pixel value has transparency.

Source

pub fn reset(&mut self)

Resets to its initial state; all fields are set to zero, as if Bitmap had been initialized by Bitmap::new().

Sets width, height, row bytes to zero; pixel address to None; ColorType to ColorType::Unknown; and AlphaType to AlphaType::Unknown.

If PixelRef is allocated, its reference count is decreased by one, releasing its memory if Bitmap is the sole owner.

Source

pub fn compute_is_opaque(bm: &Self) -> bool

Returns true if all pixels are opaque. ColorType determines how pixels are encoded, and whether pixel describes alpha. Returns true for ColorType without alpha in each pixel; for other ColorType, returns true if all pixels have alpha values equivalent to 1.0 or greater.

Returns false for ColorType::Unknown.

Source

pub fn bounds(&self) -> IRect

Returns IRect { 0, 0, width(), height() }.

Source

pub fn dimensions(&self) -> ISize

Returns ISize { width(), height() }.

Source

pub fn get_subset(&self) -> IRect

Returns the bounds of this bitmap, offset by its PixelRef origin.

Source

pub fn set_info( &mut self, image_info: &ImageInfo, row_bytes: impl Into<Option<usize>>, ) -> bool

Sets width, height, AlphaType, ColorType, ColorSpace, and optional row_bytes. Frees pixels, and returns true if successful.

row_bytes must equal or exceed image_info.min_row_bytes(). If image_info.color_space() is ColorType::Unknown, row_bytes is ignored and treated as zero; for all other ColorSpace values, row_bytes of zero is treated as image_info.min_row_bytes().

Calls reset() and returns false if:

  • rowBytes exceeds 31 bits
  • image_info.width() is negative
  • image_info.height() is negative
  • row_bytes is positive and less than image_info.width() times image_info.bytes_per_pixel()
Source

pub fn try_alloc_pixels_flags(&mut self, image_info: &ImageInfo) -> bool

Sets ImageInfo to info following the rules in set_info() and allocates pixel memory. Memory is zeroed.

Returns false and calls reset() if ImageInfo could not be set, or memory could not be allocated, or memory could not optionally be zeroed.

On most platforms, allocating pixel memory may succeed even though there is not sufficient memory to hold pixels; allocation does not take place until the pixels are written to. The actual behavior depends on the platform implementation of calloc().

Source

pub fn alloc_pixels_flags(&mut self, image_info: &ImageInfo)

Sets ImageInfo to info following the rules in set_info() and allocates pixel memory. Memory is zeroed.

Returns false and calls reset() if ImageInfo could not be set, or memory could not be allocated, or memory could not optionally be zeroed.

On most platforms, allocating pixel memory may succeed even though there is not sufficient memory to hold pixels; allocation does not take place until the pixels are written to. The actual behavior depends on the platform implementation of calloc().

Source

pub fn try_alloc_pixels_info( &mut self, image_info: &ImageInfo, row_bytes: impl Into<Option<usize>>, ) -> bool

Sets ImageInfo to info following the rules in set_info() and allocates pixel memory. row_bytes must equal or exceed info.width() times info.bytes_per_pixel(), or equal None. Pass in None for row_bytes to compute the minimum valid value.

Returns false and calls reset() if ImageInfo could not be set, or memory could not be allocated.

On most platforms, allocating pixel memory may succeed even though there is not sufficient memory to hold pixels; allocation does not take place until the pixels are written to. The actual behavior depends on the platform implementation of malloc().

Source

pub fn alloc_pixels_info( &mut self, image_info: &ImageInfo, row_bytes: impl Into<Option<usize>>, )

Sets ImageInfo to info following the rules in set_info() and allocates pixel memory. row_bytes must equal or exceed info.width() times info.bytes_per_pixel(), or equal None. Pass in None for row_bytes to compute the minimum valid value.

Aborts execution if SkImageInfo could not be set, or memory could be allocated.

On most platforms, allocating pixel memory may succeed even though there is not sufficient memory to hold pixels; allocation does not take place until the pixels are written to. The actual behavior depends on the platform implementation of malloc().

Source

pub fn try_alloc_n32_pixels( &mut self, (width, height): (i32, i32), is_opaque: impl Into<Option<bool>>, ) -> bool

Sets ImageInfo to width, height, and native color type; and allocates pixel memory. If is_opaque is true, sets ImageInfo to AlphaType::Opaque; otherwise, sets to AlphaType::Premul.

Calls reset() and returns false if width exceeds 29 bits or is negative, or height is negative.

Returns false if allocation fails.

Use to create Bitmap that matches crate::PMColor, the native pixel arrangement on the platform. Bitmap drawn to output device skips converting its pixel format.

Source

pub fn alloc_n32_pixels( &mut self, (width, height): (i32, i32), is_opaque: impl Into<Option<bool>>, )

Sets ImageInfo to width, height, and native color type; and allocates pixel memory. If is_opaque is true, sets ImageInfo to AlphaType::Opaque; otherwise, sets to AlphaType::Premul.

Aborts if width exceeds 29 bits or is negative, or height is negative, or allocation fails.

Use to create Bitmap that matches crate::PMColor, the native pixel arrangement on the platform. Bitmap drawn to output device skips converting its pixel format.

Source

pub unsafe fn install_pixels( &mut self, info: &ImageInfo, pixels: *mut c_void, row_bytes: usize, ) -> bool

Sets ImageInfo to info following the rules in set_info(), and creates PixelRef containing pixels and row_bytes.

If ImageInfo could not be set, or row_bytes is less than info.min_row_bytes(): calls reset(), and returns false`.

Otherwise, if pixels equals ptr::null_mut(): sets ImageInfo, returns true.

Caller must ensure that pixels are valid for the lifetime of Bitmap and PixelRef.

Source

pub fn try_alloc_pixels(&mut self) -> bool

Allocates pixel memory with HeapAllocator, and replaces existing PixelRef. The allocation size is determined by ImageInfo width, height, and ColorType.

Returns false if info().color_type() is ColorType::Unknown, or allocation fails.

Source

pub fn alloc_pixels(&mut self)

Allocates pixel memory with HeapAllocator, and replaces existing PixelRef. The allocation size is determined by ImageInfo width, height, and ColorType.

Aborts if info().color_type() is ColorType::Unknown, or allocation fails.

Source

pub fn pixel_ref(&self) -> Option<PixelRef>

Returns PixelRef, which contains: pixel base address; its dimensions; and row_bytes(), the interval from one row to the next. Does not change PixelRef reference count. PixelRef may be shared by multiple bitmaps.

If PixelRef has not been set, returns None.

Source

pub fn pixel_ref_origin(&self) -> IPoint

Returns origin of pixels within PixelRef. Bitmap bounds is always contained by PixelRef bounds, which may be the same size or larger. Multiple Bitmap can share the same PixelRef, where each Bitmap has different bounds.

The returned origin added to Bitmap dimensions equals or is smaller than the PixelRef dimensions.

Returns (0, 0) if PixelRef is None.

Source

pub fn set_pixel_ref( &mut self, pixel_ref: impl Into<Option<PixelRef>>, offset: impl Into<IPoint>, )

Replaces pixel_ref and origin in Bitmap. offset specifies the offset within the PixelRef pixels for the top-left corner of the bitmap.

Asserts in debug builds if offset is out of range. Pins offset to legal range in release builds.

The caller is responsible for ensuring that the pixels match the ColorType and AlphaType in ImageInfo.

Source

pub fn is_ready_to_draw(&self) -> bool

Returns true if Bitmap can be drawn.

Source

pub fn generation_id(&self) -> u32

Returns a unique value corresponding to the pixels in PixelRef.
Returns a different value after notify_pixels_changed() has been called.
Returns zero if PixelRef is None.

Determines if pixels have changed since last examined.

Source

pub fn notify_pixels_changed(&self)

Marks that pixels in PixelRef have changed. Subsequent calls to generation_id() return a different value.

Source

pub fn erase_color(&self, c: impl Into<Color>)

Replaces pixel values with c, interpreted as being in the sRGB ColorSpace. All pixels contained by [bounds(&self)] are affected. If the [color_type(&self)] is ColorType::Gray8 or ColorType::RGB565, then alpha is ignored; RGB is treated as opaque. If [color_type(&self)] is ColorType::Alpha8, then RGB is ignored.

Input color is ultimately converted to an Color4f, so Self::erase_color_4f will have higher color resolution.

Source

pub fn erase_color_4f(&self, c: impl AsRef<Color4f>)

Replaces pixel values with c, interpreted as being in the sRGB ColorSpace. All pixels contained by [bounds(&self)] are affected. If the [color_type(&self)] is ColorType::Gray8 or ColorType::RGB565, then alpha is ignored; RGB is treated as opaque. If [color_type(&self)] is ColorType::Alpha8, then RGB is ignored.

Source

pub fn erase_argb(&self, a: u8, r: u8, g: u8, b: u8)

Replaces pixel values with unpremultiplied color built from a, r, g, and b, interpreted as being in the sRGB ColorSpace. All pixels contained by [bounds(&self)] are affected. If the [color_type(&self)] is ColorType::Gray8 or ColorType::RGB565, then a is ignored; r, g, and b are treated as opaque. If [color_type(&self)] is ColorType::Alpha8, then r, g, and b are ignored.

Source

pub fn erase(&self, c: impl Into<Color>, area: impl AsRef<IRect>)

Replaces pixel values inside area with c. interpreted as being in the sRGB ColorSpace. If area does not intersect bounds(), call has no effect.

If the color_type() is ColorType::Gray8 ColorType::RGB565, then alpha is ignored; RGB is treated as opaque. If color_type() is ColorType::Alpha8, then RGB is ignored.

Input color is ultimately converted to an Color4f, so Self::erase_4f will have higher color resolution.

Source

pub fn erase_4f(&self, c: impl AsRef<Color4f>, area: impl AsRef<IRect>)

Replaces pixel values inside area with c. interpreted as being in the sRGB ColorSpace. If area does not intersect bounds(), call has no effect.

If the color_type() is ColorType::Gray8 ColorType::RGB565, then alpha is ignored; RGB is treated as opaque. If color_type() is ColorType::Alpha8, then RGB is ignored.

Source

pub fn get_color(&self, p: impl Into<IPoint>) -> Color

Returns pixel at (x, y) as unpremultiplied color.
Returns black with alpha if ColorType is ColorType::Alpha8

Input is not validated: out of bounds values of x or y trigger an assert().

Fails if ColorType is ColorType::Unknown or pixel address is nullptr.

ColorSpace in ImageInfo is ignored. Some color precision may be lost in the conversion to unpremultiplied color; original pixel data may have additional precision.

Source

pub fn get_color_4f(&self, p: impl Into<IPoint>) -> Color4f

Returns pixel at (x, y) as unpremultiplied color. Returns black with alpha if ColorType is ColorType::Alpha8

Input is not validated: out of bounds values of x or y trigger an assert().

Fails if ColorType is ColorType::Unknown or pixel address is None.

ColorSpace in ImageInfo is ignored. Some color precision may be lost in the conversion to unpremultiplied color.

Source

pub fn get_alpha_f(&self, p: impl Into<IPoint>) -> f32

Look up the pixel at (x,y) and return its alpha component, normalized to [0..1]. This is roughly equivalent to get_color().a(), but can be more efficient (and more precise if the pixels store more than 8 bits per component).

Source

pub fn get_addr(&self, p: impl Into<IPoint>) -> *const c_void

Returns pixel address at (x, y).

Input is not validated: out of bounds values of x or y, or ColorType::Unknown, trigger an assert(). Returns nullptr if ColorType is ColorType::Unknown, or PixelRef is nullptr.

Performs a lookup of pixel size; for better performance, call one of: get_addr8(), get_addr16(), or get_addr32().

Source

pub fn extract_subset(&self, dst: &mut Self, subset: impl AsRef<IRect>) -> bool

Shares PixelRef with dst. Pixels are not copied; Bitmap and dst point to the same pixels; dst Self::bounds() are set to the intersection of subset and the original Self::bounds().

Subset may be larger than Self::bounds(). Any area outside of Self::bounds() is ignored.

Any contents of dst are discarded.

Return false if:

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

Source

pub unsafe fn read_pixels( &self, dst_info: &ImageInfo, dst_pixels: *mut c_void, dst_row_bytes: usize, src_x: i32, src_y: i32, ) -> bool

Copies a crate::Rect of pixels from Bitmap to dst_pixels. Copy starts at (src_x, src_y), and does not exceed Bitmap (width(), height()).

dst_info specifies width, height, ColorType, AlphaType, and ColorSpace of destination.
dst_row_bytes specifics the gap from one destination row to the next. Returns true if pixels are copied. Returns false if:

  • dst_info has no address
  • dst_row_bytes is less than dst_info.min_row_bytes()
  • PixelRef is nullptr

Pixels are copied only if pixel conversion is possible. If Self::color_type() is ColorType::Gray8, or ColorType::Alpha8; dst_info.color_type() must match. If Self::color_type() is ColorType::Gray8, dst_info.color_space() must match. If Self::alpha_type() is AlphaType::Opaque, dst_info.alpha_type() must match. If Self::color_space() is nullptr, dst_info.color_space() must match. Returns false if pixel conversion is not possible.

src_x and src_y may be negative to copy only top or left of source. Returns false if Self::width() or Self::height() is zero or negative. Returns false if abs(src_x) >= Self::width(), or if abs(src_y) >= Self::height().

Source

pub fn extract_alpha( &self, dst: &mut Self, paint: Option<&Paint>, ) -> Option<IPoint>

Sets dst to alpha described by pixels. Returns false if dst cannot be written to or dst pixels cannot be allocated.

If paint is not None and contains crate::MaskFilter, crate::MaskFilter generates mask alpha from Bitmap. Uses HeapAllocator to reserve memory for dst PixelRef. Returns offset to top-left position for dst for alignment with Bitmap; (0, 0) unless crate::MaskFilter generates mask.

Source

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

Copies Bitmap pixel address, row bytes, and ImageInfo to pixmap, if address is available, and returns [Some(Pixmap)]. If pixel address is not available, return None and leave pixmap unchanged.

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

Source

pub fn to_shader<'a>( &self, tile_modes: impl Into<Option<(TileMode, TileMode)>>, sampling: impl Into<SamplingOptions>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<Shader>

Make a shader with the specified tiling, matrix and sampling.
Defaults to clamp in both X and Y.

Source

pub fn as_image(&self) -> Image

Returns a new image from the bitmap. If the bitmap is marked immutable, this will share the pixel buffer. If not, it will make a copy of the pixels for the image.

Source§

impl Handle<SkContourMeasureIter>

Source

pub fn new( path: &Path, force_closed: bool, res_scale: impl Into<Option<scalar>>, ) -> Self

Source

pub fn from_path( path: &Path, force_closed: bool, res_scale: impl Into<Option<scalar>>, ) -> Self

Source

pub fn reset( &mut self, path: &Path, force_closed: bool, res_scale: impl Into<Option<scalar>>, ) -> &mut Self

Source§

impl Handle<SkFont>

Source

pub fn new( typeface: impl Into<Typeface>, size: impl Into<Option<scalar>>, ) -> Self

Source

pub fn from_typeface( typeface: impl Into<Typeface>, size: impl Into<Option<scalar>>, ) -> Self

Source

pub fn from_typeface_with_params( typeface: impl Into<Typeface>, size: scalar, scale: scalar, skew: scalar, ) -> Self

Source

pub fn is_force_auto_hinting(&self) -> bool

Source

pub fn is_embedded_bitmaps(&self) -> bool

Source

pub fn is_subpixel(&self) -> bool

Source

pub fn is_linear_metrics(&self) -> bool

Source

pub fn is_embolden(&self) -> bool

Source

pub fn is_baseline_snap(&self) -> bool

Source

pub fn set_force_auto_hinting(&mut self, force_auto_hinting: bool) -> &mut Self

Source

pub fn set_embedded_bitmaps(&mut self, embedded_bitmaps: bool) -> &mut Self

Source

pub fn set_subpixel(&mut self, subpixel: bool) -> &mut Self

Source

pub fn set_linear_metrics(&mut self, linear_metrics: bool) -> &mut Self

Source

pub fn set_embolden(&mut self, embolden: bool) -> &mut Self

Source

pub fn set_baseline_snap(&mut self, baseline_snap: bool) -> &mut Self

Source

pub fn edging(&self) -> Edging

Source

pub fn set_edging(&mut self, edging: Edging) -> &mut Self

Source

pub fn set_hinting(&mut self, hinting: FontHinting) -> &mut Self

Source

pub fn hinting(&self) -> FontHinting

Source

pub fn with_size(&self, size: scalar) -> Option<Self>

Source

pub fn typeface(&self) -> Typeface

Source

pub fn size(&self) -> scalar

Source

pub fn scale_x(&self) -> scalar

Source

pub fn skew_x(&self) -> scalar

Source

pub fn set_typeface(&mut self, tf: impl Into<Typeface>) -> &mut Self

Source

pub fn set_size(&mut self, size: scalar) -> &mut Self

Source

pub fn set_scale_x(&mut self, scale_x: scalar) -> &mut Self

Source

pub fn set_skew_x(&mut self, skew_x: scalar) -> &mut Self

Source

pub fn str_to_glyphs( &self, str: impl AsRef<str>, glyphs: &mut [GlyphId], ) -> usize

Source

pub fn text_to_glyphs( &self, text: impl EncodedText, glyphs: &mut [GlyphId], ) -> usize

Source

pub fn count_str(&self, str: impl AsRef<str>) -> usize

Source

pub fn count_text(&self, text: impl EncodedText) -> usize

Source

pub fn str_to_glyphs_vec(&self, str: impl AsRef<str>) -> Vec<GlyphId>

Source

pub fn text_to_glyphs_vec(&self, text: impl EncodedText) -> Vec<GlyphId>

Source

pub fn measure_str( &self, str: impl AsRef<str>, paint: Option<&Paint>, ) -> (scalar, Rect)

Source

pub fn measure_text( &self, text: impl EncodedText, paint: Option<&Paint>, ) -> (scalar, Rect)

Source

pub fn unichar_to_glyph(&self, uni: Unichar) -> GlyphId

Source

pub fn unichar_to_glyphs(&self, uni: &[Unichar], glyphs: &mut [GlyphId])

Source

pub fn get_widths(&self, glyphs: &[GlyphId], widths: &mut [scalar])

Source

pub fn get_widths_bounds( &self, glyphs: &[GlyphId], widths: Option<&mut [scalar]>, bounds: Option<&mut [Rect]>, paint: Option<&Paint>, )

Source

pub fn get_bounds( &self, glyphs: &[GlyphId], bounds: &mut [Rect], paint: Option<&Paint>, )

Source

pub fn get_pos( &self, glyphs: &[GlyphId], pos: &mut [Point], origin: Option<Point>, )

Source

pub fn get_x_pos( &self, glyphs: &[GlyphId], x_pos: &mut [scalar], origin: Option<scalar>, )

Source

pub fn get_intercepts<'a>( &self, glyphs: &[GlyphId], pos: &[Point], (top, bottom): (scalar, scalar), paint: impl Into<Option<&'a Paint>>, ) -> Vec<scalar>

Source

pub fn get_path(&self, glyph_id: GlyphId) -> Option<Path>

Source

pub fn metrics(&self) -> (scalar, FontMetrics)

Source

pub fn spacing(&self) -> scalar

Source§

impl Handle<SkColorInfo>

Source

pub fn new( ct: ColorType, at: AlphaType, cs: impl Into<Option<ColorSpace>>, ) -> Self

Source

pub fn color_space(&self) -> Option<ColorSpace>

Source

pub fn color_type(&self) -> ColorType

Source

pub fn alpha_type(&self) -> AlphaType

Source

pub fn is_opaque(&self) -> bool

Source

pub fn is_gamma_close_to_srgb(&self) -> bool

Source

pub fn with_alpha_type(&self, new_alpha_type: AlphaType) -> Self

Source

pub fn with_color_type(&self, new_color_type: ColorType) -> Self

Source

pub fn with_color_space(&self, cs: impl Into<Option<ColorSpace>>) -> Self

Source

pub fn bytes_per_pixel(&self) -> usize

Source

pub fn shift_per_pixel(&self) -> usize

Source§

impl Handle<SkImageInfo>

Source

pub fn new( dimensions: impl Into<ISize>, ct: ColorType, at: AlphaType, cs: impl Into<Option<ColorSpace>>, ) -> Self

Source

pub fn from_color_info( dimensions: impl Into<ISize>, color_info: ColorInfo, ) -> Self

Source

pub fn new_n32( dimensions: impl Into<ISize>, at: AlphaType, cs: impl Into<Option<ColorSpace>>, ) -> ImageInfo

Source

pub fn new_s32(dimensions: impl Into<ISize>, at: AlphaType) -> ImageInfo

Source

pub fn new_n32_premul( dimensions: impl Into<ISize>, cs: impl Into<Option<ColorSpace>>, ) -> ImageInfo

Source

pub fn new_a8(dimensions: impl Into<ISize>) -> ImageInfo

Source

pub fn new_unknown(dimensions: Option<ISize>) -> ImageInfo

Source

pub fn width(&self) -> i32

Source

pub fn height(&self) -> i32

Source

pub fn color_type(&self) -> ColorType

Source

pub fn alpha_type(&self) -> AlphaType

Source

pub fn color_space(&self) -> Option<ColorSpace>

Source

pub fn is_empty(&self) -> bool

Source

pub fn color_info(&self) -> &ColorInfo

Source

pub fn is_opaque(&self) -> bool

Source

pub fn dimensions(&self) -> ISize

Source

pub fn bounds(&self) -> IRect

Source

pub fn is_gamma_close_to_srgb(&self) -> bool

Source

pub fn with_dimensions(&self, new_dimensions: impl Into<ISize>) -> Self

Source

pub fn with_alpha_type(&self, new_alpha_type: AlphaType) -> Self

Source

pub fn with_color_type(&self, new_color_type: ColorType) -> Self

Source

pub fn with_color_space( &self, new_color_space: impl Into<Option<ColorSpace>>, ) -> Self

Source

pub fn bytes_per_pixel(&self) -> usize

Source

pub fn shift_per_pixel(&self) -> usize

Source

pub fn min_row_bytes(&self) -> usize

Source

pub fn compute_offset( &self, point: impl Into<IPoint>, row_bytes: usize, ) -> usize

Source

pub fn compute_byte_size(&self, row_bytes: usize) -> usize

Source

pub fn compute_min_byte_size(&self) -> usize

Source

pub fn valid_row_bytes(&self, row_bytes: usize) -> bool

Source

pub fn reset(&mut self) -> &mut Self

Source§

impl Handle<SkPaint>

Source

pub fn new<'a>( color: impl AsRef<Color4f>, color_space: impl Into<Option<&'a ColorSpace>>, ) -> Paint

Source

pub fn reset(&mut self) -> &mut Self

Source

pub fn is_anti_alias(&self) -> bool

Source

pub fn set_anti_alias(&mut self, anti_alias: bool) -> &mut Self

Source

pub fn is_dither(&self) -> bool

Source

pub fn set_dither(&mut self, dither: bool) -> &mut Self

Source

pub fn style(&self) -> Style

Source

pub fn set_style(&mut self, style: Style) -> &mut Self

Source

pub fn set_stroke(&mut self, stroke: bool) -> &mut Self

Source

pub fn color(&self) -> Color

Source

pub fn color4f(&self) -> Color4f

Source

pub fn set_color(&mut self, color: impl Into<Color>) -> &mut Self

Source

pub fn set_color4f<'a>( &mut self, color: impl AsRef<Color4f>, color_space: impl Into<Option<&'a ColorSpace>>, ) -> &mut Self

Source

pub fn alpha_f(&self) -> f32

Source

pub fn alpha(&self) -> u8

Source

pub fn set_alpha_f(&mut self, alpha: f32) -> &mut Self

Source

pub fn set_alpha(&mut self, alpha: u8) -> &mut Self

Source

pub fn set_argb(&mut self, a: u8, r: u8, g: u8, b: u8) -> &mut Self

Source

pub fn stroke_width(&self) -> scalar

Source

pub fn set_stroke_width(&mut self, width: scalar) -> &mut Self

Source

pub fn stroke_miter(&self) -> scalar

Source

pub fn set_stroke_miter(&mut self, miter: scalar) -> &mut Self

Source

pub fn stroke_cap(&self) -> Cap

Source

pub fn set_stroke_cap(&mut self, cap: Cap) -> &mut Self

Source

pub fn stroke_join(&self) -> Join

Source

pub fn set_stroke_join(&mut self, join: Join) -> &mut Self

Source

pub fn shader(&self) -> Option<Shader>

Source

pub fn set_shader(&mut self, shader: impl Into<Option<Shader>>) -> &mut Self

Source

pub fn color_filter(&self) -> Option<ColorFilter>

Source

pub fn set_color_filter( &mut self, color_filter: impl Into<Option<ColorFilter>>, ) -> &mut Self

Source

pub fn as_blend_mode(&self) -> Option<BlendMode>

Source

pub fn blend_mode_or(&self, default_mode: BlendMode) -> BlendMode

Source

pub fn blend_mode(&self) -> BlendMode

👎Deprecated since 0.42.0: Use as_blend_mode() or blend_mode_or() instead.
Source

pub fn is_src_over(&self) -> bool

Source

pub fn set_blend_mode(&mut self, mode: BlendMode) -> &mut Self

Source

pub fn blender(&self) -> Option<Blender>

Source

pub fn set_blender(&mut self, blender: impl Into<Option<Blender>>) -> &mut Self

Source

pub fn path_effect(&self) -> Option<PathEffect>

Source

pub fn set_path_effect( &mut self, path_effect: impl Into<Option<PathEffect>>, ) -> &mut Self

Source

pub fn mask_filter(&self) -> Option<MaskFilter>

Source

pub fn set_mask_filter( &mut self, mask_filter: impl Into<Option<MaskFilter>>, ) -> &mut Self

Source

pub fn image_filter(&self) -> Option<ImageFilter>

Source

pub fn set_image_filter( &mut self, image_filter: impl Into<Option<ImageFilter>>, ) -> &mut Self

Source

pub fn nothing_to_draw(&self) -> bool

Source§

impl Handle<SkPath>

Path contain geometry. Path may be empty, or contain one or more verbs that outline a figure. Path always starts with a move verb to a Cartesian coordinate, and may be followed by additional verbs that add lines or curves. Adding a close verb makes the geometry into a continuous loop, a closed contour. Path may contain any number of contours, each beginning with a move verb.

Path contours may contain only a move verb, or may also contain lines, quadratic beziers, conics, and cubic beziers. Path contours may be open or closed.

When used to draw a filled area, Path describes whether the fill is inside or outside the geometry. Path also describes the winding rule used to fill overlapping contours.

Internally, Path lazily computes metrics likes bounds and convexity. Call Path::update_bounds_cache to make Path thread safe.

Source

pub fn new_from( points: &[Point], verbs: &[u8], conic_weights: &[scalar], fill_type: FillType, is_volatile: impl Into<Option<bool>>, ) -> Self

Create a new path with the specified segments.

The points and weights arrays are read in order, based on the sequence of verbs.

Move 1 point Line 1 point Quad 2 points Conic 2 points and 1 weight Cubic 3 points Close 0 points

If an illegal sequence of verbs is encountered, or the specified number of points or weights is not sufficient given the verbs, an empty Path is returned.

A legal sequence of verbs consists of any number of Contours. A contour always begins with a Move verb, followed by 0 or more segments: Line, Quad, Conic, Cubic, followed by an optional Close.

Source

pub fn rect( rect: impl AsRef<Rect>, dir: impl Into<Option<PathDirection>>, ) -> Self

Source

pub fn oval( oval: impl AsRef<Rect>, dir: impl Into<Option<PathDirection>>, ) -> Self

Source

pub fn oval_with_start_index( oval: impl AsRef<Rect>, dir: PathDirection, start_index: usize, ) -> Self

Source

pub fn circle( center: impl Into<Point>, radius: scalar, dir: impl Into<Option<PathDirection>>, ) -> Self

Source

pub fn rrect( rect: impl AsRef<RRect>, dir: impl Into<Option<PathDirection>>, ) -> Self

Source

pub fn rrect_with_start_index( rect: impl AsRef<RRect>, dir: PathDirection, start_index: usize, ) -> Self

Source

pub fn polygon( pts: &[Point], is_closed: bool, fill_type: impl Into<Option<FillType>>, is_volatile: impl Into<Option<bool>>, ) -> Self

Source

pub fn line(a: impl Into<Point>, b: impl Into<Point>) -> Self

Source

pub fn new() -> Self

Constructs an empty Path. By default, Path has no verbs, no Point, and no weights. FillType is set to Winding.

Returns: empty Path

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

Source

pub fn snapshot(&self) -> Self

Returns a copy of this path in the current state.

Source

pub fn detach(&mut self) -> Self

Returns a copy of this path in the current state, and resets the path to empty.

Source

pub fn is_interpolatable(&self, compare: &Path) -> bool

Returns true if Path contain equal verbs and equal weights. If Path contain one or more conics, the weights must match.

conic_to() may add different verbs depending on conic weight, so it is not trivial to interpolate a pair of Path containing conics with different conic weight values.

  • compare - Path to compare

Returns: true if Path verb array and weights are equivalent

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

Source

pub fn interpolate(&self, ending: &Path, weight: scalar) -> Option<Path>

Interpolates between Path with Point array of equal size. Copy verb array and weights to out, and set out Point array to a weighted average of this Point array and ending Point array, using the formula: (Path Point * weight) + ending Point * (1 - weight).

weight is most useful when between zero (ending Point array) and one (this Point_Array); will work with values outside of this range.

interpolate() returns false and leaves out unchanged if Point array is not the same size as ending Point array. Call is_interpolatable() to check Path compatibility prior to calling interpolate().

  • ending - Point array averaged with this Point array
  • weight - contribution of this Point array, and one minus contribution of ending Point array
  • out - Path replaced by interpolated averages

Returns: true if Path contain same number of Point

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

Source

pub fn fill_type(&self) -> PathFillType

Returns PathFillType, the rule used to fill Path.

Returns: current PathFillType setting

Source

pub fn set_fill_type(&mut self, ft: PathFillType) -> &mut Self

Sets FillType, the rule used to fill Path. While there is no check that ft is legal, values outside of FillType are not supported.

Source

pub fn is_inverse_fill_type(&self) -> bool

Returns if FillType describes area outside Path geometry. The inverse fill area extends indefinitely.

Returns: true if FillType is InverseWinding or InverseEvenOdd

Source

pub fn toggle_inverse_fill_type(&mut self) -> &mut Self

Replaces FillType with its inverse. The inverse of FillType describes the area unmodified by the original FillType.

Source

pub fn convexity_type(&self) -> !

👎Deprecated since 0.36.0: Removed, use is_convex()
Source

pub fn convexity_type_or_unknown(&self) -> !

👎Deprecated since 0.36.0: Removed, use is_convex()
Source

pub fn is_convex(&self) -> bool

Returns true if the path is convex. If necessary, it will first compute the convexity.

Source

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

Returns true if this path is recognized as an oval or circle.

bounds receives bounds of oval.

bounds is unmodified if oval is not found.

  • bounds - storage for bounding Rect of oval; may be None

Returns: true if Path is recognized as an oval or circle

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

Source

pub fn is_rrect(&self) -> Option<RRect>

Returns RRect if path is representable as RRect. Returns None if path is representable as oval, circle, or Rect.

Returns: RRect if Path contains only RRect

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

Source

pub fn is_arc(&self) -> Option<Arc>

Returns Arc if path is representable as an oval arc. In other words, could this path be drawn using Canvas::draw_arc().

Returns: Arc if Path contains only a single arc from an oval

Source

pub fn reset(&mut self) -> &mut Self

Sets Path to its initial state. Removes verb array, Point array, and weights, and sets FillType to Winding. Internal storage associated with Path is released.

Returns: reference to Path

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

Source

pub fn rewind(&mut self) -> &mut Self

Sets Path to its initial state, preserving internal storage. Removes verb array, Point array, and weights, and sets FillType to Winding. Internal storage associated with Path is retained.

Use rewind() instead of reset() if Path storage will be reused and performance is critical.

Returns: reference to Path

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

Source

pub fn is_empty(&self) -> bool

Returns if Path is empty. Empty Path may have FillType but has no Point, Verb, or conic weight. Path::default() constructs empty Path; reset() and rewind() make Path empty.

Returns: true if the path contains no Verb array

Source

pub fn is_last_contour_closed(&self) -> bool

Returns if contour is closed. Contour is closed if Path Verb array was last modified by close(). When stroked, closed contour draws crate::paint::Join instead of crate::paint::Cap at first and last Point.

Returns: true if the last contour ends with a Verb::Close

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

Source

pub fn is_finite(&self) -> bool

Returns true for finite Point array values between negative SK_ScalarMax and positive SK_ScalarMax. Returns false for any Point array value of SK_ScalarInfinity, SK_ScalarNegativeInfinity, or SK_ScalarNaN.

Returns: true if all Point values are finite

Source

pub fn is_volatile(&self) -> bool

Returns true if the path is volatile; it will not be altered or discarded by the caller after it is drawn. Path by default have volatile set false, allowing crate::Surface to attach a cache of data which speeds repeated drawing. If true, crate::Surface may not speed repeated drawing.

Returns: true if caller will alter Path after drawing

Source

pub fn set_is_volatile(&mut self, is_volatile: bool) -> &mut Self

Specifies whether Path is volatile; whether it will be altered or discarded by the caller after it is drawn. Path by default have volatile set false, allowing Device to attach a cache of data which speeds repeated drawing.

Mark temporary paths, discarded or modified after use, as volatile to inform Device that the path need not be cached.

Mark animating Path volatile to improve performance. Mark unchanging Path non-volatile to improve repeated rendering.

raster surface Path draws are affected by volatile for some shadows. GPU surface Path draws are affected by volatile for some shadows and concave geometries.

  • is_volatile - true if caller will alter Path after drawing

Returns: reference to Path

Source

pub fn is_line_degenerate( p1: impl Into<Point>, p2: impl Into<Point>, exact: bool, ) -> bool

Tests if line between Point pair is degenerate. Line with no length or that moves a very short distance is degenerate; it is treated as a point.

exact changes the equality test. If true, returns true only if p1 equals p2. If false, returns true if p1 equals or nearly equals p2.

  • p1 - line start point
  • p2 - line end point
  • exact - if false, allow nearly equals

Returns: true if line is degenerate; its length is effectively zero

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

Source

pub fn is_quad_degenerate( p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, exact: bool, ) -> bool

Tests if quad is degenerate. Quad with no length or that moves a very short distance is degenerate; it is treated as a point.

  • p1 - quad start point
  • p2 - quad control point
  • p3 - quad end point
  • exact - if true, returns true only if p1, p2, and p3 are equal; if false, returns true if p1, p2, and p3 are equal or nearly equal

Returns: true if quad is degenerate; its length is effectively zero

Source

pub fn is_cubic_degenerate( p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, p4: impl Into<Point>, exact: bool, ) -> bool

Tests if cubic is degenerate. Cubic with no length or that moves a very short distance is degenerate; it is treated as a point.

  • p1 - cubic start point
  • p2 - cubic control point 1
  • p3 - cubic control point 2
  • p4 - cubic end point
  • exact - if true, returns true only if p1, p2, p3, and p4 are equal; if false, returns true if p1, p2, p3, and p4 are equal or nearly equal

Returns: true if cubic is degenerate; its length is effectively zero

Source

pub fn is_line(&self) -> Option<(Point, Point)>

Returns true if Path contains only one line; Verb array has two entries: Verb::Move, Verb::Line. If Path contains one line and line is not None, line is set to line start point and line end point. Returns false if Path is not one line; line is unaltered.

  • line - storage for line. May be None

Returns: true if Path contains exactly one line

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

Source

pub fn count_points(&self) -> usize

Returns the number of points in Path. Point count is initially zero.

Returns: Path Point array length

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

Source

pub fn get_point(&self, index: usize) -> Option<Point>

Returns Point at index in Point array. Valid range for index is 0 to count_points() - 1. Returns (0, 0) if index is out of range.

  • index - Point array element selector

Returns: Point array value or (0, 0)

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

Source

pub fn get_points(&self, points: &mut [Point]) -> usize

Returns number of points in Path. Up to max points are copied. points may be None; then, max must be zero. If max is greater than number of points, excess points storage is unaltered.

  • points - storage for Path Point array. May be None
  • max - maximum to copy; must be greater than or equal to zero

Returns: Path Point array length

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

Source

pub fn count_verbs(&self) -> usize

Returns the number of verbs: Verb::Move, Verb::Line, Verb::Quad, Verb::Conic, Verb::Cubic, and Verb::Close; added to Path.

Returns: length of verb array

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

Source

pub fn get_verbs(&self, verbs: &mut [u8]) -> usize

Returns the number of verbs in the path. Up to max verbs are copied. The verbs are copied as one byte per verb.

  • verbs - storage for verbs, may be None
  • max - maximum number to copy into verbs

Returns: the actual number of verbs in the path

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

Source

pub fn approximate_bytes_used(&self) -> usize

Returns the approximate byte size of the Path in memory.

Returns: approximate size

Source

pub fn swap(&mut self, other: &mut Path) -> &mut Self

Exchanges the verb array, Point array, weights, and FillType with other. Cached state is also exchanged. swap() internally exchanges pointers, so it is lightweight and does not allocate memory.

swap() usage has largely been replaced by PartialEq. Path do not copy their content on assignment until they are written to, making assignment as efficient as swap().

  • other - Path exchanged by value

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

Source

pub fn bounds(&self) -> &Rect

Returns minimum and maximum axes values of Point array. Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may be larger or smaller than area affected when Path is drawn.

Rect returned includes all Point added to Path, including Point associated with Verb::Move that define empty contours.

Returns: bounds of all Point in Point array

Source

pub fn update_bounds_cache(&mut self) -> &mut Self

Updates internal bounds so that subsequent calls to bounds() are instantaneous. Unaltered copies of Path may also access cached bounds through bounds().

For now, identical to calling bounds() and ignoring the returned value.

Call to prepare Path subsequently drawn from multiple threads, to avoid a race condition where each draw separately computes the bounds.

Source

pub fn compute_tight_bounds(&self) -> Rect

Returns minimum and maximum axes values of the lines and curves in Path. Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may be larger or smaller than area affected when Path is drawn.

Includes Point associated with Verb::Move that define empty contours.

Behaves identically to bounds() when Path contains only lines. If Path contains curves, computed bounds includes the maximum extent of the quad, conic, or cubic; is slower than bounds(); and unlike bounds(), does not cache the result.

Returns: tight bounds of curves in Path

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

Source

pub fn conservatively_contains_rect(&self, rect: impl AsRef<Rect>) -> bool

Returns true if rect is contained by Path. May return false when rect is contained by Path.

For now, only returns true if Path has one contour and is convex. rect may share points and edges with Path and be contained. Returns true if rect is empty, that is, it has zero width or height; and the Point or line described by rect is contained by Path.

  • rect - Rect, line, or Point checked for containment

Returns: true if rect is contained

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

Source

pub fn inc_reserve(&mut self, extra_pt_count: usize) -> &mut Self

Grows Path verb array and Point array to contain extra_pt_count additional Point. May improve performance and use less memory by reducing the number and size of allocations when creating Path.

  • extra_pt_count - number of additional Point to allocate

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

Source

pub fn inc_reserve_with_verb_and_conic( &mut self, extra_pt_count: usize, extra_verb_count: impl Into<Option<usize>>, extract_conic_count: impl Into<Option<usize>>, ) -> &mut Self

Grows Path verb array and Point array to contain extra_pt_count additional Point. May improve performance and use less memory by reducing the number and size of allocations when creating Path.

  • extra_pt_count - number of additional Point to allocate
  • extra_verb_count - number of additional verbs
  • extra_conic_count - number of additional conics

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

Source

pub fn shrink_to_fit(&mut self) -> !

👎Deprecated since 0.37.0: Removed without replacement
Source

pub fn move_to(&mut self, p: impl Into<Point>) -> &mut Self

Adds beginning of contour at Point (x, y).

  • x - x-axis value of contour start
  • y - y-axis value of contour start

Returns: reference to Path

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

Source

pub fn r_move_to(&mut self, d: impl Into<Vector>) -> &mut Self

Adds beginning of contour relative to last point. If Path is empty, starts contour at (dx, dy). Otherwise, start contour at last point offset by (dx, dy). Function name stands for “relative move to”.

  • dx - offset from last point to contour start on x-axis
  • dy - offset from last point to contour start on y-axis

Returns: reference to Path

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

Source

pub fn line_to(&mut self, p: impl Into<Point>) -> &mut Self

Adds line from last point to (x, y). If Path is empty, or last Verb is Verb::Close, last point is set to (0, 0) before adding line.

line_to() appends Verb::Move to verb array and (0, 0) to Point array, if needed. line_to() then appends Verb::Line to verb array and (x, y) to Point array.

  • x - end of added line on x-axis
  • y - end of added line on y-axis

Returns: reference to Path

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

Source

pub fn r_line_to(&mut self, d: impl Into<Vector>) -> &mut Self

Adds line from last point to vector (dx, dy). If Path is empty, or last Verb is Verb::Close, last point is set to (0, 0) before adding line.

Appends Verb::Move to verb array and (0, 0) to Point array, if needed; then appends Verb::Line to verb array and line end to Point array. Line end is last point plus vector (dx, dy). Function name stands for “relative line to”.

  • dx - offset from last point to line end on x-axis
  • dy - offset from last point to line end on y-axis

Returns: reference to Path

example: https://fiddle.skia.org/c/@Path_rLineTo example: https://fiddle.skia.org/c/@Quad_a example: https://fiddle.skia.org/c/@Quad_b

Source

pub fn quad_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, ) -> &mut Self

Adds quad from last point towards (x1, y1), to (x2, y2). If Path is empty, or last Verb is Verb::Close, last point is set to (0, 0) before adding quad.

Appends Verb::Move to verb array and (0, 0) to Point array, if needed; then appends Verb::Quad to verb array; and (x1, y1), (x2, y2) to Point array.

  • x1 - control Point of quad on x-axis
  • y1 - control Point of quad on y-axis
  • x2 - end Point of quad on x-axis
  • y2 - end Point of quad on y-axis

Returns: reference to Path

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

Source

pub fn r_quad_to( &mut self, dx1: impl Into<Vector>, dx2: impl Into<Vector>, ) -> &mut Self

Adds quad from last point towards vector (dx1, dy1), to vector (dx2, dy2). If Path is empty, or last Verb is Verb::Close, last point is set to (0, 0) before adding quad.

Appends Verb::Move to verb array and (0, 0) to Point array, if needed; then appends Verb::Quad to verb array; and appends quad control and quad end to Point array. Quad control is last point plus vector (dx1, dy1). Quad end is last point plus vector (dx2, dy2). Function name stands for “relative quad to”.

  • dx1 - offset from last point to quad control on x-axis
  • dy1 - offset from last point to quad control on y-axis
  • dx2 - offset from last point to quad end on x-axis
  • dy2 - offset from last point to quad end on y-axis

Returns: reference to Path

example: https://fiddle.skia.org/c/@Conic_Weight_a example: https://fiddle.skia.org/c/@Conic_Weight_b example: https://fiddle.skia.org/c/@Conic_Weight_c example: https://fiddle.skia.org/c/@Path_rQuadTo

Source

pub fn conic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, w: scalar, ) -> &mut Self

Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w. If Path is empty, or last Verb is Verb::Close, last point is set to (0, 0) before adding conic.

Appends Verb::Move to verb array and (0, 0) to Point array, if needed.

If w is finite and not one, appends Verb::Conic to verb array; and (x1, y1), (x2, y2) to Point array; and w to conic weights.

If w is one, appends Verb::Quad to verb array, and (x1, y1), (x2, y2) to Point array.

If w is not finite, appends Verb::Line twice to verb array, and (x1, y1), (x2, y2) to Point array.

  • x1 - control Point of conic on x-axis
  • y1 - control Point of conic on y-axis
  • x2 - end Point of conic on x-axis
  • y2 - end Point of conic on y-axis
  • w - weight of added conic

Returns: reference to Path

Source

pub fn r_conic_to( &mut self, d1: impl Into<Vector>, d2: impl Into<Vector>, w: scalar, ) -> &mut Self

Adds conic from last point towards vector (dx1, dy1), to vector (dx2, dy2), weighted by w. If Path is empty, or last Verb is Verb::Close, last point is set to (0, 0) before adding conic.

Appends Verb::Move to verb array and (0, 0) to Point array, if needed.

If w is finite and not one, next appends Verb::Conic to verb array, and w is recorded as conic weight; otherwise, if w is one, appends Verb::Quad to verb array; or if w is not finite, appends Verb::Line twice to verb array.

In all cases appends Point control and end to Point array. control is last point plus vector (dx1, dy1). end is last point plus vector (dx2, dy2).

Function name stands for “relative conic to”.

  • dx1 - offset from last point to conic control on x-axis
  • dy1 - offset from last point to conic control on y-axis
  • dx2 - offset from last point to conic end on x-axis
  • dy2 - offset from last point to conic end on y-axis
  • w - weight of added conic

Returns: reference to Path

Source

pub fn cubic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, ) -> &mut Self

Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at (x3, y3). If Path is empty, or last Verb is Verb::Close, last point is set to (0, 0) before adding cubic.

Appends Verb::Move to verb array and (0, 0) to Point array, if needed; then appends Verb::Cubic to verb array; and (x1, y1), (x2, y2), (x3, y3) to Point array.

  • x1 - first control Point of cubic on x-axis
  • y1 - first control Point of cubic on y-axis
  • x2 - second control Point of cubic on x-axis
  • y2 - second control Point of cubic on y-axis
  • x3 - end Point of cubic on x-axis
  • y3 - end Point of cubic on y-axis

Returns: reference to Path

Source

pub fn r_cubic_to( &mut self, d1: impl Into<Vector>, d2: impl Into<Vector>, d3: impl Into<Vector>, ) -> &mut Self

Adds cubic from last point towards vector (dx1, dy1), then towards vector (dx2, dy2), to vector (dx3, dy3). If Path is empty, or last Verb is Verb::Close, last point is set to (0, 0) before adding cubic.

Appends Verb::Move to verb array and (0, 0) to Point array, if needed; then appends Verb::Cubic to verb array; and appends cubic control and cubic end to Point array. Cubic control is last point plus vector (dx1, dy1). Cubic end is last point plus vector (dx2, dy2). Function name stands for “relative cubic to”.

  • dx1 - offset from last point to first cubic control on x-axis
  • dy1 - offset from last point to first cubic control on y-axis
  • dx2 - offset from last point to second cubic control on x-axis
  • dy2 - offset from last point to second cubic control on y-axis
  • dx3 - offset from last point to cubic end on x-axis
  • dy3 - offset from last point to cubic end on y-axis

Returns: reference to Path

Source

pub fn arc_to( &mut self, oval: impl AsRef<Rect>, start_angle: scalar, sweep_angle: scalar, force_move_to: bool, ) -> &mut Self

Appends arc to Path. Arc added is part of ellipse bounded by oval, from start_angle through sweep_angle. Both start_angle and sweep_angle are measured in degrees, where zero degrees is aligned with the positive x-axis, and positive sweeps extends arc clockwise.

arc_to() adds line connecting Path last Point to initial arc Point if force_move_to is false and Path is not empty. Otherwise, added contour begins with first point of arc. Angles greater than -360 and less than 360 are treated modulo 360.

  • oval - bounds of ellipse containing arc
  • start_angle - starting angle of arc in degrees
  • sweep_angle - sweep, in degrees. Positive is clockwise; treated modulo 360
  • force_move_to - true to start a new contour with arc

Returns: reference to Path

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

Source

pub fn arc_to_tangent( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, radius: scalar, ) -> &mut Self

Appends arc to Path, after appending line if needed. Arc is implemented by conic weighted to describe part of circle. Arc is contained by tangent from last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc is part of circle sized to radius, positioned so it touches both tangent lines.

If last Path Point does not start Arc, arc_to appends connecting Line to Path. The length of Vector from (x1, y1) to (x2, y2) does not affect Arc.

Arc sweep is always less than 180 degrees. If radius is zero, or if tangents are nearly parallel, arc_to appends Line from last Path Point to (x1, y1).

arc_to_tangent appends at most one Line and one conic. arc_to_tangent implements the functionality of PostScript arct and HTML Canvas arc_to.

  • p1.x - x-axis value common to pair of tangents
  • p1.y - y-axis value common to pair of tangents
  • p2.x - x-axis value end of second tangent
  • p2.y - y-axis value end of second tangent
  • radius - distance from arc to circle center

Returns: reference to Path

example: https://fiddle.skia.org/c/@Path_arcTo_2_a example: https://fiddle.skia.org/c/@Path_arcTo_2_b example: https://fiddle.skia.org/c/@Path_arcTo_2_c

Source

pub fn arc_to_rotated( &mut self, r: impl Into<Point>, x_axis_rotate: scalar, large_arc: ArcSize, sweep: PathDirection, end: impl Into<Point>, ) -> &mut Self

Appends arc to Path. Arc is implemented by one or more conics weighted to describe part of oval with radii (rx, ry) rotated by x_axis_rotate degrees. Arc curves from last Path Point to (x, y), choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.

Arc sweep is always less than 360 degrees. arc_to_rotated() appends line to (x, y) if either radii are zero, or if last Path Point equals (x, y). arc_to_rotated() scales radii (rx, ry) to fit last Path Point and (x, y) if both are greater than zero but too small.

arc_to_rotated() appends up to four conic curves. arc_to_rotated() implements the functionality of SVG arc, although SVG sweep-flag value is opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, while Direction::CW cast to int is zero.

  • r.x - radius on x-axis before x-axis rotation
  • r.y - radius on y-axis before x-axis rotation
  • x_axis_rotate - x-axis rotation in degrees; positive values are clockwise
  • large_arc - chooses smaller or larger arc
  • sweep - chooses clockwise or counterclockwise arc
  • end.x - end of arc
  • end.y - end of arc

Returns: reference to Path

Source

pub fn r_arc_to_rotated( &mut self, r: impl Into<Point>, x_axis_rotate: scalar, large_arc: ArcSize, sweep: PathDirection, d: impl Into<Point>, ) -> &mut Self

Appends arc to Path, relative to last Path Point. Arc is implemented by one or more conic, weighted to describe part of oval with radii (r.x, r.y) rotated by x_axis_rotate degrees. Arc curves from last Path Point to relative end Point: (dx, dy), choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger. If Path is empty, the start arc Point is (0, 0).

Arc sweep is always less than 360 degrees. arc_to() appends line to end Point if either radii are zero, or if last Path Point equals end Point. arc_to() scales radii (rx, ry) to fit last Path Point and end Point if both are greater than zero but too small to describe an arc.

arc_to() appends up to four conic curves. arc_to() implements the functionality of svg arc, although SVG “sweep-flag” value is opposite the integer value of sweep; SVG “sweep-flag” uses 1 for clockwise, while Direction::CW cast to int is zero.

  • r.x - radius before x-axis rotation
  • r.y - radius before x-axis rotation
  • x_axis_rotate - x-axis rotation in degrees; positive values are clockwise
  • large_arc - chooses smaller or larger arc
  • sweep - chooses clockwise or counterclockwise arc
  • d.x - x-axis offset end of arc from last Path Point
  • d.y - y-axis offset end of arc from last Path Point

Returns: reference to Path

Source

pub fn close(&mut self) -> &mut Self

Appends Verb::Close to Path. A closed contour connects the first and last Point with line, forming a continuous loop. Open and closed contour draw the same with fill style. With stroke style, open contour draws crate::paint::Cap at contour start and end; closed contour draws crate::paint::Join at contour start and end.

close() has no effect if Path is empty or last Path Verb is Verb::Close.

Returns: reference to Path

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

Source

pub fn convert_conic_to_quads( p0: impl Into<Point>, p1: impl Into<Point>, p2: impl Into<Point>, w: scalar, pts: &mut [Point], pow2: usize, ) -> Option<usize>

Approximates conic with quad array. Conic is constructed from start Point p0, control Point p1, end Point p2, and weight w. Quad array is stored in pts; this storage is supplied by caller. Maximum quad count is 2 to the pow2. Every third point in array shares last Point of previous quad and first Point of next quad. Maximum pts storage size is given by: (1 + 2 * (1 << pow2)) * sizeof(Point).

Returns quad count used the approximation, which may be smaller than the number requested.

conic weight determines the amount of influence conic control point has on the curve. w less than one represents an elliptical section. w greater than one represents a hyperbolic section. w equal to one represents a parabolic section.

Two quad curves are sufficient to approximate an elliptical conic with a sweep of up to 90 degrees; in this case, set pow2 to one.

  • p0 - conic start Point
  • p1 - conic control Point
  • p2 - conic end Point
  • w - conic weight
  • pts - storage for quad array
  • pow2 - quad count, as power of two, normally 0 to 5 (1 to 32 quad curves)

Returns: number of quad curves written to pts

Source

pub fn is_rect(&self) -> Option<(Rect, bool, PathDirection)>

Returns Some(Rect, bool, PathDirection) if Path is equivalent to Rect when filled. If false: rect, is_closed, and direction are unchanged. If true: rect, is_closed, and direction are written to.

rect may be smaller than the Path bounds. Path bounds may include Verb::Move points that do not alter the area drawn by the returned rect.

Returns: Some(rect, is_closed, direction) if Path contains Rect

  • rect - bounds of Rect
  • is_closed - set to true if Path is closed
  • direction - to Rect direction

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

Source

pub fn add_rect( &mut self, rect: impl AsRef<Rect>, dir_start: Option<(PathDirection, usize)>, ) -> &mut Self

Adds a new contour to the path, defined by the rect, and wound in the specified direction. The verbs added to the path will be:

Move, Line, Line, Line, Close

start specifies which corner to begin the contour: 0: upper-left corner 1: upper-right corner 2: lower-right corner 3: lower-left corner

This start point also acts as the implied beginning of the subsequent, contour, if it does not have an explicit move_to(). e.g.

path.add_rect(...) // if we don’t say move_to() here, we will use the rect’s start point path.line_to(…)`

  • rect - Rect to add as a closed contour
  • dir - Direction to orient the new contour
  • start - initial corner of Rect to add

Returns: reference to Path

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

Source

pub fn add_oval( &mut self, oval: impl AsRef<Rect>, dir_start: Option<(PathDirection, usize)>, ) -> &mut Self

Adds oval to Path, appending Verb::Move, four Verb::Conic, and Verb::Close. Oval is upright ellipse bounded by Rect oval with radii equal to half oval width and half oval height. Oval begins at start and continues clockwise if dir is Direction::CW, counterclockwise if dir is Direction::CCW.

  • oval - bounds of ellipse added
  • dir - Direction to wind ellipse
  • start - index of initial point of ellipse

Returns: reference to Path

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

Source

pub fn add_circle( &mut self, p: impl Into<Point>, radius: scalar, dir: impl Into<Option<PathDirection>>, ) -> &mut Self

Adds circle centered at (x, y) of size radius to Path, appending Verb::Move, four Verb::Conic, and Verb::Close. Circle begins at: (x + radius, y), continuing clockwise if dir is Direction::CW, and counterclockwise if dir is Direction::CCW.

Has no effect if radius is zero or negative.

  • p - center of circle
  • radius - distance from center to edge
  • dir - Direction to wind circle

Returns: reference to Path

Source

pub fn add_arc( &mut self, oval: impl AsRef<Rect>, start_angle: scalar, sweep_angle: scalar, ) -> &mut Self

Appends arc to Path, as the start of new contour. Arc added is part of ellipse bounded by oval, from start_angle through sweep_angle. Both start_angle and sweep_angle are measured in degrees, where zero degrees is aligned with the positive x-axis, and positive sweeps extends arc clockwise.

If sweep_angle <= -360, or sweep_angle >= 360; and start_angle modulo 90 is nearly zero, append oval instead of arc. Otherwise, sweep_angle values are treated modulo 360, and arc may or may not draw depending on numeric rounding.

  • oval - bounds of ellipse containing arc
  • start_angle - starting angle of arc in degrees
  • sweep_angle - sweep, in degrees. Positive is clockwise; treated modulo 360

Returns: reference to Path

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

Source

pub fn add_round_rect( &mut self, rect: impl AsRef<Rect>, (rx, ry): (scalar, scalar), dir: impl Into<Option<PathDirection>>, ) -> &mut Self

Appends RRect to Path, creating a new closed contour. RRect has bounds equal to rect; each corner is 90 degrees of an ellipse with radii (rx, ry). If dir is Direction::CW, RRect starts at top-left of the lower-left corner and winds clockwise. If dir is Direction::CCW, RRect starts at the bottom-left of the upper-left corner and winds counterclockwise.

If either rx or ry is too large, rx and ry are scaled uniformly until the corners fit. If rx or ry is less than or equal to zero, add_round_rect() appends Rect rect to Path.

After appending, Path may be empty, or may contain: Rect, oval, or RRect.

  • rect - bounds of RRect
  • rx - x-axis radius of rounded corners on the RRect
  • ry - y-axis radius of rounded corners on the RRect
  • dir - Direction to wind RRect

Returns: reference to Path

Source

pub fn add_rrect( &mut self, rrect: impl AsRef<RRect>, dir_start: Option<(PathDirection, usize)>, ) -> &mut Self

Adds rrect to Path, creating a new closed contour. If dir is Direction::CW, rrect winds clockwise; if dir is Direction::CCW, rrect winds counterclockwise. start determines the first point of rrect to add.

  • rrect - bounds and radii of rounded rectangle
  • dir - PathDirection to wind RRect
  • start - index of initial point of RRect

Returns: reference to Path

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

Source

pub fn add_poly(&mut self, pts: &[Point], close: bool) -> &mut Self

Adds contour created from line array, adding pts.len() - 1 line segments. Contour added starts at pts[0], then adds a line for every additional Point in pts slice. If close is true, appends Verb::Close to Path, connecting pts[pts.len() - 1] and pts[0].

If count is zero, append Verb::Move to path. Has no effect if ps.len() is less than one.

  • pts - slice of line sharing end and start Point
  • close - true to add line connecting contour end and start

Returns: reference to Path

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

Source

pub fn add_path( &mut self, src: &Path, d: impl Into<Vector>, mode: impl Into<Option<AddPathMode>>, ) -> &mut Self

Appends src to Path, offset by (d.x, d.y).

If mode is AddPathMode::Append, src verb array, Point array, and conic weights are added unaltered. If mode is AddPathMode::Extend, add line before appending verbs, Point, and conic weights.

Returns: reference to Path

Source

pub fn add_path_matrix( &mut self, src: &Path, matrix: &Matrix, mode: impl Into<Option<AddPathMode>>, ) -> &mut Self

Appends src to Path, transformed by matrix. Transformed curves may have different verbs, Point, and conic weights.

If mode is AddPathMode::Append, src verb array, Point array, and conic weights are added unaltered. If mode is AddPathMode::Extend, add line before appending verbs, Point, and conic weights.

Returns: reference to Path

Source

pub fn reverse_add_path(&mut self, src: &Path) -> &mut Self

Appends src to Path, from back to front. Reversed src always appends a new contour to Path.

  • src - Path verbs, Point, and conic weights to add

Returns: reference to Path

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

Source

pub fn with_offset(&self, d: impl Into<Vector>) -> Path

Offsets Point array by (d.x, d.y).

  • dx - offset added to Point array x-axis coordinates
  • dy - offset added to Point array y-axis coordinates

Returns: overwritten, translated copy of Path; may be None

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

Source

pub fn offset(&mut self, d: impl Into<Vector>) -> &mut Self

Offsets Point array by (d.x, d.y). Path is replaced by offset data.

  • d.x - offset added to Point array x-axis coordinates
  • d.y - offset added to Point array y-axis coordinates
Source

pub fn with_transform(&self, matrix: &Matrix) -> Path

Transforms verb array, Point array, and weight by matrix. transform may change verbs and increase their number.

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

Source

pub fn with_transform_with_perspective_clip( &self, matrix: &Matrix, perspective_clip: ApplyPerspectiveClip, ) -> Path

Transforms verb array, Point array, and weight by matrix. transform may change verbs and increase their number.

  • matrix - Matrix to apply to Path
  • pc - whether to apply perspective clipping

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

Source

pub fn transform(&mut self, matrix: &Matrix) -> &mut Self

Transforms verb array, Point array, and weight by matrix. transform may change verbs and increase their number.

Source

pub fn transform_with_perspective_clip( &mut self, matrix: &Matrix, pc: ApplyPerspectiveClip, ) -> &mut Self

Transforms verb array, Point array, and weight by matrix. transform may change verbs and increase their number.

  • matrix - Matrix to apply to Path
  • pc - whether to apply perspective clipping
Source

pub fn make_transform( &mut self, m: &Matrix, pc: impl Into<Option<ApplyPerspectiveClip>>, ) -> Path

Source

pub fn make_scale(&mut self, (sx, sy): (scalar, scalar)) -> Path

Source

pub fn last_pt(&self) -> Option<Point>

Returns last point on Path. Returns None if Point array is empty, storing (0, 0) if last_pt is not None.

Returns final Point in Point array; may be None Returns: Some if Point array contains one or more Point

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

Source

pub fn set_last_pt(&mut self, p: impl Into<Point>) -> &mut Self

Sets the last point on the path. If Point array is empty, append Verb::Move to verb array and append p to Point array.

  • p - set value of last point
Source

pub fn segment_masks(&self) -> SegmentMask

Returns a mask, where each set bit corresponds to a SegmentMask constant if Path contains one or more verbs of that type. Returns zero if Path contains no lines, or curves: quads, conics, or cubics.

segment_masks() returns a cached result; it is very fast.

Returns: SegmentMask bits or zero

Source

pub fn contains(&self, p: impl Into<Point>) -> bool

Returns true if the point (p.x, p.y) is contained by Path, taking into account FillType.

  • p.x - x-axis value of containment test
  • p.y - y-axis value of containment test

Returns: true if Point is in Path

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

Source

pub fn dump_as_data(&self, dump_as_hex: bool) -> Data

Writes text representation of Path to Data. Set dump_as_hex true to generate exact binary representations of floating point numbers used in Point array and conic weights.

  • dump_as_hex - true if scalar values are written as hexadecimal

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

Source

pub fn dump(&self)

Source

pub fn dump_hex(&self)

Source

pub fn dump_arrays_as_data(&self, dump_as_hex: bool) -> Data

Source

pub fn dump_arrays(&self)

Source

pub fn serialize(&self) -> Data

Writes Path to buffer, returning the buffer written to, wrapped in Data.

serialize() writes FillType, verb array, Point array, conic weight, and additionally writes computed information like convexity and bounds.

serialize() should only be used in concert with read_from_memory(). The format used for Path in memory is not guaranteed.

Returns: Path data wrapped in Data buffer

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

Source

pub fn deserialize(data: &Data) -> Option<Path>

Source

pub fn generation_id(&self) -> u32

(See Skia bug 1762.) Returns a non-zero, globally unique value. A different value is returned if verb array, Point array, or conic weight changes.

Setting FillType does not change generation identifier.

Each time the path is modified, a different generation identifier will be returned. FillType does affect generation identifier on Android framework.

Returns: non-zero, globally unique value

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

Source

pub fn is_valid(&self) -> bool

Returns if Path data is consistent. Corrupt Path data is detected if internal values are out of range or internal storage does not match array dimensions.

Returns: true if Path data is consistent

Source§

impl Handle<SkPathBuilder>

Source

pub fn new() -> Self

Source

pub fn new_path(path: &Path) -> Self

Source

pub fn fill_type(&self) -> PathFillType

Source

pub fn compute_bounds(&self) -> Rect

Source

pub fn snapshot(&self) -> Path

Source

pub fn detach(&mut self) -> Path

Source

pub fn set_fill_type(&mut self, ft: PathFillType) -> &mut Self

Source

pub fn set_is_volatile(&mut self, is_volatile: bool) -> &mut Self

Source

pub fn reset(&mut self) -> &mut Self

Source

pub fn move_to(&mut self, pt: impl Into<Point>) -> &mut Self

Source

pub fn line_to(&mut self, pt: impl Into<Point>) -> &mut Self

Source

pub fn quad_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, ) -> &mut Self

Source

pub fn conic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, w: scalar, ) -> &mut Self

Source

pub fn cubic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, ) -> &mut Self

Source

pub fn close(&mut self) -> &mut Self

Source

pub fn polyline_to(&mut self, points: &[Point]) -> &mut Self

Source

pub fn r_line_to(&mut self, pt: impl Into<Point>) -> &mut Self

Source

pub fn r_quad_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, ) -> &mut Self

Source

pub fn r_conic_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, w: scalar, ) -> &mut Self

Source

pub fn r_cubic_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, pt3: impl Into<Point>, ) -> &mut Self

Source

pub fn arc_to( &mut self, oval: impl AsRef<Rect>, start_angle_deg: scalar, sweep_angle_deg: scalar, force_move_to: bool, ) -> &mut Self

Source

pub fn arc_to_tangent( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, radius: scalar, ) -> &mut Self

Source

pub fn arc_to_radius( &mut self, r: impl Into<Point>, x_axis_rotate: scalar, large_arc: ArcSize, sweep: PathDirection, xy: impl Into<Point>, ) -> &mut Self

Source

pub fn add_arc( &mut self, oval: impl AsRef<Rect>, start_angle_deg: scalar, sweep_angle_deg: scalar, ) -> &mut Self

Source

pub fn add_rect( &mut self, rect: impl AsRef<Rect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self

Source

pub fn add_oval( &mut self, rect: impl AsRef<Rect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self

Source

pub fn add_rrect( &mut self, rect: impl AsRef<RRect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self

Source

pub fn add_circle( &mut self, center: impl Into<Point>, radius: scalar, dir: impl Into<Option<PathDirection>>, ) -> &mut Self

Source

pub fn add_polygon(&mut self, pts: &[Point], is_closed: bool) -> &mut Self

Source

pub fn add_path(&mut self, path: &Path) -> &mut Self

Source

pub fn inc_reserve(&mut self, extra_pt_count: usize, extra_verb_count: usize)

Source

pub fn offset(&mut self, d: impl Into<Vector>) -> &mut Self

Source

pub fn toggle_inverse_fill_type(&mut self) -> &mut Self

Source

pub fn make( _points: &[Point], _verbs: &[u8], _conic_weights: &[scalar], _fill_type: PathFillType, _is_volatile: impl Into<Option<bool>>, ) -> !

👎Deprecated since 0.35.0: Removed without replacement
Source§

impl Handle<SkPathMeasure>

Warning: Even if you pass in a PathMeasure with multiple contours, most of this struct’s functions, including length only return the value for the first contour on the path (which is why they aren’t const). You must exhaust PathMeasure::next_contour.

use skia_safe::{PathMeasure, Point, Path};
use std::f64::consts::PI;
let mut path = Path::circle((0., 0.), 10.0, None);
path.add_path(&Path::circle((100., 100.), 27.0, None), Point::default(), None);
let mut measure = PathMeasure::new(&path, false, None);
let mut lengths = vec![measure.length()];
while measure.next_contour() {
    lengths.push(measure.length());
}
assert_eq!(*lengths.first().unwrap() as i64, (2. * PI * 10.0) as i64);
assert_eq!(*lengths.get(1).unwrap() as i64, (2. * PI * 27.0) as i64);
eprintln!("Circle lengths: {:?}", &lengths);
Source

pub fn new( path: &Path, force_closed: bool, res_scale: impl Into<Option<scalar>>, ) -> Self

Source

pub fn from_path( path: &Path, force_closed: bool, res_scale: impl Into<Option<scalar>>, ) -> Self

👎Deprecated since 0.48.0: Use PathMeasure::new
Source

pub fn set_path(&mut self, path: &Path, force_closed: bool) -> &mut Self

Source

pub fn length(&mut self) -> scalar

Source

pub fn pos_tan(&mut self, distance: scalar) -> Option<(Point, Vector)>

Source

pub fn matrix( &mut self, distance: scalar, flags: impl Into<Option<MatrixFlags>>, ) -> Option<Matrix>

Source

pub fn segment( &mut self, start_d: scalar, stop_d: scalar, start_with_move_to: bool, ) -> Option<Path>

Source

pub fn is_closed(&mut self) -> bool

Source

pub fn next_contour(&mut self) -> bool

Source

pub fn current_measure(&self) -> &Option<ContourMeasure>

Source§

impl Handle<SkPictureRecorder>

Source

pub fn new() -> Self

Source

pub fn begin_recording( &mut self, bounds: impl AsRef<Rect>, bbh_factory: Option<&mut BBHFactory>, ) -> &Canvas

Source

pub fn recording_canvas(&mut self) -> Option<&Canvas>

Source

pub fn finish_recording_as_picture( &mut self, cull_rect: Option<&Rect>, ) -> Option<Picture>

Source

pub fn finish_recording_as_drawable(&mut self) -> Option<Drawable>

Source§

impl Handle<SkRegion>

Source

pub fn new() -> Region

Source

pub fn from_rect(rect: impl AsRef<IRect>) -> Region

Source

pub fn set(&mut self, src: &Region) -> bool

Source

pub fn swap(&mut self, other: &mut Region)

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_rect(&self) -> bool

Source

pub fn is_complex(&self) -> bool

Source

pub fn bounds(&self) -> &IRect

Source

pub fn compute_region_complexity(&self) -> usize

Source

pub fn get_boundary_path(&self, path: &mut Path) -> bool

Source

pub fn set_empty(&mut self) -> bool

Source

pub fn set_rect(&mut self, rect: impl AsRef<IRect>) -> bool

Source

pub fn set_rects(&mut self, rects: &[IRect]) -> bool

Source

pub fn set_region(&mut self, region: &Region) -> bool

Source

pub fn set_path(&mut self, path: &Path, clip: &Region) -> bool

Source

pub fn intersects_rect(&self, rect: impl AsRef<IRect>) -> bool

Source

pub fn intersects_region(&self, other: &Region) -> bool

Source

pub fn contains_point(&self, point: IPoint) -> bool

Source

pub fn contains_rect(&self, rect: impl AsRef<IRect>) -> bool

Source

pub fn contains_region(&self, other: &Region) -> bool

Source

pub fn quick_contains(&self, r: impl AsRef<IRect>) -> bool

Source

pub fn quick_reject_rect(&self, rect: impl AsRef<IRect>) -> bool

Source

pub fn quick_reject_region(&self, rgn: &Region) -> bool

Source

pub fn translate(&mut self, d: impl Into<IVector>)

Source

pub fn translated(&self, d: impl Into<IVector>) -> Self

Source

pub fn op_rect(&mut self, rect: impl AsRef<IRect>, op: RegionOp) -> bool

Source

pub fn op_region(&mut self, region: &Region, op: RegionOp) -> bool

Source

pub fn op_rect_region( &mut self, rect: impl AsRef<IRect>, region: &Region, op: RegionOp, ) -> bool

Source

pub fn op_region_rect( &mut self, region: &Region, rect: impl AsRef<IRect>, op: RegionOp, ) -> bool

Source

pub fn write_to_memory(&self, buf: &mut Vec<u8>)

Source

pub fn read_from_memory(&mut self, buf: &[u8]) -> usize

Source§

impl Handle<SkStrokeRec>

Source

pub fn new(init_style: InitStyle) -> Self

Source

pub fn new_hairline() -> Self

Source

pub fn new_fill() -> Self

Source

pub fn from_paint( paint: &Paint, style: impl Into<Option<Style>>, res_scale: impl Into<Option<scalar>>, ) -> Self

Source

pub fn style(&self) -> Style

Source

pub fn width(&self) -> scalar

Source

pub fn miter(&self) -> scalar

Source

pub fn cap(&self) -> Cap

Source

pub fn join(&self) -> Join

Source

pub fn is_hairline_style(&self) -> bool

Source

pub fn is_fill_style(&self) -> bool

Source

pub fn set_fill_style(&mut self) -> &mut Self

Source

pub fn set_hairline_style(&mut self) -> &mut Self

Source

pub fn set_stroke_style( &mut self, width: scalar, stroke_and_fill: impl Into<Option<bool>>, ) -> &mut Self

Source

pub fn set_stroke_params( &mut self, cap: Cap, join: Join, miter_limit: scalar, ) -> &mut Self

Source

pub fn res_scale(&self) -> scalar

Source

pub fn set_res_scale(&mut self, rs: scalar)

Source

pub fn need_to_apply(&self) -> bool

Source

pub fn apply_to_path(&self, dst: &mut Path, src: &Path) -> bool

Source

pub fn apply_to_path_inplace(&self, path: &mut Path) -> bool

Source

pub fn apply_to_paint(&self, paint: &mut Paint)

Source

pub fn inflation_radius(&self) -> scalar

Source

pub fn inflation_radius_from_paint_and_style( paint: &Paint, style: Style, ) -> scalar

Source

pub fn inflation_radius_from_params( join: Join, miter_limit: scalar, cap: Cap, stroke_width: scalar, ) -> scalar

Source

pub fn has_equal_effect(&self, other: &StrokeRec) -> bool

Source§

impl Handle<SkTextBlobBuilder>

Source

pub fn new() -> Self

Source

pub fn make(&mut self) -> Option<TextBlob>

Source

pub fn alloc_run( &mut self, font: &Font, count: usize, offset: impl Into<Point>, bounds: Option<&Rect>, ) -> &mut [GlyphId]

Source

pub fn alloc_run_pos_h( &mut self, font: &Font, count: usize, y: scalar, bounds: Option<&Rect>, ) -> (&mut [GlyphId], &mut [scalar])

Source

pub fn alloc_run_pos( &mut self, font: &Font, count: usize, bounds: Option<&Rect>, ) -> (&mut [GlyphId], &mut [Point])

Source

pub fn alloc_run_rsxform( &mut self, font: &Font, count: usize, ) -> (&mut [GlyphId], &mut [RSXform])

Source

pub fn alloc_run_text( &mut self, font: &Font, count: usize, offset: impl Into<Point>, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [GlyphId], &mut [u8], &mut [u32])

Source

pub fn alloc_run_text_pos_h( &mut self, font: &Font, count: usize, y: scalar, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [GlyphId], &mut [scalar], &mut [u8], &mut [u32])

Source

pub fn alloc_run_text_pos( &mut self, font: &Font, count: usize, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [GlyphId], &mut [Point], &mut [u8], &mut [u32])

Source

pub fn alloc_run_text_rsxform( &mut self, font: &Font, count: usize, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [GlyphId], &mut [RSXform], &mut [u8], &mut [u32])

Source§

impl Handle<SkVertices_Builder>

Source

pub fn new( mode: VertexMode, vertex_count: usize, index_count: usize, flags: BuilderFlags, ) -> Builder

Source

pub fn positions(&mut self) -> &mut [Point]

Source

pub fn indices(&mut self) -> Option<&mut [u16]>

Source

pub fn tex_coords(&mut self) -> Option<&mut [Point]>

Source

pub fn colors(&mut self) -> Option<&mut [Color]>

Source

pub fn is_volatile(&self) -> bool

👎Deprecated since 0.29.0: returns false
Source

pub fn bone_indices(&mut self) -> Option<&mut [BoneIndices]>

👎Deprecated since 0.29.0: returns None
Source

pub fn bone_weights(&mut self) -> Option<&mut [BoneWeights]>

👎Deprecated since 0.29.0: returns None
Source

pub fn detach(self) -> Vertices

Source§

impl Handle<SkYUVAInfo>

Source

pub const MAX_PLANES: usize = 4usize

Source

pub fn new( dimensions: impl Into<ISize>, config: PlaneConfig, subsampling: Subsampling, color_space: YUVColorSpace, origin: impl Into<Option<EncodedOrigin>>, siting_xy: impl Into<Option<(Siting, Siting)>>, ) -> Option<Self>

dimensions should specify the size of the full resolution image (after planes have been oriented to how the image is displayed as indicated by origin).

Source

pub fn plane_config(&self) -> PlaneConfig

Source

pub fn subsampling(&self) -> Subsampling

Source

pub fn plane_subsampling_factors(&self, plane_index: usize) -> (i32, i32)

Source

pub fn dimensions(&self) -> ISize

Dimensions of the full resolution image (after planes have been oriented to how the image is displayed as indicated by fOrigin).

Source

pub fn width(&self) -> i32

Source

pub fn height(&self) -> i32

Source

pub fn yuv_color_space(&self) -> YUVColorSpace

Source

pub fn siting_xy(&self) -> (Siting, Siting)

Source

pub fn origin(&self) -> EncodedOrigin

Source

pub fn origin_matrix(&self) -> Matrix

Source

pub fn has_alpha(&self) -> bool

Source

pub fn plane_dimensions(&self) -> Vec<ISize>

Returns the dimensions for each plane. Dimensions are as stored in memory, before transformation to image display space as indicated by [origin(&self)].

Source

pub fn compute_total_bytes( &self, row_bytes: &[usize; 4], plane_sizes: Option<&mut [usize; 4]>, ) -> usize

Given a per-plane row bytes, determine size to allocate for all planes. Optionally retrieves the per-plane byte sizes in planeSizes if not None. If total size overflows will return SIZE_MAX and set all planeSizes to SIZE_MAX.

Source

pub fn num_planes(&self) -> usize

Source

pub fn num_channels_in_plane(&self, i: usize) -> Option<usize>

Source

pub fn with_subsampling(&self, subsampling: Subsampling) -> Option<Self>

Returns a YUVAInfo that is identical to this one but with the passed Subsampling. If the passed Subsampling is not Subsampling::S444 and this info’s PlaneConfig is not compatible with chroma subsampling (because Y is in the same plane as UV) then the result will be None.

Source

pub fn with_dimensions(&self, dimensions: impl Into<ISize>) -> Option<Self>

Returns a YUVAInfo that is identical to this one but with the passed dimensions. If the passed dimensions is empty then the result will be None.

Source§

impl Handle<SkYUVAPixmapInfo_SupportedDataTypes>

Source

pub fn all() -> Self

All legal combinations of PlaneConfig and DataType are supported.

Source

pub fn supported(&self, pc: PlaneConfig, dt: DataType) -> bool

Checks whether there is a supported combination of color types for planes structured as indicated by PlaneConfig with channel data types as indicated by DataType.

Source

pub fn enable_data_type(&mut self, dt: DataType, num_channels: usize)

Update to add support for pixmaps with num_channels channels where each channel is represented as DataType.

Source§

impl Handle<SkYUVAPixmapInfo>

Source

pub const MAX_PLANES: usize = 4usize

Source

pub const DATA_TYPE_CNT: usize = 3usize

Source

pub fn new( info: &YUVAInfo, color_types: &[ColorType], row_bytes: Option<&[usize]>, ) -> Option<Self>

Initializes the YUVAPixmapInfo from a YUVAInfo with per-plane color types and row bytes. This will return None if the colorTypes aren’t compatible with the YUVAInfo or if a rowBytes entry is not valid for the plane dimensions and color type. Color type and row byte values beyond the number of planes in YUVAInfo are ignored. All ColorTypes must have the same DataType or this will return None.

If rowBytes is None then bpp*width is assumed for each plane.

Source

pub fn from_data_type( info: &YUVAInfo, data_type: DataType, row_bytes: Option<&[usize]>, ) -> Option<Self>

Like above but uses yuva_pixmap_info::default_color_type_for_data_type to determine each plane’s ColorType. If rowBytes is None then bpp*width is assumed for each plane.

Source

pub fn yuva_info(&self) -> &YUVAInfo

Source

pub fn yuv_color_space(&self) -> YUVColorSpace

Source

pub fn num_planes(&self) -> usize

The number of Pixmap planes.

Source

pub fn data_type(&self) -> DataType

The per-YUV[A] channel data type.

Source

pub fn row_bytes(&self, i: usize) -> Option<usize>

Row bytes for the ith plane. Returns None if i >= Self::num_planes() or this YUVAPixmapInfo is invalid.

Source

pub fn row_bytes_iter(&self) -> impl Iterator<Item = usize> + use<'_>

Row bytes for all planes.

Source

pub fn plane_info(&self, i: usize) -> Option<&ImageInfo>

Image info for the ith plane, or None if i >= Self::num_planes()

Source

pub fn plane_infos(&self) -> impl Iterator<Item = &ImageInfo>

An iterator of all planes’ image infos.

Source

pub fn compute_total_bytes(&self, plane_sizes: Option<&mut [usize; 4]>) -> usize

Determine size to allocate for all planes. Optionally retrieves the per-plane sizes in planeSizes if not None. If total size overflows will return SIZE_MAX and set all plane_sizes to SIZE_MAX.

Source

pub unsafe fn init_pixmaps_from_single_allocation( &self, memory: *mut c_void, ) -> Option<[Pixmap<'_>; 4]>

Takes an allocation that is assumed to be at least [compute_total_bytes(&self)] in size and configures the first [numPlanes(&self)] entries in pixmaps array to point into that memory. The remaining entries of pixmaps are default initialized. Returns None if this YUVAPixmapInfo not valid.

Source

pub fn is_supported(&self, data_types: &SupportedDataTypes) -> bool

Is this valid and does it use color types allowed by the passed SupportedDataTypes?

Source§

impl Handle<SkYUVAPixmaps>

Source

pub const MAX_PLANES: usize = 4usize

Source

pub fn recommended_rgba_color_type(dt: DataType) -> ColorType

Source

pub fn allocate(info: &YUVAPixmapInfo) -> Option<Self>

Allocate space for pixmaps’ pixels in the YUVAPixmaps.

Source

pub fn from_data(info: &YUVAPixmapInfo, data: impl Into<Data>) -> Option<Self>

Use storage in Data as backing store for pixmaps’ pixels. Data is retained by the YUVAPixmaps.

Source

pub unsafe fn from_external_memory( info: &YUVAPixmapInfo, memory: *mut c_void, ) -> Option<Self>

Use passed in memory as backing store for pixmaps’ pixels. Caller must ensure memory remains allocated while pixmaps are in use. There must be at least [YUVAPixmapInfo::computeTotalBytes(&self)] allocated starting at memory.

Source

pub unsafe fn from_external_pixmaps( info: &YUVAInfo, pixmaps: &[Pixmap<'_>; 4], ) -> Option<Self>

Wraps existing Pixmaps. The YUVAPixmaps will have no ownership of the Pixmaps’ pixel memory so the caller must ensure it remains valid. Will return None if the YUVAInfo isn’t compatible with the Pixmap array (number of planes, plane dimensions, sufficient color channels in planes, …).

Source

pub fn yuva_info(&self) -> &YUVAInfo

Source

pub fn data_type(&self) -> DataType

Source

pub fn pixmaps_info(&self) -> YUVAPixmapInfo

Source

pub fn num_planes(&self) -> usize

Number of pixmap planes.

Source

pub fn planes(&self) -> &[Pixmap<'_>]

Access the Pixmap planes.

Source

pub fn plane(&self, i: usize) -> &Pixmap<'_>

Get the ith Pixmap plane. Pixmap will be default initialized if i >= numPlanes.

Source§

impl Handle<SkPDF_AttributeList>

Attributes for nodes in the PDF tree.

Each attribute must have an owner (e.g. “Layout”, “List”, “Table”, etc) and an attribute name (e.g. “BBox”, “RowSpan”, etc.) from PDF32000_2008 14.8.5, and then a value of the proper type according to the spec.

Source

pub fn append_int( &mut self, owner: impl AsRef<str>, name: impl AsRef<str>, value: i32, ) -> &mut Self

Source

pub fn append_float( &mut self, owner: impl AsRef<str>, name: impl AsRef<str>, value: f32, ) -> &mut Self

Source

pub fn append_float_array( &mut self, owner: impl AsRef<str>, name: impl AsRef<str>, value: &[f32], ) -> &mut Self

Source§

impl Handle<SkColorMatrix>

Source

pub fn new( m00: f32, m01: f32, m02: f32, m03: f32, m04: f32, m10: f32, m11: f32, m12: f32, m13: f32, m14: f32, m20: f32, m21: f32, m22: f32, m23: f32, m24: f32, m30: f32, m31: f32, m32: f32, m33: f32, m34: f32, ) -> Self

Source

pub fn rgb_to_yuv(rgb: YUVColorSpace) -> Self

Source

pub fn yuv_to_rgb(yuv: YUVColorSpace) -> Self

Source

pub fn set_identity(&mut self)

Source

pub fn set_scale( &mut self, r_scale: f32, g_scale: f32, b_scale: f32, a_scale: impl Into<Option<f32>>, )

Source

pub fn post_translate(&mut self, dr: f32, dg: f32, db: f32, da: f32)

Source

pub fn set_concat(&mut self, a: &ColorMatrix, b: &ColorMatrix)

Source

pub fn pre_concat(&mut self, mat: &ColorMatrix)

Source

pub fn post_concat(&mut self, mat: &ColorMatrix)

Source

pub fn set_saturation(&mut self, sat: f32)

Source

pub fn set_row_major(&mut self, src: &[f32; 20])

Source

pub fn get_row_major(&self, dst: &mut [f32; 20])

Source§

impl Handle<SkRuntimeEffect_Uniform>

Source

pub fn name(&self) -> &str

Source

pub fn offset(&self) -> usize

Source

pub fn ty(&self) -> Type

Source

pub fn count(&self) -> i32

Source

pub fn flags(&self) -> Flags

Source

pub fn is_array(&self) -> bool

Source

pub fn is_color(&self) -> bool

Source

pub fn size_in_bytes(&self) -> usize

Source§

impl Handle<SkRuntimeEffect_Child>

Source

pub fn name(&self) -> &str

Source

pub fn ty(&self) -> ChildType

Source

pub fn index(&self) -> usize

Source§

impl Handle<SkRuntimeEffectBuilder>

Source

pub fn new(effect: RuntimeEffect) -> Self

Source

pub fn make_shader(&self, local_matrix: &Matrix) -> Option<Shader>

Source

pub fn set_uniform_float( &mut self, name: impl AsRef<str>, data: &[f32], ) -> Result<(), ShaderBuilderError>

Set float uniform values by name.

Supported types are float, float2, float3, float4, float2x2, float3x3, float4x4.

The data array must have the correct length for the corresponding uniform type:

  • float: [f32; 1]
  • float2: [f32; 2]
  • float3: [f32; 3]
  • float4: [f32; 4]
  • float2x2: [f32; 4]
  • float3x3: [f32; 9]
  • float4x4: [f32; 16]
Source

pub fn set_uniform_int( &mut self, name: impl AsRef<str>, data: &[i32], ) -> Result<(), ShaderBuilderError>

Set int uniform values by name.

Supported types are int, int2, int3, int4.

The data array must have the correct length for the corresponding uniform type:

  • int: [i32; 1]
  • int2: [i32; 2]
  • int3: [i32; 3]
  • int4: [i32; 4]
Source§

impl Handle<SkBitmap>

Source

pub fn encode( &self, format: EncodedImageFormat, quality: impl Into<Option<u32>>, ) -> Option<Vec<u8>>

Source§

impl Handle<GrBackendFormat>

Source

pub fn new() -> Self

👎Deprecated since 0.37.0: The creation of invalid BackendFormats isn’t supported anymore
Source

pub fn new_gl(format: Enum, target: Enum) -> Self

Source

pub fn new_vulkan( format: Format, will_use_drm_format_modifiers: impl Into<Option<bool>>, ) -> Self

👎Deprecated since 0.67.0: use gpu::backend_formats::make_vk()
Source

pub fn new_vulkan_ycbcr( conversion_info: &YcbcrConversionInfo, will_use_drm_format_modifiers: impl Into<Option<bool>>, ) -> Self

👎Deprecated since 0.67.0: use gpu::backend_formats::make_vk_ycbcr()
Source

pub fn new_metal(format: PixelFormat) -> Self

👎Deprecated since 0.74.0: use gpu::backend_formats::make_mtl()
Source

pub fn backend(&self) -> BackendAPI

Source

pub fn channel_mask(&self) -> u32

Source

pub fn as_gl_format(&self) -> Format

Source

pub fn as_gl_format_enum(&self) -> Enum

Source

pub fn as_vk_format(&self) -> Option<Format>

Source

pub fn as_mtl_format(&self) -> Option<PixelFormat>

Source

pub fn to_texture_2d(&self) -> Self

Source

pub fn is_valid(&self) -> bool

👎Deprecated since 0.37.0: Invalid BackendFormats are not supported anymore
Source§

impl Handle<GrBackendRenderTarget>

Source

pub fn new_gl( (width, height): (i32, i32), sample_count: impl Into<Option<usize>>, stencil_bits: usize, info: FramebufferInfo, ) -> Self

👎Deprecated since 0.67.0: use gpu::backend_render_targets::make_gl()
Source

pub fn new_vulkan((width, height): (i32, i32), info: &ImageInfo) -> Self

👎Deprecated since 0.67.0: use gpu::backend_render_targets::make_vk()
Source

pub fn new_metal((width, height): (i32, i32), mtl_info: &TextureInfo) -> Self

👎Deprecated since 0.74.0: use gpu::backend_render_targets::make_mtl()
Source

pub fn dimensions(&self) -> ISize

Source

pub fn width(&self) -> i32

Source

pub fn height(&self) -> i32

Source

pub fn sample_count(&self) -> usize

Source

pub fn stencil_bits(&self) -> usize

Source

pub fn backend(&self) -> BackendAPI

Source

pub fn is_framebuffer_only(&self) -> bool

Source

pub fn gl_framebuffer_info(&self) -> Option<FramebufferInfo>

Source

pub fn vulkan_image_info(&self) -> Option<ImageInfo>

Source

pub fn set_vulkan_image_layout(&mut self, layout: ImageLayout) -> &mut Self

Source

pub fn metal_texture_info(&self) -> Option<TextureInfo>

Source

pub fn backend_format(&self) -> BackendFormat

Source

pub fn set_mutable_state(&mut self, state: &MutableTextureState)

Source

pub fn is_protected(&self) -> bool

Source

pub fn is_valid(&self) -> bool

👎Deprecated since 0.37.0: Exposed BackendRenderTargets are always valid.
Source§

impl Handle<GrGLExtensions>

Source

pub fn is_initialized(&self) -> bool

Source

pub fn has(&self, extension: impl AsRef<str>) -> bool

Source

pub fn remove(&mut self, extension: impl AsRef<str>) -> bool

Source

pub fn add(&mut self, extension: impl AsRef<str>)

Source

pub fn reset(&mut self)

Source§

impl Handle<GrMtlBackendContext>

Source

pub unsafe fn new(device: Handle, queue: Handle) -> Self

§Safety

Unsafe because it expects various objects in form of c_void pointers.

This function retains all the non-null handles passed to it and releases them as soon the BackendContext is dropped.

Source§

impl Handle<GrMtlTextureInfo>

Source

pub unsafe fn new(texture: Handle) -> Self

§Safety

Unsafe because the texture provided must either be null or pointing to a Metal texture by providing a raw pointer.

This function retains the texture and releases it as soon TextureInfo is dropped.

Source

pub fn texture(&self) -> Handle

Source§

impl Handle<GrBackendDrawableInfo>

Source

pub fn new() -> Self

Source

pub fn from_vk(info: &DrawableInfo) -> Self

Source

pub fn is_valid(&self) -> bool

Source

pub fn backend(&self) -> BackendAPI

Source

pub fn get_vk_drawable_info(&self) -> Option<DrawableInfo>

Source§

impl Handle<GrYUVABackendTextureInfo>

Source

pub const MAX_PLANES: usize = 4usize

Source

pub fn new( info: &YUVAInfo, formats: &[BackendFormat], mip_mapped: Mipmapped, origin: SurfaceOrigin, ) -> Option<Self>

Initializes a YUVABackendTextureInfo to describe a set of textures that can store the planes indicated by the YUVAInfo. The texture dimensions are taken from the YUVAInfo’s plane dimensions. All the described textures share a common origin. The planar image this describes will be mip mapped if all the textures are individually mip mapped as indicated by Mipmapped. This will return None if the passed formats’ channels don’t agree with YUVAInfo.

Source

pub fn yuva_info(&self) -> &YUVAInfo

Source

pub fn yuv_color_space(&self) -> YUVColorSpace

Source

pub fn mipmapped(&self) -> Mipmapped

Source

pub fn texture_origin(&self) -> SurfaceOrigin

Source

pub fn num_planes(&self) -> usize

The number of crate::Pixmap planes.

Source

pub fn plane_format(&self, i: usize) -> Option<&BackendFormat>

Format of the ith plane, or None if i >= Self::num_planes()

Source

pub fn plane_formats(&self) -> &[BackendFormat]

All plane formats.

Source§

impl Handle<GrYUVABackendTextures>

Source

pub fn new( info: &YUVAInfo, textures: &[BackendTexture], texture_origin: SurfaceOrigin, ) -> Option<Self>

Source

pub fn textures(&self) -> Vec<BackendTexture>

Source

pub fn texture(&self, i: usize) -> Option<BackendTexture>

Source

pub fn yuva_info(&self) -> &YUVAInfo

Source

pub fn num_planes(&self) -> usize

Source

pub fn texture_origin(&self) -> SurfaceOrigin

Source§

impl Handle<SkDynamicMemoryWStream>

Source

pub fn new() -> Self

Source

pub fn from_bytes(bytes: &[u8]) -> Self

Source

pub fn write(&mut self, bytes: &[u8]) -> bool

Source

pub fn detach_as_data(&mut self) -> Data

Source

pub fn detach_as_stream(&mut self) -> Stream<SkStreamAsset>

Source§

impl Handle<SkString>

Source

pub fn from_str(str: impl AsRef<str>) -> Handle<SkString>

Source

pub fn as_str(&self) -> &str

Source§

impl Handle<SkStrings>

Source

pub fn new(strings: Vec<Handle<SkString>>) -> Self

Constructs a native Strings array from a slice of SkStrings by moving them.

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn as_slice(&self) -> &[Handle<SkString>]

Source§

impl Handle<skia_textlayout_FontArguments>

Source

pub fn clone_typeface(&self, typeface: impl Into<Typeface>) -> Option<Typeface>

Source§

impl Handle<skia_textlayout_Paragraph_VisitorInfo>

Source

pub fn font(&self) -> &Font

Source

pub fn origin(&self) -> Point

Source

pub fn advance_x(&self) -> scalar

Source

pub fn count(&self) -> usize

Source

pub fn glyphs(&self) -> &[u16]

Source

pub fn positions(&self) -> &[Point]

Source

pub fn utf8_starts(&self) -> &[u32]

Source

pub fn flags(&self) -> VisitorFlags

Source§

impl Handle<skia_textlayout_Paragraph_ExtendedVisitorInfo>

Source

pub fn font(&self) -> &Font

Source

pub fn origin(&self) -> Point

Source

pub fn advance(&self) -> Size

Source

pub fn count(&self) -> usize

Source

pub fn glyphs(&self) -> &[u16]

Source

pub fn positions(&self) -> &[Point]

Source

pub fn bounds(&self) -> &[Rect]

Source

pub fn utf8_starts(&self) -> &[u32]

Source

pub fn flags(&self) -> VisitorFlags

Source§

impl Handle<skia_textlayout_ParagraphCache>

Source

pub fn new() -> ParagraphCache

Source

pub fn abandon(&mut self)

Source

pub fn reset(&mut self)

Source

pub fn print_statistics(&mut self)

Source

pub fn turn_on(&mut self, value: bool)

Source

pub fn count(&mut self) -> i32

Source§

impl Handle<skia_textlayout_StrutStyle>

Source

pub fn new() -> Self

Source

pub fn font_families(&self) -> FontFamilies<'_>

Source

pub fn set_font_families(&mut self, families: &[impl AsRef<str>]) -> &mut Self

Source

pub fn font_style(&self) -> FontStyle

Source

pub fn set_font_style(&mut self, font_style: FontStyle) -> &mut Self

Source

pub fn font_size(&self) -> scalar

Source

pub fn set_font_size(&mut self, font_size: scalar) -> &mut Self

Source

pub fn set_height(&mut self, height: scalar) -> &mut Self

Source

pub fn height(&self) -> scalar

Source

pub fn set_leading(&mut self, leading: scalar) -> &mut Self

Source

pub fn leading(&self) -> scalar

Source

pub fn strut_enabled(&self) -> bool

Source

pub fn set_strut_enabled(&mut self, enabled: bool) -> &mut Self

Source

pub fn force_strut_height(&self) -> bool

Source

pub fn set_force_strut_height(&mut self, force_height: bool) -> &mut Self

Source

pub fn height_override(&self) -> bool

Source

pub fn set_height_override(&mut self, height_override: bool) -> &mut Self

Source

pub fn half_leading(&self) -> bool

Source

pub fn set_half_leading(&mut self, half_leading: bool) -> &mut Self

Source§

impl Handle<skia_textlayout_FontFeature>

Source

pub fn name(&self) -> &str

Source

pub fn value(&self) -> i32

Source§

impl Handle<skia_textlayout_TextStyle>

Source

pub fn new() -> Self

Source

pub fn to_placeholder(&self) -> Self

👎Deprecated since 0.51.0: Use clone_for_placeholder
Source

pub fn clone_for_placeholder(&self) -> Self

Source

pub fn equals(&self, other: &TextStyle) -> bool

Source

pub fn equals_by_fonts(&self, that: &TextStyle) -> bool

Source

pub fn match_one_attribute( &self, style_type: StyleType, other: &TextStyle, ) -> bool

Source

pub fn color(&self) -> Color

Source

pub fn set_color(&mut self, color: impl Into<Color>) -> &mut Self

Source

pub fn has_foreground(&self) -> bool

Source

pub fn foreground(&self) -> Paint

Source

pub fn set_foreground_paint(&mut self, paint: &Paint) -> &mut Self

Source

pub fn set_foreground_color(&mut self, paint: &Paint) -> &mut Self

👎Deprecated since 0.64.0: use set_foreground_paint()
Source

pub fn clear_foreground_color(&mut self) -> &mut Self

Source

pub fn has_background(&self) -> bool

Source

pub fn background(&self) -> Paint

Source

pub fn set_background_paint(&mut self, paint: &Paint) -> &mut Self

Source

pub fn set_background_color(&mut self, paint: &Paint) -> &mut Self

👎Deprecated since 0.64.0: use set_background_paint()
Source

pub fn clear_background_color(&mut self) -> &mut Self

Source

pub fn decoration(&self) -> &Decoration

Source

pub fn decoration_type(&self) -> TextDecoration

Source

pub fn decoration_mode(&self) -> TextDecorationMode

Source

pub fn decoration_color(&self) -> Color

Source

pub fn decoration_style(&self) -> TextDecorationStyle

Source

pub fn decoration_thickness_multiplier(&self) -> scalar

Source

pub fn set_decoration(&mut self, decoration: &Decoration)

Source

pub fn set_decoration_type(&mut self, decoration: TextDecoration)

Source

pub fn set_decoration_mode(&mut self, mode: TextDecorationMode)

Source

pub fn set_decoration_style(&mut self, style: TextDecorationStyle)

Source

pub fn set_decoration_color(&mut self, color: impl Into<Color>)

Source

pub fn set_decoration_thickness_multiplier(&mut self, multiplier: scalar)

Source

pub fn decoration_mut(&mut self) -> &mut Decoration

👎Deprecated since 0.63.1: use set_decoration()
Source

pub fn font_style(&self) -> FontStyle

Source

pub fn set_font_style(&mut self, font_style: FontStyle) -> &mut Self

Source

pub fn shadows(&self) -> &[TextShadow]

Source

pub fn add_shadow(&mut self, shadow: TextShadow) -> &mut Self

Source

pub fn reset_shadows(&mut self) -> &mut Self

Source

pub fn font_features(&self) -> &[FontFeature]

Source

pub fn add_font_feature(&mut self, font_feature: impl AsRef<str>, value: i32)

Source

pub fn reset_font_features(&mut self)

Source

pub fn font_arguments(&self) -> Option<&FontArguments>

Source

pub fn set_font_arguments<'fa>( &mut self, arguments: impl Into<Option<&'fa FontArguments<'fa, 'fa>>>, )

The contents of the crate::FontArguments will be copied into the TextStyle.

Source

pub fn font_size(&self) -> scalar

Source

pub fn set_font_size(&mut self, size: scalar) -> &mut Self

Source

pub fn font_families(&self) -> FontFamilies<'_>

Source

pub fn set_font_families(&mut self, families: &[impl AsRef<str>]) -> &mut Self

Source

pub fn baseline_shift(&self) -> scalar

Source

pub fn set_baseline_shift(&mut self, baseline_shift: scalar) -> &mut Self

Source

pub fn set_height(&mut self, height: scalar) -> &mut Self

Source

pub fn height(&self) -> scalar

Source

pub fn set_height_override(&mut self, height_override: bool) -> &mut Self

Source

pub fn height_override(&self) -> bool

Source

pub fn set_half_leading(&mut self, half_leading: bool) -> &mut Self

Source

pub fn half_leading(&self) -> bool

Source

pub fn set_letter_spacing(&mut self, letter_spacing: scalar) -> &mut Self

Source

pub fn letter_spacing(&self) -> scalar

Source

pub fn set_word_spacing(&mut self, word_spacing: scalar) -> &mut Self

Source

pub fn word_spacing(&self) -> scalar

Source

pub fn typeface(&self) -> Option<Typeface>

Source

pub fn set_typeface( &mut self, typeface: impl Into<Option<Typeface>>, ) -> &mut Self

Source

pub fn locale(&self) -> &str

Source

pub fn set_locale(&mut self, locale: impl AsRef<str>) -> &mut Self

Source

pub fn text_baseline(&self) -> TextBaseline

Source

pub fn set_text_baseline(&mut self, baseline: TextBaseline) -> &mut Self

Source

pub fn font_metrics(&self) -> FontMetrics

Source

pub fn is_placeholder(&self) -> bool

Source

pub fn set_placeholder(&mut self) -> &mut Self

Source§

impl Handle<SkSVGColor>

Source

pub fn color(&self) -> Option<SkColor>

Source

pub fn kind(&self) -> ColorKind

Source

pub fn current_color() -> Self

Source

pub fn from_color(color: SkColor) -> Self

Source§

impl Handle<SkSVGIRI>

Source

pub fn data(&self) -> &str

Source

pub fn new<T: AsRef<str>>(value: T, kind: IriKind) -> Self

Source§

impl Handle<SkSVGFuncIRI>

Source

pub fn iri(&self) -> Option<&Iri>

Source

pub fn kind(&self) -> IriFuncKind

Source

pub fn from_iri(value: Iri) -> Self

Source

pub fn none() -> Self

Source§

impl Handle<SkSVGPaint>

Source

pub fn color(&self) -> Option<Color>

Source

pub fn is_current_color(&self) -> bool

Source

pub fn is_color(&self) -> bool

Source

pub fn is_none(&self) -> bool

Source

pub fn from_color(color: Color) -> Self

Source

pub fn current_color() -> Self

Source

pub fn none() -> Self

Source§

impl Handle<SkOpBuilder>

Source

pub fn add(&mut self, path: &Path, operator: PathOp) -> &mut Self

Source

pub fn resolve(&mut self) -> Option<Path>

Source§

impl Handle<SkPath>

Source

pub fn op(&self, path: &Path, path_op: PathOp) -> Option<Self>

Source

pub fn simplify(&self) -> Option<Self>

Source

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

Source

pub fn as_winding(&self) -> Option<Path>

Source§

impl Handle<SkCustomTypefaceBuilder>

Source

pub const FACTORY_ID: FactoryId = _

Source

pub fn new() -> Self

Source

pub fn set_glyph<'a>( &mut self, glyph_id: GlyphId, advance: f32, typeface_glyph: impl Into<TypefaceGlyph<'a>>, ) -> &mut Self

Source

pub fn set_metrics( &mut self, font_metrics: &FontMetrics, scale: impl Into<Option<f32>>, ) -> &mut Self

Source

pub fn set_font_style(&mut self, font_style: FontStyle) -> &mut Self

Source

pub fn detach(&mut self) -> Option<Typeface>

Source

pub fn from_data( data: impl Into<Data>, font_arguments: &FontArguments<'_, '_>, ) -> Option<Typeface>

Source§

impl Handle<SkPath>

Source

pub fn from_svg(svg: impl AsRef<str>) -> Option<Path>

Source

pub fn to_svg(&self) -> String

Source

pub fn to_svg_with_encoding(&self, encoding: PathEncoding) -> String

Source§

impl Handle<SkPath>

Source

pub fn from_str(text: impl AsRef<str>, p: impl Into<Point>, font: &Font) -> Self

Trait Implementations§

Source§

impl<N: NativeDrop> AsRef<Handle<N>> for Handle<N>

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<str> for Handle<SkString>

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<N: NativeDrop + NativeClone> Clone for Handle<N>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Combine<Handle<SkRegion>, Handle<SkRegion>> for Handle<SkRegion>

Source§

fn combine(a: &Region, op: RegionOp, b: &Region) -> Self

Source§

fn difference(a: &A, b: &B) -> Self

Source§

fn intersect(a: &A, b: &B) -> Self

Source§

fn xor(a: &A, b: &B) -> Self

Source§

fn union(a: &A, b: &B) -> Self

Source§

fn reverse_difference(a: &A, b: &B) -> Self

Source§

fn replace(a: &A, b: &B) -> Self

Source§

impl Combine<Handle<SkRegion>, IRect> for Handle<SkRegion>

Source§

fn combine(region: &Region, op: RegionOp, rect: &IRect) -> Self

Source§

fn difference(a: &A, b: &B) -> Self

Source§

fn intersect(a: &A, b: &B) -> Self

Source§

fn xor(a: &A, b: &B) -> Self

Source§

fn union(a: &A, b: &B) -> Self

Source§

fn reverse_difference(a: &A, b: &B) -> Self

Source§

fn replace(a: &A, b: &B) -> Self

Source§

impl Combine<IRect, Handle<SkRegion>> for Handle<SkRegion>

Source§

fn combine(rect: &IRect, op: RegionOp, region: &Region) -> Self

Source§

fn difference(a: &A, b: &B) -> Self

Source§

fn intersect(a: &A, b: &B) -> Self

Source§

fn xor(a: &A, b: &B) -> Self

Source§

fn union(a: &A, b: &B) -> Self

Source§

fn reverse_difference(a: &A, b: &B) -> Self

Source§

fn replace(a: &A, b: &B) -> Self

Source§

impl Contains<&Handle<SkRegion>> for Region

Source§

fn contains(&self, other: &Region) -> bool

Source§

impl Debug for Handle<SkDynamicMemoryWStream>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Debug for Handle<SkString>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Debug for Handle<SkStrings>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Handle<SkImageInfo>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for Handle<SkOpBuilder>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for Handle<SkPDF_Metadata>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for Handle<SkPaint>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for Handle<SkPath>

Source§

fn default() -> Self

Source§

impl Default for Handle<SkString>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Handle<SkString>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<N: NativeDrop> Drop for Handle<N>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> From<&'a Handle<SkPath>> for TypefaceGlyph<'a>

Source§

fn from(path: &'a Path) -> Self

Converts to this type from the input type.
Source§

impl<N: NativeDrop + NativeHash> Hash for Handle<N>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<usize> for Handle<SkStrings>

Source§

type Output = Handle<SkString>

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Intersects<Handle<SkRegion>> for Region

Source§

fn intersects(&self, other: &Region) -> bool

Source§

impl<N: NativeDrop + NativePartialEq> PartialEq for Handle<N>

Source§

fn eq(&self, rhs: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl QuickReject<Handle<SkPath>> for Canvas

Source§

fn quick_reject(&self, path: &Path) -> bool

Returns true if path, transformed by Matrix, can be quickly determined to be outside of clip. May return false even though path is outside of clip.

Use to check if an area to be drawn is clipped out, to skip subsequent draw calls.

  • path Path to compare with clip

Returns true if path, transformed by Matrix, does not intersect clip

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

Source§

impl QuickReject<Handle<SkRegion>> for Region

Source§

fn quick_reject(&self, other: &Region) -> bool

Source§

impl<N> RefWrapper<N> for Handle<N>
where N: NativeDrop,

Source§

fn wrap_ref(native: &N) -> &Self

Source§

fn wrap_mut(native: &mut N) -> &mut Self

Source§

fn inner(&self) -> &N

Source§

fn inner_mut(&mut self) -> &mut N

Source§

impl<N> ValueWrapper<N> for Handle<N>
where N: NativeDrop,

Source§

fn wrap(native: N) -> Self
where N: NativeDrop,

Source§

fn unwrap(self) -> N

Source§

fn inner(&self) -> &N

Source§

fn inner_mut(&mut self) -> &mut N

Source§

impl Send for Handle<SkString>

Source§

impl Send for Handle<SkStrings>

Source§

impl Sync for Handle<SkString>

Source§

impl Sync for Handle<SkStrings>

Auto Trait Implementations§

§

impl<N> Freeze for Handle<N>
where N: Freeze,

§

impl<N> RefUnwindSafe for Handle<N>
where N: RefUnwindSafe,

§

impl<N> !Send for Handle<N>

§

impl<N> !Sync for Handle<N>

§

impl<N> Unpin for Handle<N>
where N: Unpin,

§

impl<N> UnwindSafe for Handle<N>
where N: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<I> IntoIterator for I
where I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.