Skip to main content

Handle

Struct Handle 

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

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

This type requires an implementation of the NativeDrop trait.

Implementations§

§

impl Handle<SkCodecs_Decoder>

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

Returns the name identifying this decoder (e.g. “png”, “jpeg”, …).

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

Whether the given data is in this decoder’s format.

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

If this stream represents an encoded image in this decoder’s format, return a Codec that can decode it. Otherwise return an error Result explaining the reason for the failure.

§

impl Handle<SkBitmap>

pub fn new() -> Handle<SkBitmap>

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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_empty_constructor

pub fn swap(&mut self, other: &mut Handle<SkBitmap>)

Swaps the fields of the two bitmaps.

Example (C++): https://fiddle.skia.org/c/@Bitmap_swap

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

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

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

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

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.

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.

pub fn color_type(&self) -> ColorType

pub fn alpha_type(&self) -> SkAlphaType

pub fn color_space(&self) -> Option<RCHandle<SkColorSpace>>

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

pub fn bytes_per_pixel(&self) -> usize

Returns number of bytes per pixel required by ColorType.

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

pub fn row_bytes_as_pixels(&self) -> usize

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

pub fn shift_per_pixel(&self) -> usize

Returns bit shift converting row bytes to row pixels.

Returns zero for ColorType::Unknown.

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.

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.

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.

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.

pub fn set_alpha_type(&mut self, alpha_type: SkAlphaType) -> 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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_setAlphaType

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

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.

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

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

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.

pub fn is_immutable(&self) -> bool

Returns true if pixels can not change.

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

Example (C++): https://fiddle.skia.org/c/@Bitmap_isImmutable

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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_setImmutable

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.

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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_reset

pub fn compute_is_opaque(bm: &Handle<SkBitmap>) -> 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.

pub fn bounds(&self) -> IRect

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

Example (C++): https://fiddle.skia.org/c/@Bitmap_getBounds Example (C++): https://fiddle.skia.org/c/@Bitmap_getBounds_2

pub fn dimensions(&self) -> ISize

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

pub fn get_subset(&self) -> IRect

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

pub fn set_info( &mut self, image_info: &Handle<SkImageInfo>, 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()

Example (C++): https://fiddle.skia.org/c/@Bitmap_setInfo

pub fn try_alloc_pixels_flags( &mut self, image_info: &Handle<SkImageInfo>, ) -> 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().

pub fn alloc_pixels_flags(&mut self, image_info: &Handle<SkImageInfo>)

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().

Example (C++): https://fiddle.skia.org/c/@Bitmap_allocPixelsFlags

pub fn try_alloc_pixels_info( &mut self, image_info: &Handle<SkImageInfo>, 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().

pub fn alloc_pixels_info( &mut self, image_info: &Handle<SkImageInfo>, 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 ImageInfo 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().

Example (C++): https://fiddle.skia.org/c/@Bitmap_allocPixels Example (C++): https://fiddle.skia.org/c/@Bitmap_allocPixels_2

pub fn try_alloc_n32_pixels( &mut self, _: (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.

pub fn alloc_n32_pixels( &mut self, _: (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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_allocN32Pixels

pub unsafe fn install_pixels( &mut self, info: &Handle<SkImageInfo>, 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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_installPixels_3

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.

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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_allocPixels_3

pub fn pixel_ref(&self) -> Option<RCHandle<SkPixelRef>>

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.

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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_pixelRefOrigin

pub fn set_pixel_ref( &mut self, pixel_ref: impl Into<Option<RCHandle<SkPixelRef>>>, 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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_setPixelRef

pub fn is_ready_to_draw(&self) -> bool

Returns true if Bitmap can be drawn.

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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_getGenerationID

pub fn notify_pixels_changed(&self)

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

Example (C++): https://fiddle.skia.org/c/@Bitmap_notifyPixelsChanged

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 Self::bounds() are affected. If the Self::color_type() is ColorType::Gray8 or ColorType::RGB565, then alpha is ignored; RGB is treated as opaque. If Self::color_type() 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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_eraseColor

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 Self::bounds() are affected. If the Self::color_type() is ColorType::Gray8 or ColorType::RGB565, then alpha is ignored; RGB is treated as opaque. If Self::color_type() is ColorType::Alpha8, then RGB is ignored.

Example (C++): https://fiddle.skia.org/c/@Bitmap_eraseColor

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 Self::bounds() are affected. If the Self::color_type() is ColorType::Gray8 or ColorType::RGB565, then a is ignored; r, g, and b are treated as opaque. If Self::color_type() is ColorType::Alpha8, then r, g, and b are ignored.

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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_erase

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.

Example (C++): https://fiddle.skia.org/c/@Bitmap_erase

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 None.

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

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.

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).

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 None if ColorType is ColorType::Unknown, or PixelRef is None.

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

Example (C++): https://fiddle.skia.org/c/@Bitmap_getAddr

pub fn extract_subset( &self, dst: &mut Handle<SkBitmap>, 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 (C++): https://fiddle.skia.org/c/@Bitmap_extractSubset

pub unsafe fn read_pixels( &self, dst_info: &Handle<SkImageInfo>, 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 None

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 None, 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().

Example (C++): https://fiddle.skia.org/c/@Bitmap_readPixels_2

pub fn extract_alpha( &self, dst: &mut Handle<SkBitmap>, paint: Option<&Handle<SkPaint>>, ) -> 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.

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 (C++): https://fiddle.skia.org/c/@Bitmap_peekPixels

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

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

pub fn as_image(&self) -> RCHandle<SkImage>

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.

§

impl Handle<SkContextOptions>

pub fn typeface_cache_count_limit(&self) -> i32

Maximum number of entries in the typeface cache. Each entry corresponds to a cached Typeface. (1024 is the historical default value.)

pub fn resource_cache_total_byte_limit(&self) -> usize

Maximum total memory (in bytes) for the CPU resource cache, used for temporary bitmaps, scaled images, and other decoded resources. Entries are purged from the cache when memory usage exceeds this limit.

pub fn resource_cache_single_allocation_byte_limit(&self) -> usize

Maximum size (in bytes) for a single allocation in the CPU resource cache. When a cacheable entry is very large (e.g. a large scaled bitmap), adding it to the cache can cause most or all existing entries to be purged. If an entry’s size exceeds this limit, it is not cached at all.

0 means no separate single-allocation cap beyond resource_cache_total_byte_limit().

pub fn font_cache_count_limit(&self) -> i32

Maximum number of entries (strikes) in the font cache. A cache entry is associated with each unique combination of typeface, point size, and matrix.

pub fn font_cache_limit(&self) -> usize

Maximum total memory (in bytes) used by the font/strike cache for glyph metrics, masks, and paths. If the cache needs to allocate more, it will purge previous entries.

pub fn thread_safe_shared_resources(&self) -> bool

When true, shared caches (such as the strike cache, the resource cache, and the typeface cache) are guarded by internal mutexes so they can safely be accessed concurrently across threads. (true is the default value.)

pub fn set_typeface_cache_count_limit( &mut self, limit: i32, ) -> &mut Handle<SkContextOptions>

Sets the maximum number of entries in the typeface cache.

pub fn set_resource_cache_total_byte_limit( &mut self, limit: usize, ) -> &mut Handle<SkContextOptions>

Sets the maximum total memory (in bytes) for the CPU resource cache.

pub fn set_resource_cache_single_allocation_byte_limit( &mut self, limit: usize, ) -> &mut Handle<SkContextOptions>

Sets the maximum size (in bytes) for a single allocation in the CPU resource cache. 0 disables the separate single-allocation cap.

pub fn set_font_cache_count_limit( &mut self, limit: i32, ) -> &mut Handle<SkContextOptions>

Sets the maximum number of entries (strikes) in the font cache.

pub fn set_font_cache_limit( &mut self, limit: usize, ) -> &mut Handle<SkContextOptions>

Sets the maximum total memory (in bytes) used by the font/strike cache.

§

impl Handle<SkContourMeasureIter>

pub fn new( path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> Handle<SkContourMeasureIter> ⓘ

Initializes the iterator with a path.

The parts of the path that are needed are copied, so the caller is free to modify or delete the path after this call.

res_scale controls the precision of the measure. Values greater than 1 increase precision (and may slow down the computation).

  • path source path to iterate.
  • force_closed whether open contours are treated as closed.
  • res_scale optional precision scale (defaults to 1.0).

pub fn from_path( path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> Handle<SkContourMeasureIter> ⓘ

Initializes the iterator with a path.

The parts of the path that are needed are copied, so the caller is free to modify or delete the path after this call.

res_scale controls the precision of the measure. Values greater than 1 increase precision (and may slow down the computation).

  • path source path to iterate.
  • force_closed whether open contours are treated as closed.
  • res_scale optional precision scale (defaults to 1.0).

pub fn reset( &mut self, path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> &mut Handle<SkContourMeasureIter> ⓘ

Resets the iterator with a path.

The parts of the path that are needed are copied, so the caller is free to modify or delete the path after this call.

  • path source path to iterate.
  • force_closed whether open contours are treated as closed.
  • res_scale optional precision scale (defaults to 1.0).
§

impl Handle<SkFont>

pub fn new( typeface: impl Into<RCHandle<SkTypeface>>, size: impl Into<Option<f32>>, ) -> Handle<SkFont>

Constructs a font with default values with Typeface and size.

  • typeface font and style used to draw and measure text
  • size EM size in local coordinate units

pub fn from_typeface( typeface: impl Into<RCHandle<SkTypeface>>, size: impl Into<Option<f32>>, ) -> Handle<SkFont>

Constructs a font with default values with Typeface and size.

  • typeface font and style used to draw and measure text
  • size EM size in local coordinate units

pub fn from_typeface_with_params( typeface: impl Into<RCHandle<SkTypeface>>, size: f32, scale: f32, skew: f32, ) -> Handle<SkFont>

Constructs a font with default values with Typeface and size in points, horizontal scale, and horizontal skew. Horizontal scale emulates condensed and expanded fonts. Horizontal skew emulates oblique fonts.

  • typeface font and style used to draw and measure text
  • size EM size in local coordinate units
  • scale text horizontal scale
  • skew additional shear on x-axis relative to y-axis

pub fn is_force_auto_hinting(&self) -> bool

If true, instructs the font manager to always hint glyphs. Returned value is only meaningful if platform uses FreeType as the font manager.

Returns true if all glyphs are hinted.

pub fn is_embedded_bitmaps(&self) -> bool

Returns true if font engine may return glyphs from font bitmaps instead of from outlines.

Returns true if glyphs may be font bitmaps.

pub fn is_subpixel(&self) -> bool

Returns true if glyphs may be drawn at sub-pixel offsets.

Returns true if glyphs may be drawn at sub-pixel offsets.

pub fn is_linear_metrics(&self) -> bool

Returns true if font and glyph metrics are requested to be linearly scalable.

Returns true if font and glyph metrics are requested to be linearly scalable.

pub fn is_embolden(&self) -> bool

Returns true if bold is approximated by increasing the stroke width when creating glyph bitmaps from outlines.

Returns true if bold is approximated through stroke width.

pub fn is_baseline_snap(&self) -> bool

Returns true if baselines will be snapped to pixel positions when the current transformation matrix is axis aligned.

Returns true if baselines may be snapped to pixels.

pub fn set_force_auto_hinting( &mut self, force_auto_hinting: bool, ) -> &mut Handle<SkFont>

Sets whether to always hint glyphs. If force_auto_hinting is set, instructs the font manager to always hint glyphs.

Only affects platforms that use FreeType as the font manager.

  • force_auto_hinting setting to always hint glyphs

pub fn set_embedded_bitmaps( &mut self, embedded_bitmaps: bool, ) -> &mut Handle<SkFont>

Requests, but does not require, to use bitmaps in fonts instead of outlines.

  • embedded_bitmaps setting to use bitmaps in fonts

pub fn set_subpixel(&mut self, subpixel: bool) -> &mut Handle<SkFont>

Requests, but does not require, that glyphs respect sub-pixel positioning.

  • subpixel setting for sub-pixel positioning

pub fn set_linear_metrics( &mut self, linear_metrics: bool, ) -> &mut Handle<SkFont>

Requests, but does not require, linearly scalable font and glyph metrics.

For outline fonts true means font and glyph metrics should ignore hinting and rounding. Note that some bitmap formats may not be able to scale linearly and will ignore this flag.

  • linear_metrics setting for linearly scalable font and glyph metrics.

pub fn set_embolden(&mut self, embolden: bool) -> &mut Handle<SkFont>

Increases stroke width when creating glyph bitmaps to approximate a bold typeface.

  • embolden setting for bold approximation

pub fn set_baseline_snap(&mut self, baseline_snap: bool) -> &mut Handle<SkFont>

Requests that baselines be snapped to pixels when the current transformation matrix is axis aligned.

  • baseline_snap setting for baseline snapping to pixels

pub fn edging(&self) -> SkFont_Edging

Whether edge pixels draw opaque or with partial transparency.

pub fn set_edging(&mut self, edging: SkFont_Edging) -> &mut Handle<SkFont>

Requests, but does not require, that edge pixels draw opaque or with partial transparency.

pub fn set_hinting(&mut self, hinting: SkFontHinting) -> &mut Handle<SkFont>

Sets level of glyph outline adjustment. Does not check for valid values of hinting.

pub fn hinting(&self) -> SkFontHinting

Returns level of glyph outline adjustment.

pub fn with_size(&self, size: f32) -> Option<Handle<SkFont>>

Returns a font with the same attributes of this font, but with the specified size. Returns None if size is less than zero, infinite, or NaN.

  • size EM size in local coordinate units

pub fn typeface(&self) -> RCHandle<SkTypeface>

Does not alter Typeface SkRefCnt.

Returns non-null Typeface.

pub fn size(&self) -> f32

Return EM size in local coordinate units. See https://skia.org/docs/user/coordinates/#local-coordinates .

Returns EM size in local coordinate units.

pub fn scale_x(&self) -> f32

Returns text scale on x-axis. Default value is 1.

Returns text horizontal scale.

pub fn skew_x(&self) -> f32

Returns text skew on x-axis. Default value is zero.

Returns additional shear on x-axis relative to y-axis.

pub fn set_typeface( &mut self, tf: impl Into<RCHandle<SkTypeface>>, ) -> &mut Handle<SkFont>

Sets Typeface to tf, decreasing SkRefCnt of the previous Typeface. Pass None to clear Typeface and use an empty typeface (which draws nothing). Increments tf SkRefCnt by one.

  • tf font and style used to draw text

pub fn set_size(&mut self, size: f32) -> &mut Handle<SkFont>

Sets the EM size in local coordinate units. See https://skia.org/docs/user/coordinates/#local-coordinates . Has no effect if size is not greater than or equal to zero.

  • size EM size in local coordinate units

pub fn set_scale_x(&mut self, scale_x: f32) -> &mut Handle<SkFont>

Sets text scale on x-axis. Default value is 1.

  • scale_x text horizontal scale

pub fn set_skew_x(&mut self, skew_x: f32) -> &mut Handle<SkFont>

Sets text skew on x-axis. Default value is zero.

  • skew_x additional shear on x-axis relative to y-axis

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

Converts str into glyph indices. Returns the number of glyph indices represented by str.

See Self::text_to_glyphs() for details.

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

Converts text into glyph indices. Returns the number of glyph indices represented by text. crate::TextEncoding specifies how text represents characters or glyphs. glyphs may be empty, to compute the glyph count.

Does not check text for valid character codes or valid glyph indices.

If the text length is zero, returns zero. If the text includes a partial character, the partial character is ignored.

If the encoding is UTF-8 and text contains an invalid UTF-8 sequence, zero is returned.

When the encoding is UTF-8, UTF-16, or UTF-32, then each Unicode codepoint is mapped to a single glyph. This function uses the default character-to-glyph mapping from the Typeface and maps characters not found in the Typeface to zero.

If glyphs is not sufficient to store all the glyphs, no glyphs are copied. The total glyph count is returned for subsequent buffer reallocation.

  • text character storage encoded with crate::TextEncoding
  • glyphs storage for glyph indices; may be empty

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

Returns number of glyphs represented by str.

See Self::count_text() for details.

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

Returns number of glyphs represented by text.

If the encoding is UTF-8, UTF-16, or UTF-32, then each Unicode codepoint is mapped to a single glyph.

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

Convenience variant of Self::str_to_glyphs() that returns the glyphs as a Vec.

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

Convenience variant of Self::text_to_glyphs() that returns the glyphs as a Vec.

pub fn measure_str( &self, str: impl AsRef<str>, paint: Option<&Handle<SkPaint>>, ) -> (f32, Rect)

Returns the advance width of str and the bounding box of text.

See Self::measure_text() for details.

pub fn measure_text( &self, text: impl EncodedText, paint: Option<&Handle<SkPaint>>, ) -> (f32, Rect)

Returns the advance width of text. The advance is the normal distance to move before drawing additional text. Returns the bounding box of text relative to (0, 0). The paint stroke settings, mask filter, or path effect may modify the bounds.

Returns the sum of the default advance widths.

pub fn unichar_to_glyph(&self, uni: i32) -> u16

Returns glyph index for Unicode character.

If the character is not supported by the Typeface, returns 0.

  • uni Unicode character

pub fn unichar_to_glyphs(&self, uni: &[i32], glyphs: &mut [u16])

Returns the glyph indices for each Unicode character in uni.

pub fn get_widths(&self, glyphs: &[u16], widths: &mut [f32])

Retrieves the advance for each glyph in glyphs.

See Self::get_widths_bounds() for details.

pub fn make_strike_ref(&self) -> Handle<SkStrikeRef>

Returns a strike ref for this font’s current settings.

A StrikeRef caches the resolved strike (font metrics engine), avoiding the overhead of descriptor construction, hashing, and global cache lookup on each glyph query. This is useful when making many glyph metric calls (e.g. Self::get_widths()) with the same font configuration.

The returned StrikeRef is independent of this Font; subsequent changes to this Font do not affect it. Create a new StrikeRef after changing font properties.

pub fn get_widths_bounds( &self, glyphs: &[u16], widths: Option<&mut [f32]>, bounds: Option<&mut [Rect]>, paint: Option<&Handle<SkPaint>>, )

Retrieves the advance and bounds for each glyph in glyphs.

  • glyphs array of glyph indices to be measured
  • widths returns text advances for each glyph; may be None
  • bounds returns bounds for each glyph relative to (0, 0); may be None
  • paint optional, specifies stroking, crate::PathEffect and crate::MaskFilter

pub fn get_bounds( &self, glyphs: &[u16], bounds: &mut [Rect], paint: Option<&Handle<SkPaint>>, )

Retrieves the bounds for each glyph in glyphs. If paint is not None, its stroking, crate::PathEffect, and crate::MaskFilter fields are respected.

  • glyphs array of glyph indices to be measured
  • bounds returns bounds for each glyph relative to (0, 0)
  • paint optional, specifies stroking, crate::PathEffect, and crate::MaskFilter

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

Retrieves the positions for each glyph, beginning at the specified origin.

  • glyphs array of glyph indices to be positioned
  • pos returns glyphs positions
  • origin location of the first glyph. Defaults to {0, 0}.

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

Retrieves the x-positions for each glyph, beginning at the specified origin.

  • glyphs array of glyph indices to be positioned
  • x_pos returns glyphs x-positions
  • origin x-position of the first glyph. Defaults to 0.

pub fn get_intercepts<'a>( &self, glyphs: &[u16], pos: &[Point], _: (f32, f32), paint: impl Into<Option<&'a Handle<SkPaint>>>, ) -> Vec<f32>

Returns intervals [start, end] describing lines parallel to the advance that intersect with the glyphs.

  • glyphs the glyphs to intersect
  • pos the position of each glyph
  • top the top of the line intersecting
  • bottom the bottom of the line intersecting
  • paint optional; may be None

Returns an array of pairs of x values [start, end]. May be empty.

pub fn get_path(&self, glyph_id: u16) -> Option<Handle<SkPath>>

If the specified glyph can be represented as a path, return its path. If it is not (e.g. it is represented with a bitmap) return None.

Note: an ‘empty’ glyph (e.g. what a space “ “ character might map to) can return a path, but that path may have zero contours.

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

Returns FontMetrics associated with Typeface. The return value is the recommended spacing between lines: the sum of metrics descent, ascent, and leading. Results are scaled by text size but does not take into account dimensions required by text scale, text skew, fake bold, style stroke, and crate::PathEffect.

Returns the recommended spacing between lines.

pub fn spacing(&self) -> f32

Returns the recommended spacing between lines: the sum of metrics descent, ascent, and leading. Result is scaled by text size but does not take into account dimensions required by stroking and crate::PathEffect. Returns the same result as Self::metrics().

§

impl Handle<SkColorInfo>

pub fn new( ct: ColorType, at: SkAlphaType, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkColorInfo>

Creates ColorInfo from ColorType, AlphaType, and optionally ColorSpace.

If cs is None and ColorInfo is part of a drawing source, ColorSpace defaults to sRGB, mapping into the surface ColorSpace. Parameters are not validated to see if their values are legal, or that the combination is supported.

  • ct color type
  • at alpha type
  • cs optional color space

pub fn color_space(&self) -> Option<RCHandle<SkColorSpace>>

Returns the color space.

pub fn color_type(&self) -> ColorType

Returns the color type.

pub fn alpha_type(&self) -> SkAlphaType

Returns the alpha type.

pub fn is_opaque(&self) -> bool

Returns true if the color info is opaque.

pub fn is_gamma_close_to_srgb(&self) -> bool

Returns true if the gamma is close to sRGB.

pub fn with_alpha_type( &self, new_alpha_type: SkAlphaType, ) -> Handle<SkColorInfo>

Creates ColorInfo with the same color type and color space, with the alpha type set to new_alpha_type.

The created ColorInfo contains new_alpha_type even if it is incompatible with the color type, in which case the alpha type in ColorInfo is ignored.

  • new_alpha_type new alpha type

pub fn with_color_type(&self, new_color_type: ColorType) -> Handle<SkColorInfo>

Creates ColorInfo with the same alpha type and color space, with the color type set to new_color_type.

  • new_color_type new color type

pub fn with_color_space( &self, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkColorInfo>

Creates ColorInfo with the same alpha type and color type, with the color space set to cs. cs may be None.

  • cs optional color space

pub fn bytes_per_pixel(&self) -> usize

Returns the number of bytes per pixel required by the color type. Returns zero if the color type is ColorType::Unknown.

pub fn shift_per_pixel(&self) -> usize

Returns the bit shift converting row bytes to row pixels. Returns zero for ColorType::Unknown. Returns one of: 0, 1, 2, 3, 4; left shift to convert pixels to bytes.

§

impl Handle<SkImageInfo>

pub fn new( dimensions: impl Into<ISize>, ct: ColorType, at: SkAlphaType, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkImageInfo>

Creates ImageInfo from integral dimensions, ColorType, AlphaType, and optionally ColorSpace.

If cs is None and ImageInfo is part of a drawing source, ColorSpace defaults to sRGB, mapping into the surface ColorSpace. Parameters are not validated to see if their values are legal, or that the combination is supported.

  • dimensions pixel column and row count; must be zero or greater
  • ct color type
  • at alpha type
  • cs optional color space

pub fn from_color_info( dimensions: impl Into<ISize>, color_info: Handle<SkColorInfo>, ) -> Handle<SkImageInfo>

Creates ImageInfo from integral dimensions and ColorInfo. Parameters are not validated to see if their values are legal, or that the combination is supported.

  • dimensions pixel column and row count; must be zero or greater
  • color_info pixel encoding consisting of ColorType, AlphaType, and ColorSpace which may be None

pub fn new_n32( dimensions: impl Into<ISize>, at: SkAlphaType, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkImageInfo>

Creates ImageInfo from integral dimensions, an N32 color type, at, and optionally ColorSpace. N32 will equal either BGRA 8888 or RGBA 8888, whichever is optimal.

If cs is None and ImageInfo is part of a drawing source, ColorSpace defaults to sRGB, mapping into the surface ColorSpace. Parameters are not validated to see if their values are legal, or that the combination is supported.

  • dimensions pixel column and row count; must be zero or greater
  • at alpha type
  • cs optional color space

pub fn new_s32( dimensions: impl Into<ISize>, at: SkAlphaType, ) -> Handle<SkImageInfo>

Creates ImageInfo from integral dimensions, an N32 color type, and at, with sRGB ColorSpace. Parameters are not validated to see if their values are legal, or that the combination is supported.

  • dimensions pixel column and row count; must be zero or greater
  • at alpha type

pub fn new_n32_premul( dimensions: impl Into<ISize>, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkImageInfo>

Creates ImageInfo from integral dimensions, an N32 color type, premultiplied alpha, and optional ColorSpace.

If cs is None and ImageInfo is part of a drawing source, ColorSpace defaults to sRGB, mapping into the surface ColorSpace. Parameters are not validated to see if their values are legal, or that the combination is supported.

  • dimensions pixel column and row count; must be zero or greater
  • cs optional color space

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

Creates ImageInfo from integral dimensions, an alpha-only color type, premultiplied alpha, and no ColorSpace.

  • dimensions pixel column and row count; must be zero or greater

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

Creates ImageInfo from integral dimensions, an unknown color type, unknown alpha type, and no ColorSpace. An ImageInfo used as a source does not draw, and one used as a destination cannot be drawn to.

  • dimensions pixel column and row count; must be zero or greater

pub fn width(&self) -> i32

Returns the pixel count in each row.

pub fn height(&self) -> i32

Returns the pixel row count.

pub fn color_type(&self) -> ColorType

Returns the color type.

pub fn alpha_type(&self) -> SkAlphaType

Returns the alpha type.

pub fn color_space(&self) -> Option<RCHandle<SkColorSpace>>

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

pub fn is_empty(&self) -> bool

Returns true if either dimension is zero or smaller.

pub fn color_info(&self) -> &Handle<SkColorInfo>

Returns the dimensionless ColorInfo that represents the same color type, alpha type, and color space as this ImageInfo.

pub fn is_opaque(&self) -> bool

Returns true if the alpha type 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.

This does not check if the color type allows alpha, or if any pixel value has transparency.

pub fn dimensions(&self) -> ISize

Returns the integral size of Self::width() and Self::height().

pub fn bounds(&self) -> IRect

Returns the integral rectangle from the origin to Self::width() and Self::height().

pub fn is_gamma_close_to_srgb(&self) -> bool

Returns true if the associated ColorSpace is not None, and the ColorSpace gamma is approximately the same as sRGB.

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

Creates ImageInfo with the same color type, color space, and alpha type, with dimensions set to new_dimensions.

  • new_dimensions pixel column and row count; must be zero or greater

pub fn with_alpha_type( &self, new_alpha_type: SkAlphaType, ) -> Handle<SkImageInfo>

Creates ImageInfo with the same color type, color space, width, and height, with the alpha type set to new_alpha_type.

The created ImageInfo contains new_alpha_type even if it is incompatible with the color type, in which case the alpha type in ImageInfo is ignored.

  • new_alpha_type new alpha type

pub fn with_color_type(&self, new_color_type: ColorType) -> Handle<SkImageInfo>

Creates ImageInfo with the same alpha type, color space, width, and height, with the color type set to new_color_type.

  • new_color_type new color type

pub fn with_color_space( &self, new_color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkImageInfo>

Creates ImageInfo with the same alpha type, color type, width, and height, with the color space set to new_color_space. new_color_space may be None.

  • new_color_space optional color space

pub fn bytes_per_pixel(&self) -> usize

Returns the number of bytes per pixel required by the color type. Returns zero if the color type is ColorType::Unknown.

pub fn shift_per_pixel(&self) -> usize

Returns the bit shift converting row bytes to row pixels. Returns zero for ColorType::Unknown. Returns one of: 0, 1, 2, 3; left shift to convert pixels to bytes.

pub fn min_row_bytes(&self) -> usize

Returns the minimum number of bytes per row, computed from the pixel width and color type, which specifies bytes per pixel. The bitmap maximum value for row bytes must fit in 31 bits.

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

Returns the byte offset of a pixel from the pixel base address.

Asserts in debug builds if point is outside of bounds. Does not assert if row_bytes is smaller than Self::min_row_bytes(), even though the result may be incorrect.

  • point pixel column and row; both must be within the image bounds
  • row_bytes size of the pixel row or larger

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

Returns the storage required by the pixel array, given ImageInfo dimensions, color type, and row_bytes. row_bytes is assumed to be at least Self::min_row_bytes().

Returns zero if the height is zero. Returns usize::MAX if the answer exceeds the range of usize.

  • row_bytes size of the pixel row or larger

pub fn compute_min_byte_size(&self) -> usize

Returns the least storage required by the pixel buffer, using Self::min_row_bytes() to compute the bytes for each pixel row.

Returns zero if the height is zero. Returns usize::MAX if the answer exceeds the range of usize.

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

Returns true if row_bytes is valid for this ImageInfo.

  • row_bytes size of the pixel row including padding

pub fn reset(&mut self) -> &mut Handle<SkImageInfo>

Creates an empty ImageInfo with ColorType::Unknown, AlphaType::Unknown, a width and height of zero, and no ColorSpace.

§

impl Handle<SkMeshSpecification_Attribute>

pub fn new( ty: SkMeshSpecification_Attribute_Type, offset: usize, name: impl AsRef<str>, ) -> Handle<SkMeshSpecification_Attribute>

pub fn ty(&self) -> SkMeshSpecification_Attribute_Type

pub fn offset(&self) -> usize

pub fn name(&self) -> &str

§

impl Handle<SkMeshSpecification_Varying>

pub fn new( ty: SkMeshSpecification_Varying_Type, name: impl AsRef<str>, ) -> Handle<SkMeshSpecification_Varying>

pub fn ty(&self) -> SkMeshSpecification_Varying_Type

pub fn name(&self) -> &str

§

impl Handle<SkPaint>

pub fn new<'a>( color: impl AsRef<Color4f>, color_space: impl Into<Option<&'a RCHandle<SkColorSpace>>>, ) -> Handle<SkPaint>

Constructs a paint with default values and the given color.

Sets alpha and RGB used when stroking and filling. The color is four floating point values, unpremultiplied. The color values are interpreted as being in the color_space. If color_space is None, then color is assumed to be in the sRGB color space.

  • color unpremultiplied RGBA
  • color_space ColorSpace describing the encoding of color

pub fn reset(&mut self) -> &mut Handle<SkPaint>

Sets all Paint contents to their initial values. This is equivalent to replacing Paint with the result of Paint::default().

Example (C++): https://fiddle.skia.org/c/@Paint_reset

pub fn is_anti_alias(&self) -> bool

Returns true if pixels on the active edges of crate::Path may be drawn with partial transparency.

Returns antialiasing state.

pub fn set_anti_alias(&mut self, anti_alias: bool) -> &mut Handle<SkPaint>

Requests, but does not require, that edge pixels draw opaque or with partial transparency.

  • anti_alias setting for antialiasing

pub fn is_dither(&self) -> bool

Returns true if color error may be distributed to smooth color transition.

Returns dithering state.

pub fn set_dither(&mut self, dither: bool) -> &mut Handle<SkPaint>

Requests, but does not require, to distribute color error.

  • dither setting for dithering

pub fn style(&self) -> SkPaint_Style

Returns whether the geometry is filled, stroked, or filled and stroked.

pub fn set_style(&mut self, style: SkPaint_Style) -> &mut Handle<SkPaint>

Sets whether the geometry is filled, stroked, or filled and stroked. Has no effect if style is not a legal Style value.

Example (C++): https://fiddle.skia.org/c/@Paint_setStyle Example (C++): https://fiddle.skia.org/c/@Stroke_Width

pub fn set_stroke(&mut self, stroke: bool) -> &mut Handle<SkPaint>

Set paint’s style to Style::Stroke if true, or Style::Fill if false.

pub fn color(&self) -> Color

Retrieves alpha and RGB, unpremultiplied, packed into 32 bits.

Returns unpremultiplied ARGB.

pub fn color4f(&self) -> Color4f

Retrieves alpha and RGB, unpremultiplied, as four floating point values. RGB are extended sRGB values (sRGB gamut, and encoded with the sRGB transfer function).

Returns unpremultiplied RGBA.

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

Sets alpha and RGB used when stroking and filling. The color is a 32-bit value, unpremultiplied, packing 8-bit components for alpha, red, blue, and green.

  • color unpremultiplied ARGB

Example (C++): https://fiddle.skia.org/c/@Paint_setColor

pub fn set_color4f<'a>( &mut self, color: impl AsRef<Color4f>, color_space: impl Into<Option<&'a RCHandle<SkColorSpace>>>, ) -> &mut Handle<SkPaint>

Sets alpha and RGB used when stroking and filling. The color is four floating point values, unpremultiplied. The color values are interpreted as being in the color_space. If color_space is None, then color is assumed to be in the sRGB color space.

  • color unpremultiplied RGBA
  • color_space ColorSpace describing the encoding of color

pub fn alpha_f(&self) -> f32

Retrieves alpha from the color used when stroking and filling.

Returns alpha ranging from zero, fully transparent, to one, fully opaque.

pub fn alpha(&self) -> u8

Helper that scales the alpha by 255.

Returns alpha, from fully transparent (0) to fully opaque (255).

pub fn set_alpha_f(&mut self, alpha: f32) -> &mut Handle<SkPaint>

Replaces alpha, leaving RGB unchanged. An out of range value triggers an assert in the debug build. alpha is a value from 0.0 to 1.0. alpha set to zero makes color fully transparent; alpha set to 1.0 makes color fully opaque.

  • alpha alpha component of color

pub fn set_alpha(&mut self, alpha: u8) -> &mut Handle<SkPaint>

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

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

Sets color used when drawing solid fills. The color components range from 0 to 255. The color is unpremultiplied; alpha sets the transparency independent of RGB.

  • a amount of alpha, from fully transparent (0) to fully opaque (255)
  • r amount of red, from no red (0) to full red (255)
  • g amount of green, from no green (0) to full green (255)
  • b amount of blue, from no blue (0) to full blue (255)

Example (C++): https://fiddle.skia.org/c/@Paint_setARGB

pub fn stroke_width(&self) -> f32

Returns the thickness of the pen used by Paint to outline the shape.

Returns zero for hairline, greater than zero for pen thickness.

pub fn set_stroke_width(&mut self, width: f32) -> &mut Handle<SkPaint>

Sets the thickness of the pen used by the paint to outline the shape. A stroke-width of zero is treated as “hairline” width. Hairlines are always exactly one pixel wide in device space (their thickness does not change as the canvas is scaled). Negative stroke-widths are invalid; setting a negative width will have no effect.

  • width zero thickness for hairline; greater than zero for pen thickness

Example (C++): https://fiddle.skia.org/c/@Miter_Limit Example (C++): https://fiddle.skia.org/c/@Paint_setStrokeWidth

pub fn stroke_miter(&self) -> f32

Returns the limit at which a sharp corner is drawn beveled.

Returns zero and greater miter limit.

pub fn set_stroke_miter(&mut self, miter_limit: f32) -> &mut Handle<SkPaint>

When stroking a small joinAngle with miter, the miterLength may be very long. When miterLength > maxMiterLength (or joinAngle < minJoinAngle) the join will become bevel. miterLimit = maxMiterLength / strokeWidth or miterLimit = 1 / sin(minJoinAngle / 2).

This call has no effect if the miter_limit passed is less than zero. Values less than one will be treated as bevel.

  • miter_limit zero and greater miter limit

Example (C++): https://fiddle.skia.org/c/@Paint_setStrokeMiter

pub fn stroke_cap(&self) -> SkPaint_Cap

Returns the geometry drawn at the beginning and end of strokes.

pub fn set_stroke_cap(&mut self, cap: SkPaint_Cap) -> &mut Handle<SkPaint>

Sets the geometry drawn at the beginning and end of strokes.

Example (C++): https://fiddle.skia.org/c/@Paint_setStrokeCap_a Example (C++): https://fiddle.skia.org/c/@Paint_setStrokeCap_b

pub fn stroke_join(&self) -> SkPaint_Join

Returns the geometry drawn at the corners of strokes.

pub fn set_stroke_join(&mut self, join: SkPaint_Join) -> &mut Handle<SkPaint>

Sets the geometry drawn at the corners of strokes.

Example (C++): https://fiddle.skia.org/c/@Paint_setStrokeJoin

pub fn shader(&self) -> Option<RCHandle<SkShader>>

Returns optional colors used when filling a path, such as a gradient.

Does not alter Shader SkRefCnt.

Returns Shader if previously set, None otherwise.

Example (C++): https://fiddle.skia.org/c/@Paint_refShader

pub fn set_shader( &mut self, shader: impl Into<Option<RCHandle<SkShader>>>, ) -> &mut Handle<SkPaint>

Sets optional colors used when filling a path, such as a gradient.

Sets Shader to shader, decreasing SkRefCnt of the previous Shader. Increments shader SkRefCnt by one.

  • shader how geometry is filled with color; if None, color is used instead

Example (C++): https://fiddle.skia.org/c/@Color_Filter_Methods Example (C++): https://fiddle.skia.org/c/@Paint_setShader

pub fn color_filter(&self) -> Option<RCHandle<SkColorFilter>>

Returns ColorFilter if set, or None. Does not alter ColorFilter SkRefCnt.

Returns ColorFilter if previously set, None otherwise.

Example (C++): https://fiddle.skia.org/c/@Paint_refColorFilter

pub fn set_color_filter( &mut self, color_filter: impl Into<Option<RCHandle<SkColorFilter>>>, ) -> &mut Handle<SkPaint>

Sets ColorFilter to color_filter, decreasing SkRefCnt of the previous ColorFilter. Pass None to clear ColorFilter.

Increments color_filter SkRefCnt by one.

Example (C++): https://fiddle.skia.org/c/@Blend_Mode_Methods Example (C++): https://fiddle.skia.org/c/@Paint_setColorFilter

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

If the current blender can be represented as a BlendMode enum, this returns that enum in the option’s value. If it cannot, then the returned option does not contain a value.

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

Queries the blender, and if it can be represented as a BlendMode, return that mode, else return the default_mode provided.

pub fn blend_mode(&self) -> SkBlendMode

👎Deprecated since 0.42.0:

Use as_blend_mode() or blend_mode_or() instead.

pub fn is_src_over(&self) -> bool

Returns true iff the current blender claims to be equivalent to BlendMode::SrcOver.

Also returns true of the current blender is None.

pub fn set_blend_mode(&mut self, mode: SkBlendMode) -> &mut Handle<SkPaint>

Helper method for calling Paint::set_blender().

This sets a blender that implements the specified blendmode enum.

pub fn blender(&self) -> Option<RCHandle<SkBlender>>

Returns the user-supplied blend function, if one has been set. Does not alter Blender’s SkRefCnt.

A None blender signifies the default SrcOver behavior.

Returns the Blender assigned to this paint, otherwise None.

pub fn set_blender( &mut self, blender: impl Into<Option<RCHandle<SkBlender>>>, ) -> &mut Handle<SkPaint>

Sets the current blender, increasing its refcnt, and if a blender is already present, decreasing that object’s refcnt.

A None blender signifies the default SrcOver behavior.

For convenience, you can call Paint::set_blend_mode() if the blend effect can be expressed as one of those values.

  • blender the Blender assigned to this paint, or None for the default

pub fn path_effect(&self) -> Option<RCHandle<SkPathEffect>>

Returns PathEffect if set, or None. Does not alter PathEffect SkRefCnt.

Returns PathEffect if previously set, None otherwise.

Example (C++): https://fiddle.skia.org/c/@Paint_refPathEffect

pub fn set_path_effect( &mut self, path_effect: impl Into<Option<RCHandle<SkPathEffect>>>, ) -> &mut Handle<SkPaint>

Sets PathEffect to path_effect, decreasing SkRefCnt of the previous PathEffect. Pass None to leave the path geometry unaltered.

Increments path_effect SkRefCnt by one.

  • path_effect replace crate::Path with a modification when drawn

Example (C++): https://fiddle.skia.org/c/@Mask_Filter_Methods Example (C++): https://fiddle.skia.org/c/@Paint_setPathEffect

pub fn mask_filter(&self) -> Option<RCHandle<SkMaskFilter>>

Returns MaskFilter if set, or None. Does not alter MaskFilter SkRefCnt.

Returns MaskFilter if previously set, None otherwise.

Example (C++): https://fiddle.skia.org/c/@Paint_refMaskFilter

pub fn set_mask_filter( &mut self, mask_filter: impl Into<Option<RCHandle<SkMaskFilter>>>, ) -> &mut Handle<SkPaint>

Sets MaskFilter to mask_filter, decreasing SkRefCnt of the previous MaskFilter. Pass None to clear MaskFilter and leave MaskFilter effect on mask alpha unaltered.

Increments mask_filter SkRefCnt by one.

  • mask_filter modifies clipping mask generated from drawn geometry

Example (C++): https://fiddle.skia.org/c/@Paint_setMaskFilter Example (C++): https://fiddle.skia.org/c/@Typeface_Methods

pub fn image_filter(&self) -> Option<RCHandle<SkImageFilter>>

Returns ImageFilter if set, or None. Does not alter ImageFilter SkRefCnt.

Returns ImageFilter if previously set, None otherwise.

Example (C++): https://fiddle.skia.org/c/@Paint_refImageFilter

pub fn set_image_filter( &mut self, image_filter: impl Into<Option<RCHandle<SkImageFilter>>>, ) -> &mut Handle<SkPaint>

Sets ImageFilter to image_filter, decreasing SkRefCnt of the previous ImageFilter. Pass None to clear ImageFilter, and remove ImageFilter effect on drawing.

Increments image_filter SkRefCnt by one.

Example (C++): https://fiddle.skia.org/c/@Paint_setImageFilter

pub fn nothing_to_draw(&self) -> bool

Returns true if Paint prevents all drawing; otherwise, the Paint may or may not allow drawing.

Returns true if, for example, BlendMode combined with alpha computes a new alpha of zero.

Returns true if Paint prevents all drawing.

Example (C++): https://fiddle.skia.org/c/@Paint_nothingToDraw

§

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 convexity.

pub fn raw( points: &[Point], verbs: &[SkPathVerb], conic_weights: &[f32], fill_type: SkPathFillType, is_volatile: impl Into<Option<bool>>, ) -> Handle<SkPath>

Create a new path with the specified spans.

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.

pub fn new_from( points: &[Point], verbs: &[u8], conic_weights: &[f32], fill_type: SkPathFillType, is_volatile: impl Into<Option<bool>>, ) -> Handle<SkPath>

👎Deprecated since 0.88.0:

use raw()

Create a new path with the specified spans.

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.

pub fn rect_with_fill_type( rect: impl AsRef<Rect>, fill_type: SkPathFillType, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>

pub fn rect( rect: impl AsRef<Rect>, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>

pub fn oval( oval: impl AsRef<Rect>, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>

pub fn oval_with_start_index( oval: impl AsRef<Rect>, dir: SkPathDirection, start_index: usize, ) -> Handle<SkPath>

pub fn circle( center: impl Into<Point>, radius: f32, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>

pub fn rrect( rect: impl AsRef<RRect>, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>

pub fn rrect_with_start_index( rect: impl AsRef<RRect>, dir: SkPathDirection, start_index: usize, ) -> Handle<SkPath>

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

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

pub fn new_with_fill_type(fill_type: SkPathFillType) -> Handle<SkPath>

Constructs an empty Path. By default, Path has no verbs, no Point, and no weights.

Returns: empty Path

pub fn new() -> Handle<SkPath>

pub fn snapshot(&self) -> Handle<SkPath>

Returns a copy of this path in the current state.

pub fn is_interpolatable(&self, compare: &Handle<SkPath>) -> 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 (C++): https://fiddle.skia.org/c/@Path_isInterpolatable

pub fn interpolate( &self, ending: &Handle<SkPath>, weight: f32, ) -> Option<Handle<SkPath>>

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 an empty Path if Point array is not the same size as ending Point array. Call is_interpolatable() to check Path compatibility prior to calling make_interpolate().

  • ending - Point array averaged with this Point array
  • weight - contribution of this Point array, and one minus contribution of ending Point array

Returns: Path replaced by interpolated averages

Example (C++): https://fiddle.skia.org/c/@Path_interpolate

pub fn interpolate_inplace( &self, ending: &Handle<SkPath>, weight: f32, out: &mut Handle<SkPath>, ) -> bool

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_inplace() 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_inplace().

  • 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 (C++): https://fiddle.skia.org/c/@Path_interpolate

pub fn fill_type(&self) -> SkPathFillType

Returns PathFillType, the rule used to fill Path.

Returns: current PathFillType setting

pub fn with_fill_type(&self, new_fill_type: SkPathFillType) -> Handle<SkPath>

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

pub fn with_toggle_inverse_fill_type(&self) -> Handle<SkPath>

Creates an Path with the same properties and data, and with PathFillType replaced with its inverse. The inverse of PathFillType describes the area unmodified by the original FillType.

pub fn is_convex(&self) -> bool

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

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 (C++): https://fiddle.skia.org/c/@Path_isOval

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 (C++): https://fiddle.skia.org/c/@Path_isRRect

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

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 (C++): https://fiddle.skia.org/c/@Path_isLastContourClosed

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

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

pub fn with_is_volatile(&self, is_volatile: bool) -> Handle<SkPath>

Return a copy of Path with is_volatile indicating whether it will be altered or discarded by the caller after it is drawn. Path by default have volatile set false, allowing Skia to attach a cache of data which speeds repeated drawing.

Mark temporary paths, discarded or modified after use, as volatile to inform Skia 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: Path

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 (C++): https://fiddle.skia.org/c/@Path_IsLineDegenerate

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

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

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 (C++): https://fiddle.skia.org/c/@Path_isLine

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

Return a read-only view into the path’s points.

pub fn verbs(&self) -> &[SkPathVerb]

Return a read-only view into the path’s verbs.

pub fn conic_weights(&self) -> &[f32]

Return a read-only view into the path’s conic-weights.

pub fn count_points(&self) -> usize

pub fn count_verbs(&self) -> usize

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

Return the last point, or None

Returns: The last if the path contains one or more Point, else returns None

Example (C++): https://fiddle.skia.org/c/@Path_getLastPt

§

impl Handle<SkPath>

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

👎Deprecated since 0.91.0:

use points()

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

  • index - Point array element selector

Returns: Point array value

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

👎Deprecated since 0.91.0:

use points()

Returns number of points in Path. Copies N points from the path into the span, where N = min(#points, span capacity) DEPRECATED

  • points - span to receive the points. may be empty

Returns: the number of points in the path

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

👎Deprecated since 0.91.0

Returns number of points in Path. Copies N points from the path into the span, where N = min(#points, span capacity) DEPRECATED

  • verbs - span to store the verbs. may be empty.

Returns: the number of verbs in the path

Example (C++): https://fiddle.skia.org/c/@Path_getVerbs

§

impl Handle<SkPath>

pub fn approximate_bytes_used(&self) -> usize

Returns the approximate byte size of the Path in memory.

Returns: approximate size

pub fn bounds(&self) -> &Rect

Returns the min/max of the path’s ‘trimmed’ points. The trimmed points are all of the points in the path, with the exception of the path having more than one contour, and the final contour containing only a Verb::Move. In that case the trailing Verb::Move point is ignored when computing the bounds.

If the path has no verbs, or the path contains non-finite values, then {0, 0, 0, 0} is returned. (see is_finite())

Returns: bounds of the path’s points

pub fn update_bounds_cache(&mut self) -> &mut Handle<SkPath>

👎Deprecated since 0.100.0:

SkPath bounds are no longer computed lazily

Calls Self::bounds() and ignores the result.

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 (C++): https://fiddle.skia.org/c/@Path_computeTightBounds

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 (C++): https://fiddle.skia.org/c/@Path_conservativelyContainsRect

§

impl Handle<SkPath>

pub fn convert_conic_to_quads( p0: impl Into<Point>, p1: impl Into<Point>, p2: impl Into<Point>, w: f32, 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

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

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 (C++): https://fiddle.skia.org/c/@Path_isRect

§

impl Handle<SkPath>

pub fn try_make_transform(&self, matrix: &Matrix) -> Option<Handle<SkPath>>

Return a copy of Path with verb array, Point array, and weight transformed by matrix. try_make_transform may change verbs and increase their number.

If the resulting path has any non-finite values, returns None.

Returns: Path if finite, or None

pub fn try_make_offset(&self, d: impl Into<Point>) -> Option<Handle<SkPath>>

pub fn try_make_scale(&self, _: (f32, f32)) -> Option<Handle<SkPath>>

pub fn with_transform(&self, matrix: &Matrix) -> Handle<SkPath>

Return a copy of Path with verb array, Point array, and weight transformed by matrix. with_transform may change verbs and increase their number.

If the resulting path has any non-finite values, this will still return a path but that path will return true for is_finite().

The newer pattern is to call try_make_transform which will only return a path if the result is finite.

Returns: Path

pub fn make_transform(&self, m: &Matrix) -> Handle<SkPath>

pub fn with_offset(&self, d: impl Into<Point>) -> Handle<SkPath>

Returns Path with Point array offset by (d.x, d.y).

  • d - offset added to Point array coordinates

Returns: Path

pub fn make_offset(&self, d: impl Into<Point>) -> Handle<SkPath>

pub fn make_scale(&self, _: (f32, f32)) -> Handle<SkPath>

§

impl Handle<SkPath>

pub fn segment_masks(&self) -> PathSegmentMask

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

§

impl Handle<SkPath>

pub fn set_is_volatile(&mut self, is_volatile: bool) -> &mut Handle<SkPath>

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

pub fn swap(&mut self, other: &mut Handle<SkPath>) -> &mut Handle<SkPath>

Exchanges the verb array, Point array, weights, and PathFillType 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 (C++): https://fiddle.skia.org/c/@Path_swap

pub fn set_fill_type(&mut self, ft: SkPathFillType) -> &mut Handle<SkPath>

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

pub fn toggle_inverse_fill_type(&mut self) -> &mut Handle<SkPath>

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

pub fn reset(&mut self) -> &mut Handle<SkPath>

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 (C++): https://fiddle.skia.org/c/@Path_reset

§

impl Handle<SkPath>

pub fn detach(&mut self) -> Handle<SkPath>

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

pub fn iter(&self) -> PathIter<'_> ⓘ

§

impl Handle<SkPath>

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

Returns true if the point is contained by Path, taking into account PathFillType.

  • point - the point to test

Returns: true if Point is in Path

pub fn dump_as_data(&self, dump_as_hex: bool) -> RCHandle<SkData>

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 (C++): https://fiddle.skia.org/c/@Path_dump

pub fn dump(&self)

pub fn dump_hex(&self)

pub fn serialize(&self) -> RCHandle<SkData>

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

serialize() writes PathFillType, 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 (C++): https://fiddle.skia.org/c/@Path_serialize

pub fn deserialize(data: &RCHandle<SkData>) -> Option<Handle<SkPath>>

pub fn generation_id(&self) -> u64

(See skbug.com/40032862) Returns a non-zero, globally unique value. A different value is returned if verb array, Point array, or conic weight changes.

Setting PathFillType does not change generation identifier.

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

Returns: non-zero, globally unique value

Example (C++): https://fiddle.skia.org/c/@Path_getGenerationID

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

§

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);

pub fn new( path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> Handle<SkPathMeasure>

Initializes the path measure with the specified path. The parts of the path that are needed are copied, so the client is free to modify/delete the path after this call.

res_scale controls the precision of the measure. Values > 1 increase the precision (and possibly slow down the computation).

  • path path to measure
  • force_closed whether to treat the path as closed
  • res_scale precision of the measure

pub fn from_path( path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> Handle<SkPathMeasure>

👎Deprecated since 0.48.0:

Use PathMeasure::new

pub fn set_path( &mut self, path: &Handle<SkPath>, force_closed: bool, ) -> &mut Handle<SkPathMeasure>

Resets the path measure with the specified path. The parts of the path that are needed are copied, so the client is free to modify/delete the path after this call.

  • path path to measure
  • force_closed whether to treat the path as closed

pub fn length(&mut self) -> f32

Returns the total length of the current contour, or 0 if no path is associated.

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

Pins distance to 0 <= distance <= length(), and then computes the corresponding position and tangent. Returns None if there is no path, or a zero-length path was specified, in which case the position and tangent are unchanged.

  • distance distance along the contour

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

👎Deprecated since 0.88.0:

Use get_matrix()

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

Pins distance to 0 <= distance <= length(), and then computes the corresponding matrix (by calling Self::pos_tan()). Returns false if there is no path, or a zero-length path was specified, in which case matrix is unchanged.

  • distance distance along the contour
  • matrix storage for the computed matrix
  • flags which matrix components to compute

pub fn segment( &mut self, start_d: f32, stop_d: f32, start_with_move_to: bool, ) -> Option<Handle<SkPath>>

👎Deprecated since 0.88.0:

Use get_segment()

pub fn get_segment( &mut self, start_d: f32, stop_d: f32, dst: &mut RefHandle<SkPathBuilder>, start_with_move_to: bool, ) -> bool

Given a start and stop distance, appends to dst the intervening segment(s). If the segment is zero-length, returns false, else returns true. start_d and stop_d are pinned to legal values (0..length()). If start_d > stop_d then returns false (and leaves dst untouched). Begins the segment with a move-to if start_with_move_to is true.

  • start_d start distance
  • stop_d stop distance
  • dst path builder receiving the segment
  • start_with_move_to whether to begin with a move-to

pub fn is_closed(&mut self) -> bool

Returns true if the current contour is closed.

pub fn next_contour(&mut self) -> bool

Moves to the next contour in the path. Returns true if one exists, or false if we’re done with the path.

pub fn current_measure(&self) -> &Option<RCHandle<SkContourMeasure>>

§

impl Handle<SkPictureRecorder>

pub fn new() -> Handle<SkPictureRecorder>

pub fn begin_recording( &mut self, bounds: impl AsRef<Rect>, use_bbh: bool, ) -> &Canvas

Returns the canvas that records the drawing commands.

  • bounds the cull rect used when recording this picture. Any drawing that falls outside of this rect is undefined, and may be drawn or it may not
  • use_bbh whether to use a bounding box hierarchy

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

Returns the recording canvas if one is active, or None if recording is not active. This does not alter the ref count on the canvas (if present).

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

Signals that the caller is done recording. This invalidates the canvas returned by Self::begin_recording() or Self::recording_canvas().

The returned picture is immutable. If during recording drawables were added to the canvas, these will have been “drawn” into a recording canvas, so that this resulting picture will reflect their current state, but will not contain a live reference to the drawables themselves.

  • cull_rect optional cull rectangle

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

Signals that the caller is done recording. This invalidates the canvas returned by Self::begin_recording() or Self::recording_canvas().

Unlike Self::finish_recording_as_picture(), which returns an immutable picture, the returned drawable may contain live references to other drawables (if they were added to the recording canvas) and therefore this drawable will reflect the current state of those nested drawables anytime it is drawn or a new picture is snapped from it.

§

impl Handle<SkRegion>

pub fn new() -> Handle<SkRegion>

Constructs an empty region. The region is set to empty bounds at (0, 0) with zero width and height.

Example (C++): https://fiddle.skia.org/c/@Region_empty_constructor

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

Constructs a rectangular region matching the bounds of rect.

  • rect bounds of the constructed region

Example (C++): https://fiddle.skia.org/c/@Region_copy_const_SkIRect

pub fn set(&mut self, src: &Handle<SkRegion>) -> bool

Sets the region to src, and returns true if src bounds is not empty. This makes the region and src identical by value. Internally, the region and src share pointer values. The underlying rectangle array is copied when modified.

Creating a region copy is very efficient and never allocates memory. Regions are always copied by value from the interface; the underlying shared pointers are not exposed.

  • src region to copy

pub fn swap(&mut self, other: &mut Handle<SkRegion>)

Exchanges the rectangle array of the region and other. swap internally exchanges pointers, so it is lightweight and does not allocate memory.

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

  • other region to swap with

Example (C++): https://fiddle.skia.org/c/@Region_swap

pub fn is_empty(&self) -> bool

Returns true if the region is empty. An empty region has bounds width or height less than or equal to zero. The default constructor constructs an empty region; set_empty and set_rect with dimensionless data make the region empty.

pub fn is_rect(&self) -> bool

Returns true if the region is one IRect with positive dimensions.

pub fn is_complex(&self) -> bool

Returns true if the region is described by more than one rectangle.

pub fn bounds(&self) -> &IRect

Returns the minimum and maximum axes values of the rectangle array. Returns (0, 0, 0, 0) if the region is empty.

pub fn compute_region_complexity(&self) -> usize

Returns a value that increases with the number of elements in the region. Returns zero if the region is empty. Returns one if the region equals an IRect; otherwise, returns a value greater than one indicating that the region is complex.

Call to compare regions for relative complexity.

Example (C++): https://fiddle.skia.org/c/@Region_computeRegionComplexity

pub fn add_boundary_path(&self, path: &mut RefHandle<SkPathBuilder>) -> bool

Appends the outline of the region to the path builder. Returns true if the region is not empty; otherwise, returns false, and leaves the path unmodified.

  • path path to append to

Example (C++): https://fiddle.skia.org/c/@Region_getBoundaryPath

pub fn get_boundary_path(&self, path: &mut Handle<SkPath>) -> bool

👎Deprecated since 0.91.0:

Use boundary_path()

pub fn boundary_path(&self) -> Option<Handle<SkPath>>

Returns the boundary of the region as a path, or None if the region is empty.

pub fn set_empty(&mut self) -> bool

Constructs an empty region. The region is set to empty bounds at (0, 0) with zero width and height. Always returns false.

Example (C++): https://fiddle.skia.org/c/@Region_setEmpty

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

Constructs a rectangular region matching the bounds of rect. If rect is empty, constructs an empty region and returns false.

  • rect bounds of the constructed region

Example (C++): https://fiddle.skia.org/c/@Region_setRect

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

Constructs a region as the union of the rectangles in rects. If rects is empty, constructs an empty region. Returns false if the constructed region is empty.

May be faster than repeated calls to op.

  • rects array of rectangles

Example (C++): https://fiddle.skia.org/c/@Region_setRects

pub fn set_region(&mut self, region: &Handle<SkRegion>) -> bool

Sets the region to a copy of region. Creating a region copy is very efficient and never allocates memory. Regions are always copied by value from the interface; the underlying shared pointers are not exposed.

  • region region to copy by value

Example (C++): https://fiddle.skia.org/c/@Region_setRegion

pub fn set_path( &mut self, path: &Handle<SkPath>, clip: &Handle<SkRegion>, ) -> bool

Constructs a region to match the outline of path within clip. Returns false if the constructed region is empty.

The constructed region draws the same pixels as path through clip when anti-aliasing is disabled.

  • path path providing outline
  • clip region containing path

Example (C++): https://fiddle.skia.org/c/@Region_setPath

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

Returns true if the region intersects rect. Returns false if either rect or the region is empty, or they do not intersect.

  • rect rectangle to intersect

Example (C++): https://fiddle.skia.org/c/@Region_intersects

pub fn intersects_region(&self, other: &Handle<SkRegion>) -> bool

Returns true if the region intersects other. Returns false if either other or the region is empty, or they do not intersect.

  • other region to intersect

Example (C++): https://fiddle.skia.org/c/@Region_intersects_2

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

Returns true if the point (point.x, point.y) is inside the region. Returns false if the region is empty.

  • point test point

Example (C++): https://fiddle.skia.org/c/@Region_contains

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

Returns true if rect is completely inside the region. Returns false if the region or rect is empty.

  • rect rectangle to contain

Example (C++): https://fiddle.skia.org/c/@Region_contains_2

pub fn contains_region(&self, other: &Handle<SkRegion>) -> bool

Returns true if other is completely inside the region. Returns false if the region or other is empty.

  • other region to contain

Example (C++): https://fiddle.skia.org/c/@Region_contains_3

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

Returns true if the region is a single rectangle and contains r. May return false even though the region contains r.

  • r rectangle to contain

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

Returns true if the region does not intersect rect. Returns true if rect is empty or the region is empty. May return false even though the region does not intersect rect.

  • rect rectangle to intersect

pub fn quick_reject_region(&self, rgn: &Handle<SkRegion>) -> bool

Returns true if the region does not intersect rgn. Returns true if rgn is empty or the region is empty. May return false even though the region does not intersect rgn.

  • rgn region to intersect

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

Offsets the region by the vector (d.x, d.y). Has no effect if the region is empty.

  • d offset vector

Example (C++): https://fiddle.skia.org/c/@Region_translate_2

pub fn translated(&self, d: impl Into<IPoint>) -> Handle<SkRegion>

Returns a copy of the region offset by the vector (d.x, d.y).

  • d offset vector

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

Replaces the region with the result of the region op rect. Returns true if the replaced region is not empty.

  • rect rectangle operand
  • op logical operation

pub fn op_region(&mut self, region: &Handle<SkRegion>, op: SkRegion_Op) -> bool

Replaces the region with the result of the region op region. Returns true if the replaced region is not empty.

  • region region operand
  • op logical operation

Example (C++): https://fiddle.skia.org/c/@Region_op_6

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

Replaces the region with the result of rect op region. Returns true if the replaced region is not empty.

  • rect rectangle operand
  • region region operand
  • op logical operation

Example (C++): https://fiddle.skia.org/c/@Region_op_4

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

Replaces the region with the result of region op rect. Returns true if the replaced region is not empty.

  • region region operand
  • rect rectangle operand
  • op logical operation

Example (C++): https://fiddle.skia.org/c/@Region_op_5

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

Writes the region to buf, and returns the number of bytes written.

  • buf storage for binary data

Example (C++): https://fiddle.skia.org/c/@Region_writeToMemory

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

Constructs the region from buf of size buf.len(). Returns the bytes read. The returned value will be a multiple of four or zero if the length was too small.

  • buf storage for binary data

Example (C++): https://fiddle.skia.org/c/@Region_readFromMemory

§

impl Handle<SkStrikeRef>

pub fn get_widths(&self, glyphs: &[u16], widths: &mut [f32])

Retrieves the advance widths for each glyph.

widths receives min(widths.len(), glyphs.len()) values.

  • glyphs array of glyph indices to be measured
  • widths returns text advances for each glyph, in font units

pub fn get_width(&self, glyph: u16) -> f32

Retrieves the advance width for a single glyph.

  • glyph glyph index to be measured

Returns advance width in font units.

pub fn get_widths_strided( &self, count: usize, glyphs: &[u32], glyph_stride_32: usize, advances: &mut [f32], advance_stride_32: usize, )

Retrieves the advance widths for each glyph, handling arbitrary strides for both input glyphs and output advances.

  • count number of glyphs to measure
  • glyphs slice containing the first glyph ID, glyph is 32-bit, instead of GlyphId, in preparation for large glyph ids.
  • glyph_stride_32 stride in 32-bit words between input glyph IDs
  • advances slice containing the first output advance
  • advance_stride_32 stride in 32-bit words between output advances

pub fn get_widths_bounds( &self, glyphs: &[u16], widths: Option<&mut [f32]>, bounds: Option<&mut [Rect]>, )

Retrieves the advance widths and bounds for each glyph.

widths receives min(widths.len(), glyphs.len()) values. bounds receives min(bounds.len(), glyphs.len()) values.

  • glyphs array of glyph indices to be measured
  • widths returns text advances for each glyph
  • bounds returns bounds for each glyph relative to (0, 0)
§

impl Handle<SkStrokeRec>

pub fn new(init_style: SkStrokeRec_InitStyle) -> Handle<SkStrokeRec>

pub fn new_hairline() -> Handle<SkStrokeRec>

pub fn new_fill() -> Handle<SkStrokeRec>

pub fn from_paint( paint: &Handle<SkPaint>, style: impl Into<Option<SkPaint_Style>>, res_scale: impl Into<Option<f32>>, ) -> Handle<SkStrokeRec>

pub fn style(&self) -> SkStrokeRec_Style

pub fn width(&self) -> f32

pub fn miter(&self) -> f32

pub fn cap(&self) -> SkPaint_Cap

pub fn join(&self) -> SkPaint_Join

pub fn is_hairline_style(&self) -> bool

pub fn is_fill_style(&self) -> bool

pub fn set_fill_style(&mut self) -> &mut Handle<SkStrokeRec>

pub fn set_hairline_style(&mut self) -> &mut Handle<SkStrokeRec>

pub fn set_stroke_style( &mut self, width: f32, stroke_and_fill: impl Into<Option<bool>>, ) -> &mut Handle<SkStrokeRec>

Specify the stroke width, and optionally if you want stroke + fill.

Note, if width is 0, then this request is taken to mean: stroke_and_fill set to Some(true) -> new style will be Style::Fill stroke_and_fill set to Some(false) or None -> new style will be Style::Hairline

  • width the stroke width
  • stroke_and_fill whether to stroke and fill

pub fn set_stroke_params( &mut self, cap: SkPaint_Cap, join: SkPaint_Join, miter_limit: f32, ) -> &mut Handle<SkStrokeRec>

pub fn res_scale(&self) -> f32

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

pub fn need_to_apply(&self) -> bool

Returns true if this specifies any thick stroking, i.e. Self::apply_to_path() will return true.

pub fn apply_to_path( &self, dst: &mut RefHandle<SkPathBuilder>, src: &Handle<SkPath>, ) -> bool

Apply these stroke parameters to the src path, returning the result in dst.

If there was no change (i.e. style == Style::Hairline or Style::Fill) this returns false and dst is unchanged. Otherwise returns true and the result is stored in dst.

src and dst may be the same path.

  • dst path builder receiving the result
  • src source path

pub fn apply_to_path_inplace(&self, path: &mut Handle<SkPath>) -> bool

👎Deprecated since 0.88.0:

Use apply_to_path()

pub fn apply_to_paint(&self, paint: &mut Handle<SkPaint>)

Applies these stroke parameters to a paint.

  • paint paint to apply the stroke parameters to

pub fn inflation_radius(&self) -> f32

Gives a conservative value for the outset that should be applied to a geometry’s bounds to account for any inflation due to applying this stroke record to the geometry.

pub fn inflation_radius_from_paint_and_style( paint: &Handle<SkPaint>, style: SkPaint_Style, ) -> f32

Equivalent to constructing a stroke record from paint and style and calling Self::inflation_radius(). This does not account for other effects on the paint (i.e. path effects).

  • paint paint used to construct the stroke record
  • style style used to construct the stroke record

pub fn inflation_radius_from_params( join: SkPaint_Join, miter_limit: f32, cap: SkPaint_Cap, stroke_width: f32, ) -> f32

pub fn has_equal_effect(&self, other: &Handle<SkStrokeRec>) -> bool

Compares if two stroke records have an equal effect on a path. Equal stroke records produce equal paths. Equality of produced paths does not take the res scale parameter into account.

  • other stroke record to compare with
§

impl Handle<SkTextBlobBuilder>

pub fn new() -> Handle<SkTextBlobBuilder>

Constructs an empty text blob builder. By default, the text blob builder has no runs.

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

Returns a TextBlob built from runs of glyphs added by the builder. The returned TextBlob is immutable; it may be copied, but its contents may not be altered. Returns None if no runs of glyphs were added by the builder.

Resets the text blob builder to its initial empty state, allowing it to be reused to build a new set of runs.

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

Returns a run with storage for glyphs. The caller must write count glyphs to the returned glyph buffer before the next call to the text blob builder.

Glyphs share metrics in font.

Glyphs are positioned on a baseline at offset, using font metrics to determine their relative placement.

bounds defines an optional bounding box, used to suppress drawing when the text blob bounds does not intersect the surface bounds. If bounds is None, the text blob bounds is computed from offset and the glyph metrics.

  • font font used for this run
  • count number of glyphs
  • offset horizontal and vertical offset within the blob
  • bounds optional run bounding box

pub fn alloc_run_pos_h( &mut self, font: &Handle<SkFont>, count: usize, y: f32, bounds: Option<&Rect>, ) -> (&mut [u16], &mut [f32])

Returns a run with storage for glyphs and positions along a baseline. The caller must write count glyphs to the returned glyph buffer and count scalars to the returned position buffer before the next call to the text blob builder.

Glyphs share metrics in font.

Glyphs are positioned on a baseline at y, using x-axis positions written by the caller to the returned position buffer.

bounds defines an optional bounding box, used to suppress drawing when the text blob bounds does not intersect the surface bounds. If bounds is None, the text blob bounds is computed from y, the position buffer, and the glyph metrics.

  • font font used for this run
  • count number of glyphs
  • y vertical offset within the blob
  • bounds optional run bounding box

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

Returns a run with storage for glyphs and point positions. The caller must write count glyphs to the returned glyph buffer and count points to the returned position buffer before the next call to the text blob builder.

Glyphs share metrics in font.

Glyphs are positioned using the points written by the caller to the returned position buffer, using two scalar values for each point.

bounds defines an optional bounding box, used to suppress drawing when the text blob bounds does not intersect the surface bounds. If bounds is None, the text blob bounds is computed from the position buffer and the glyph metrics.

  • font font used for this run
  • count number of glyphs
  • bounds optional run bounding box

pub fn alloc_run_rsxform( &mut self, font: &Handle<SkFont>, count: usize, ) -> (&mut [u16], &mut [RSXform])

Returns a run with storage for glyphs and RSXform positions. The caller must write count glyphs to the returned glyph buffer and count RSXforms to the returned position buffer before the next call to the text blob builder.

Glyphs share metrics in font.

  • font font used for this run
  • count number of glyphs

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

Returns a run with storage for glyphs, text, and clusters. The caller must write count glyphs to the returned glyph buffer, text_byte_count UTF-8 code units into the returned text buffer, and count monotonic indexes into the text buffer into the returned cluster buffer before the next call to the text blob builder.

Glyphs share metrics in font.

Glyphs are positioned on a baseline at offset, using font metrics to determine their relative placement.

bounds defines an optional bounding box, used to suppress drawing when the text blob bounds does not intersect the surface bounds. If bounds is None, the text blob bounds is computed from offset and the glyph metrics.

  • font font used for this run
  • count number of glyphs
  • offset horizontal and vertical offset within the blob
  • text_byte_count number of UTF-8 code units
  • bounds optional run bounding box

pub fn alloc_run_text_pos_h( &mut self, font: &Handle<SkFont>, count: usize, y: f32, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [u16], &mut [f32], &mut [u8], &mut [u32])

Returns a run with storage for glyphs, positions along a baseline, text, and clusters. The caller must write count glyphs to the returned glyph buffer, count scalars to the returned position buffer, text_byte_count UTF-8 code units into the returned text buffer, and count monotonic indexes into the text buffer into the returned cluster buffer before the next call to the text blob builder.

Glyphs share metrics in font.

Glyphs are positioned on a baseline at y, using x-axis positions written by the caller to the returned position buffer.

bounds defines an optional bounding box, used to suppress drawing when the text blob bounds does not intersect the surface bounds. If bounds is None, the text blob bounds is computed from y, the position buffer, and the glyph metrics.

  • font font used for this run
  • count number of glyphs
  • y vertical offset within the blob
  • text_byte_count number of UTF-8 code units
  • bounds optional run bounding box

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

Returns a run with storage for glyphs, point positions, text, and clusters. The caller must write count glyphs to the returned glyph buffer, count points to the returned position buffer, text_byte_count UTF-8 code units into the returned text buffer, and count monotonic indexes into the text buffer into the returned cluster buffer before the next call to the text blob builder.

Glyphs share metrics in font.

Glyphs are positioned using the points written by the caller to the returned position buffer, using two scalar values for each point.

bounds defines an optional bounding box, used to suppress drawing when the text blob bounds does not intersect the surface bounds. If bounds is None, the text blob bounds is computed from the position buffer and the glyph metrics.

  • font font used for this run
  • count number of glyphs
  • text_byte_count number of UTF-8 code units
  • bounds optional run bounding box

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

§

impl Handle<SkVertices_Builder>

pub fn new( mode: SkVertices_VertexMode, vertex_count: usize, index_count: usize, flags: BuilderFlags, ) -> Handle<SkVertices_Builder>

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

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

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

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

pub fn is_volatile(&self) -> bool

👎Deprecated since 0.29.0:

returns false

pub fn bone_indices(&mut self) -> Option<&mut [[u32; 4]]>

👎Deprecated since 0.29.0:

returns None

pub fn bone_weights(&mut self) -> Option<&mut [[u32; 4]]>

👎Deprecated since 0.29.0:

returns None

pub fn detach(self) -> RCHandle<SkVertices>

Detaches the built vertices object. This consumes the builder, so it can only be called once.

§

impl Handle<SkYUVAInfo>

pub const MAX_PLANES: usize

pub fn new( dimensions: impl Into<ISize>, config: SkYUVAInfo_PlaneConfig, subsampling: Subsampling, color_space: SkYUVColorSpace, origin: impl Into<Option<EncodedOrigin>>, siting_xy: impl Into<Option<(SkYUVAInfo_Siting, SkYUVAInfo_Siting)>>, ) -> Option<Handle<SkYUVAInfo>>

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).

pub fn plane_config(&self) -> SkYUVAInfo_PlaneConfig

pub fn subsampling(&self) -> Subsampling

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

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).

pub fn width(&self) -> i32

pub fn height(&self) -> i32

pub fn yuv_color_space(&self) -> SkYUVColorSpace

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

pub fn origin(&self) -> EncodedOrigin

pub fn origin_matrix(&self) -> Matrix

pub fn inverse_origin_matrix(&self) -> Matrix

pub fn has_alpha(&self) -> bool

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)].

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.

pub fn num_planes(&self) -> usize

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

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

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.

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

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.

§

impl Handle<SkYUVAPixmapInfo>

pub const MAX_PLANES: usize

pub const DATA_TYPE_CNT: usize

pub fn new( info: &Handle<SkYUVAInfo>, color_types: &[ColorType], row_bytes: Option<&[usize]>, ) -> Option<Handle<SkYUVAPixmapInfo>>

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.

pub fn from_data_type( info: &Handle<SkYUVAInfo>, data_type: SkYUVAPixmapInfo_DataType, row_bytes: Option<&[usize]>, ) -> Option<Handle<SkYUVAPixmapInfo>>

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.

pub fn yuva_info(&self) -> &Handle<SkYUVAInfo>

pub fn yuv_color_space(&self) -> SkYUVColorSpace

pub fn num_planes(&self) -> usize

The number of Pixmap planes.

pub fn data_type(&self) -> SkYUVAPixmapInfo_DataType

The per-YUV[A] channel data type.

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

Row bytes for the ith plane.

Returns None if i is out of range.

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

Row bytes for all planes.

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

Image info for the ith plane.

Returns None if i is out of range.

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

An iterator of all planes’ image infos.

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.

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.

pub fn is_supported( &self, data_types: &Handle<SkYUVAPixmapInfo_SupportedDataTypes>, ) -> bool

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

§

impl Handle<SkYUVAPixmaps>

pub const MAX_PLANES: usize = YUVAPixmapInfo::MAX_PLANES

pub fn recommended_rgba_color_type(dt: SkYUVAPixmapInfo_DataType) -> ColorType

pub fn allocate( info: &Handle<SkYUVAPixmapInfo>, ) -> Option<Handle<SkYUVAPixmaps>>

Allocate space for pixmaps’ pixels in the YUVAPixmaps.

pub fn from_data( info: &Handle<SkYUVAPixmapInfo>, data: impl Into<RCHandle<SkData>>, ) -> Option<Handle<SkYUVAPixmaps>>

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

pub unsafe fn from_external_memory( info: &Handle<SkYUVAPixmapInfo>, memory: *mut c_void, ) -> Option<Handle<SkYUVAPixmaps>>

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::compute_total_bytes() allocated starting at memory.

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

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, …).

pub fn yuva_info(&self) -> &Handle<SkYUVAInfo>

pub fn data_type(&self) -> SkYUVAPixmapInfo_DataType

pub fn pixmaps_info(&self) -> Handle<SkYUVAPixmapInfo>

pub fn num_planes(&self) -> usize

Number of pixmap planes.

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

Access the Pixmap planes.

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

Get the ith Pixmap plane.

Panics if i is out of range.

§

impl Handle<SkYUVAPixmapInfo_SupportedDataTypes>

pub fn all() -> Handle<SkYUVAPixmapInfo_SupportedDataTypes>

All legal combinations of PlaneConfig and DataType are supported.

pub fn supported( &self, pc: SkYUVAInfo_PlaneConfig, dt: SkYUVAPixmapInfo_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.

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

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

§

impl Handle<SkColorMatrix>

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, ) -> Handle<SkColorMatrix>

pub fn rgb_to_yuv(rgb: SkYUVColorSpace) -> Handle<SkColorMatrix>

pub fn yuv_to_rgb(yuv: SkYUVColorSpace) -> Handle<SkColorMatrix>

pub fn set_identity(&mut self)

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

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

pub fn set_concat( &mut self, a: &Handle<SkColorMatrix>, b: &Handle<SkColorMatrix>, )

pub fn pre_concat(&mut self, mat: &Handle<SkColorMatrix>)

pub fn post_concat(&mut self, mat: &Handle<SkColorMatrix>)

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

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

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

§

impl Handle<SkRuntimeEffect_Uniform>

pub fn name(&self) -> &str

The name of the uniform variable in the effect’s SkSL.

pub fn offset(&self) -> usize

The offset in bytes of the uniform within the uniform data block.

pub fn ty(&self) -> SkRuntimeEffect_Uniform_Type

The SkSL type of the uniform.

pub fn count(&self) -> i32

The number of elements in the uniform. 1 for non-array uniforms.

pub fn flags(&self) -> Flags

The flags of the uniform, see uniform::Flags.

pub fn is_array(&self) -> bool

Returns true if the uniform is declared as an array. Uniform::count() contains the array length.

pub fn is_color(&self) -> bool

Returns true if the uniform is declared with layout(color). Colors should be supplied as unpremultiplied, extended-range (unclamped) sRGB. The uniform will be automatically transformed to unpremultiplied extended-range working-space colors.

pub fn size_in_bytes(&self) -> usize

The size in bytes of the uniform (or the whole array, for array uniforms).

§

impl Handle<SkRuntimeEffect_Child>

pub fn name(&self) -> &str

The name of the child in the effect’s SkSL.

pub fn ty(&self) -> SkRuntimeEffect_ChildType

The ChildType of the child.

pub fn index(&self) -> usize

The index of the child in RuntimeEffect::children().

§

impl Handle<SkRuntimeEffectBuilder>

pub fn new(effect: RCHandle<SkRuntimeEffect>) -> Handle<SkRuntimeEffectBuilder>

Creates a builder for effect that manages creating an input data block and provides named access to the uniform variables in that block. The equivalent of Skia’s SkRuntimeEffectBuilder.

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

Creates the Shader from the configured builder.

  • local_matrix the local matrix applied to the resulting shader

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]

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]
§

impl Handle<SkBitmap>

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

Encodes the pixels of this bitmap into an image in the given format, and returns the encoded bytes, or None if the format is not supported or the encoding fails.

  • quality An encoder specific value in the range 0..=100. None selects the default of 100.
§

impl Handle<GrBackendSemaphore>

pub fn backend(&self) -> GrBackendApi

§

impl Handle<GrBackendFormat>

pub fn new_gl(format: u32, target: u32) -> Handle<GrBackendFormat>

Creates a BackendFormat for a GL format and texture target.

pub fn backend(&self) -> GrBackendApi

The crate::gpu::ganesh::BackendApi this format is used with.

pub fn channel_mask(&self) -> u32

Gets the channels present in the format as a bitfield of crate::ColorChannelFlag values. Luminance channels are reported as crate::ColorChannelFlag::GRAY.

pub fn as_gl_format(&self) -> GrGLFormat

The GL format of this BackendFormat, or None if this format is not GL.

pub fn as_gl_format_enum(&self) -> u32

The GL format enum of this BackendFormat, or None if this format is not GL.

pub fn to_texture_2d(&self) -> Handle<GrBackendFormat>

If possible, copies the BackendFormat and forces the texture type to be Texture2D. If the BackendFormat was for Vulkan and it originally had a skgpu::VulkanYcbcrConversionInfo, the conversion is removed and the format is set to be VK_FORMAT_R8G8B8A8_UNORM.

§

impl Handle<GrBackendRenderTarget>

pub fn dimensions(&self) -> ISize

The dimensions of the render target in pixels.

pub fn width(&self) -> i32

The width of the render target in pixels.

pub fn height(&self) -> i32

The height of the render target in pixels.

pub fn sample_count(&self) -> usize

The number of samples per pixel.

pub fn stencil_bits(&self) -> usize

The number of stencil bits.

pub fn backend(&self) -> GrBackendApi

The crate::gpu::ganesh::BackendApi this render target is used with.

pub fn is_framebuffer_only(&self) -> bool

Whether this render target is only usable as a framebuffer.

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

The GL framebuffer info, or None if this render target is not GL.

pub fn backend_format(&self) -> Handle<GrBackendFormat>

Get the BackendFormat for this render target (or an invalid format if this is not valid).

pub fn set_mutable_state(&mut self, state: &RCHandle<skgpu_MutableTextureState>)

If the client changes any of the mutable state of the BackendRenderTarget they should call this function to inform Skia that those values have changed. The backend API specific state that can be set from this function are:

Vulkan: VkImageLayout and QueueFamilyIndex

pub fn is_protected(&self) -> bool

Returns true if we are working with protected content.

§

impl Handle<GrGLExtensions>

pub fn is_initialized(&self) -> bool

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

Queries whether an extension is present. This will fail if init() has not been called.

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

Removes an extension if present. Returns true if the extension was present before the call.

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

Adds an extension to list

pub fn reset(&mut self)

§

impl Handle<GrYUVABackendTextureInfo>

pub const MAX_PLANES: usize = YUVAInfo::MAX_PLANES

pub fn new( info: &Handle<SkYUVAInfo>, formats: &[Handle<GrBackendFormat>], mip_mapped: skgpu_Mipmapped, origin: GrSurfaceOrigin, ) -> Option<Handle<GrYUVABackendTextureInfo>>

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.

pub fn yuva_info(&self) -> &Handle<SkYUVAInfo>

The YUVAInfo describing the planar layout.

pub fn yuv_color_space(&self) -> SkYUVColorSpace

The YUVColorSpace of the planar layout.

pub fn mipmapped(&self) -> skgpu_Mipmapped

Whether the described textures are mipmapped.

pub fn texture_origin(&self) -> GrSurfaceOrigin

The origin that all the described textures share.

pub fn num_planes(&self) -> usize

The number of crate::Pixmap planes.

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

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

pub fn plane_formats(&self) -> &[Handle<GrBackendFormat>]

All plane formats.

§

impl Handle<SkDynamicMemoryWStream>

pub fn new() -> Handle<SkDynamicMemoryWStream>

pub fn from_bytes(bytes: &[u8]) -> Handle<SkDynamicMemoryWStream>

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

pub fn detach_as_data(&mut self) -> RCHandle<SkData>

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

§

impl Handle<SkString>

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

pub fn as_str(&self) -> &str

§

impl Handle<SkStrings>

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

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

pub fn is_empty(&self) -> bool

pub fn len(&self) -> usize

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

§

impl Handle<skia_textlayout_FontArguments>

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

§

impl Handle<skia_textlayout_Paragraph_VisitorInfo>

pub fn font(&self) -> &Handle<SkFont>

pub fn origin(&self) -> Point

pub fn advance_x(&self) -> f32

pub fn count(&self) -> usize

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

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

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

pub fn flags(&self) -> VisitorFlags

§

impl Handle<skia_textlayout_Paragraph_ExtendedVisitorInfo>

pub fn font(&self) -> &Handle<SkFont>

pub fn origin(&self) -> Point

pub fn advance(&self) -> Size

pub fn count(&self) -> usize

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

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

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

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

pub fn flags(&self) -> VisitorFlags

§

impl Handle<skia_textlayout_ParagraphCache>

pub fn new() -> Handle<skia_textlayout_ParagraphCache>

pub fn abandon(&mut self)

pub fn reset(&mut self)

pub fn print_statistics(&mut self)

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

pub fn count(&mut self) -> i32

§

impl Handle<skia_textlayout_StrutStyle>

pub fn new() -> Handle<skia_textlayout_StrutStyle>

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

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

pub fn font_style(&self) -> FontStyle

pub fn set_font_style( &mut self, font_style: FontStyle, ) -> &mut Handle<skia_textlayout_StrutStyle>

pub fn font_size(&self) -> f32

pub fn set_font_size( &mut self, font_size: f32, ) -> &mut Handle<skia_textlayout_StrutStyle>

pub fn set_height( &mut self, height: f32, ) -> &mut Handle<skia_textlayout_StrutStyle>

pub fn height(&self) -> f32

pub fn set_leading( &mut self, leading: f32, ) -> &mut Handle<skia_textlayout_StrutStyle>

pub fn leading(&self) -> f32

pub fn strut_enabled(&self) -> bool

pub fn set_strut_enabled( &mut self, enabled: bool, ) -> &mut Handle<skia_textlayout_StrutStyle>

pub fn force_strut_height(&self) -> bool

pub fn set_force_strut_height( &mut self, force_height: bool, ) -> &mut Handle<skia_textlayout_StrutStyle>

pub fn height_override(&self) -> bool

pub fn set_height_override( &mut self, height_override: bool, ) -> &mut Handle<skia_textlayout_StrutStyle>

pub fn half_leading(&self) -> bool

pub fn set_half_leading( &mut self, half_leading: bool, ) -> &mut Handle<skia_textlayout_StrutStyle>

§

impl Handle<skia_textlayout_FontFeature>

pub fn name(&self) -> &str

pub fn value(&self) -> i32

§

impl Handle<skia_textlayout_TextStyle>

pub fn new() -> Handle<skia_textlayout_TextStyle>

pub fn to_placeholder(&self) -> Handle<skia_textlayout_TextStyle>

👎Deprecated since 0.51.0:

Use clone_for_placeholder

pub fn clone_for_placeholder(&self) -> Handle<skia_textlayout_TextStyle>

pub fn equals(&self, other: &Handle<skia_textlayout_TextStyle>) -> bool

pub fn equals_by_fonts(&self, that: &Handle<skia_textlayout_TextStyle>) -> bool

pub fn match_one_attribute( &self, style_type: skia_textlayout_StyleType, other: &Handle<skia_textlayout_TextStyle>, ) -> bool

pub fn color(&self) -> Color

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

pub fn has_foreground(&self) -> bool

pub fn foreground(&self) -> Handle<SkPaint>

pub fn set_foreground_paint( &mut self, paint: &Handle<SkPaint>, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn set_foreground_color( &mut self, paint: &Handle<SkPaint>, ) -> &mut Handle<skia_textlayout_TextStyle>

👎Deprecated since 0.64.0:

use set_foreground_paint()

pub fn clear_foreground_color( &mut self, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn has_background(&self) -> bool

pub fn background(&self) -> Handle<SkPaint>

pub fn set_background_paint( &mut self, paint: &Handle<SkPaint>, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn set_background_color( &mut self, paint: &Handle<SkPaint>, ) -> &mut Handle<skia_textlayout_TextStyle>

👎Deprecated since 0.64.0:

use set_background_paint()

pub fn clear_background_color( &mut self, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn decoration(&self) -> &Decoration

pub fn decoration_type(&self) -> TextDecoration

pub fn decoration_mode(&self) -> skia_textlayout_TextDecorationMode

pub fn decoration_color(&self) -> Color

pub fn decoration_style(&self) -> skia_textlayout_TextDecorationStyle

pub fn decoration_thickness_multiplier(&self) -> f32

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

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

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

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

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

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

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

👎Deprecated since 0.63.1:

use set_decoration()

pub fn font_style(&self) -> FontStyle

pub fn set_font_style( &mut self, font_style: FontStyle, ) -> &mut Handle<skia_textlayout_TextStyle>

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

pub fn add_shadow( &mut self, shadow: TextShadow, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn reset_shadows(&mut self) -> &mut Handle<skia_textlayout_TextStyle>

pub fn font_features(&self) -> &[Handle<skia_textlayout_FontFeature>]

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

pub fn reset_font_features(&mut self)

pub fn font_arguments(&self) -> Option<&Handle<skia_textlayout_FontArguments>>

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, and the crate::FontArguments can be safely deleted after set_font_arguments returns.

pub fn font_size(&self) -> f32

pub fn set_font_size( &mut self, size: f32, ) -> &mut Handle<skia_textlayout_TextStyle>

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

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

pub fn baseline_shift(&self) -> f32

pub fn set_baseline_shift( &mut self, baseline_shift: f32, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn set_height( &mut self, height: f32, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn height(&self) -> f32

pub fn set_height_override( &mut self, height_override: bool, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn height_override(&self) -> bool

pub fn set_half_leading( &mut self, half_leading: bool, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn half_leading(&self) -> bool

pub fn set_letter_spacing( &mut self, letter_spacing: f32, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn letter_spacing(&self) -> f32

pub fn set_word_spacing( &mut self, word_spacing: f32, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn word_spacing(&self) -> f32

pub fn typeface(&self) -> Option<RCHandle<SkTypeface>>

pub fn set_typeface( &mut self, typeface: impl Into<Option<RCHandle<SkTypeface>>>, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn locale(&self) -> &str

pub fn set_locale( &mut self, locale: impl AsRef<str>, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn text_baseline(&self) -> skia_textlayout_TextBaseline

pub fn set_text_baseline( &mut self, baseline: skia_textlayout_TextBaseline, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn font_metrics(&self) -> FontMetrics

pub fn is_placeholder(&self) -> bool

pub fn set_placeholder(&mut self) -> &mut Handle<skia_textlayout_TextStyle>

pub fn set_font_edging( &mut self, edging: SkFont_Edging, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn font_edging(&self) -> SkFont_Edging

pub fn set_subpixel( &mut self, subpixel: bool, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn subpixel(&self) -> bool

pub fn set_font_hinting( &mut self, hinting: SkFontHinting, ) -> &mut Handle<skia_textlayout_TextStyle>

pub fn font_hinting(&self) -> SkFontHinting

§

impl Handle<SkSVGColor>

pub fn color(&self) -> Option<Color>

pub fn kind(&self) -> ColorKind

pub fn current_color() -> Handle<SkSVGColor>

pub fn from_color(color: Color) -> Handle<SkSVGColor>

§

impl Handle<SkSVGIRI>

pub fn data(&self) -> &str

pub fn new<T>(value: T, kind: SkSVGIRI_Type) -> Handle<SkSVGIRI>
where T: AsRef<str>,

§

impl Handle<SkSVGFuncIRI>

pub fn iri(&self) -> Option<&Handle<SkSVGIRI>>

pub fn kind(&self) -> SkSVGFuncIRI_Type

pub fn from_iri(value: Handle<SkSVGIRI>) -> Handle<SkSVGFuncIRI>

pub fn none() -> Handle<SkSVGFuncIRI>

§

impl Handle<SkSVGPaint>

pub fn color(&self) -> Option<Color>

pub fn is_current_color(&self) -> bool

pub fn is_color(&self) -> bool

pub fn is_none(&self) -> bool

pub fn from_color(color: Color) -> Handle<SkSVGPaint>

pub fn current_color() -> Handle<SkSVGPaint>

pub fn none() -> Handle<SkSVGPaint>

§

impl Handle<SkOpBuilder>

pub fn add( &mut self, path: &Handle<SkPath>, operator: SkPathOp, ) -> &mut Handle<SkOpBuilder>

Add one or more paths and their operand. The builder is empty before the first path is added, so the result of a single add is (emptyPath OP path).

  • path The second operand.
  • operator The operator to apply to the existing and supplied paths.

pub fn resolve(&mut self) -> Option<Handle<SkPath>>

Computes the sum of all paths and operands, and resets the builder to its initial state.

Returns the product of the operands, None on failure.

§

impl Handle<SkPath>

pub fn op( &self, path: &Handle<SkPath>, path_op: SkPathOp, ) -> Option<Handle<SkPath>>

pub fn simplify(&self) -> Option<Handle<SkPath>>

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

👎Deprecated since 0.83.0:

Use Path::compute_tight_bounds() and test if the resulting Rect::is_finite()

pub fn as_winding(&self) -> Option<Handle<SkPath>>

§

impl Handle<SkCustomTypefaceBuilder>

pub const FACTORY_ID: FourByteTag

pub fn new() -> Handle<SkCustomTypefaceBuilder>

pub fn set_glyph<'a>( &mut self, glyph_id: u16, advance: f32, typeface_glyph: impl Into<TypefaceGlyph<'a>>, ) -> &mut Handle<SkCustomTypefaceBuilder>

pub fn set_metrics( &mut self, font_metrics: &FontMetrics, scale: impl Into<Option<f32>>, ) -> &mut Handle<SkCustomTypefaceBuilder>

pub fn set_font_style( &mut self, font_style: FontStyle, ) -> &mut Handle<SkCustomTypefaceBuilder>

pub fn detach(&mut self) -> Option<RCHandle<SkTypeface>>

pub fn from_data( data: impl Into<RCHandle<SkData>>, font_arguments: &FontArguments<'_, '_>, ) -> Option<RCHandle<SkTypeface>>

§

impl Handle<SkPath>

pub fn from_svg(svg: impl AsRef<str>) -> Option<Handle<SkPath>>

pub fn to_svg(&self) -> String

pub fn to_svg_with_encoding(&self, encoding: SkParsePath_PathEncoding) -> String

§

impl Handle<SkPath>

pub fn from_str( text: impl AsRef<str>, p: impl Into<Point>, font: &Handle<SkFont>, ) -> Handle<SkPath>

Trait Implementations§

§

impl<N> AsRef<Handle<N>> for Handle<N>
where N: NativeDrop,

§

fn as_ref(&self) -> &Handle<N>

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<str> for Handle<SkString>

§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<N> Clone for Handle<N>
where N: NativeDrop + NativeClone,

§

fn clone(&self) -> Handle<N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Combine<Handle<SkRegion>, Handle<SkRegion>> for Handle<SkRegion>

§

fn combine( a: &Handle<SkRegion>, op: SkRegion_Op, b: &Handle<SkRegion>, ) -> Handle<SkRegion>

§

fn difference(a: &A, b: &B) -> Self

§

fn intersect(a: &A, b: &B) -> Self

§

fn xor(a: &A, b: &B) -> Self

§

fn union(a: &A, b: &B) -> Self

§

fn reverse_difference(a: &A, b: &B) -> Self

§

fn replace(a: &A, b: &B) -> Self

§

impl Combine<Handle<SkRegion>, IRect> for Handle<SkRegion>

§

fn combine( region: &Handle<SkRegion>, op: SkRegion_Op, rect: &IRect, ) -> Handle<SkRegion>

§

fn difference(a: &A, b: &B) -> Self

§

fn intersect(a: &A, b: &B) -> Self

§

fn xor(a: &A, b: &B) -> Self

§

fn union(a: &A, b: &B) -> Self

§

fn reverse_difference(a: &A, b: &B) -> Self

§

fn replace(a: &A, b: &B) -> Self

§

impl Combine<IRect, Handle<SkRegion>> for Handle<SkRegion>

§

fn combine( rect: &IRect, op: SkRegion_Op, region: &Handle<SkRegion>, ) -> Handle<SkRegion>

§

fn difference(a: &A, b: &B) -> Self

§

fn intersect(a: &A, b: &B) -> Self

§

fn xor(a: &A, b: &B) -> Self

§

fn union(a: &A, b: &B) -> Self

§

fn reverse_difference(a: &A, b: &B) -> Self

§

fn replace(a: &A, b: &B) -> Self

§

impl Contains<&Handle<SkRegion>> for Handle<SkRegion>

§

fn contains(&self, other: &Handle<SkRegion>) -> bool

§

impl Contains<&IRect> for Handle<SkRegion>

§

fn contains(&self, rect: &IRect) -> bool

§

impl Contains<IPoint> for Handle<SkRegion>

§

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

§

impl Debug for Handle<SkCodecs_Decoder>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkBitmap>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkContextOptions>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkContourMeasureIter>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkFont>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkColorInfo>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkImageInfo>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkMeshSpecification_Attribute>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkMeshSpecification_Varying>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkPaint>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkPath>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkPathMeasure>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkPictureRecorder>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkRegion>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkStrikeRef>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkStrokeRec>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkTextBlobBuilder>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkVertices_Builder>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkYUVAInfo>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkYUVAPixmapInfo>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkYUVAPixmaps>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkYUVAPixmapInfo_SupportedDataTypes>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkColorMatrix>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkRuntimeEffect_Uniform>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkRuntimeEffect_Child>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<GrBackendSemaphore>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<GrBackendFormat>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<GrBackendRenderTarget>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<GrGLExtensions>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<GrYUVABackendTextureInfo>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkDynamicMemoryWStream>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkString>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkStrings>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<skia_textlayout_FontArguments>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<skia_textlayout_Paragraph_VisitorInfo>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<skia_textlayout_Paragraph_ExtendedVisitorInfo>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<skia_textlayout_ParagraphCache>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<skia_textlayout_StrutStyle>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<skia_textlayout_FontFeature>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<skia_textlayout_TextStyle>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkSVGColor>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkSVGIRI>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkSVGFuncIRI>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkSVGPaint>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkOpBuilder>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for Handle<SkCustomTypefaceBuilder>

§

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

Formats the value using the given formatter. Read more
§

impl Default for Handle<SkBitmap>

§

fn default() -> Handle<SkBitmap>

§

impl Default for Handle<SkContextOptions>

§

fn default() -> Handle<SkContextOptions>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkFont>

§

fn default() -> Handle<SkFont>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkColorInfo>

§

fn default() -> Handle<SkColorInfo>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkImageInfo>

§

fn default() -> Handle<SkImageInfo>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkPaint>

§

fn default() -> Handle<SkPaint>

Constructs a Paint with default values.

Example (C++): https://fiddle.skia.org/c/@Paint_empty_constructor

§

impl Default for Handle<SkPath>

§

fn default() -> Handle<SkPath>

§

impl Default for Handle<SkPathMeasure>

§

fn default() -> Handle<SkPathMeasure>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkYUVAInfo>

§

fn default() -> Handle<SkYUVAInfo>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkYUVAPixmapInfo_SupportedDataTypes>

§

fn default() -> Handle<SkYUVAPixmapInfo_SupportedDataTypes>

Defaults to nothing supported.

§

impl Default for Handle<SkPDF_Metadata>

§

fn default() -> Handle<SkPDF_Metadata>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkColorMatrix>

§

fn default() -> Handle<SkColorMatrix>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkString>

§

fn default() -> Handle<SkString>

Returns the “default value” for a type. Read more
§

impl Default for Handle<skia_textlayout_StrutStyle>

§

fn default() -> Handle<skia_textlayout_StrutStyle>

Returns the “default value” for a type. Read more
§

impl Default for Handle<skia_textlayout_TextStyle>

§

fn default() -> Handle<skia_textlayout_TextStyle>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkSVGIRI>

§

fn default() -> Handle<SkSVGIRI>

Returns the “default value” for a type. Read more
§

impl Default for Handle<SkOpBuilder>

§

fn default() -> Handle<SkOpBuilder>

Returns the “default value” for a type. Read more
§

impl Display for Handle<SkString>

§

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

Formats the value using the given formatter. Read more
§

impl<N> Drop for Handle<N>
where N: NativeDrop,

§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
§

impl<'a> From<&'a Handle<SkPath>> for TypefaceGlyph<'a>

§

fn from(path: &'a Handle<SkPath>) -> TypefaceGlyph<'a>

Converts to this type from the input type.
§

impl From<FontArguments<'_, '_>> for Handle<skia_textlayout_FontArguments>

§

fn from(fa: FontArguments<'_, '_>) -> Handle<skia_textlayout_FontArguments>

Converts to this type from the input type.
§

impl From<RefHandle<SkPathBuilder>> for Handle<SkPath>

§

fn from(value: RefHandle<SkPathBuilder>) -> Handle<SkPath>

Converts to this type from the input type.
§

impl<N> Hash for Handle<N>
where N: NativeDrop + NativeHash,

§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

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
§

impl Index<usize> for Handle<SkStrings>

§

type Output = Handle<SkString>

The returned type after indexing.
§

fn index(&self, index: usize) -> &<Handle<SkStrings> as Index<usize>>::Output ⓘ

Performs the indexing (container[index]) operation. Read more
§

impl Intersects<Handle<SkRegion>> for Handle<SkRegion>

§

fn intersects(&self, other: &Handle<SkRegion>) -> bool

§

impl Intersects<IRect> for Handle<SkRegion>

§

fn intersects(&self, rect: &IRect) -> bool

§

impl Iterator for Handle<SkContourMeasureIter>

§

fn next(&mut self) -> Option<<Handle<SkContourMeasureIter> as Iterator>::Item>

Iterates through contours in the path, returning a ContourMeasure for each contour. Returns None when iteration is complete.

Only non-zero-length contours are returned, where a contour is the segments between a move verb and either:

  • the next move verb,
  • one or more close verbs,
  • or the end of the path.

Zero-length contours are skipped.

§

type Item = RCHandle<SkContourMeasure>

The type of the elements being iterated over.
Source§

fn next_chunk<const N: usize>( &mut self, ) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 (const: unstable) · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 (const: unstable) · Source§

fn count(self) -> usize
where Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 (const: unstable) · Source§

fn last(self) -> Option<Self::Item>
where Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 (const: unstable) · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 (const: unstable) · Source§

fn step_by(self, step: usize) -> StepBy<Self> ⓘ
where Self: Sized,

Creates an iterator starting at the same point, but stepping by the given amount at each iteration. Read more
1.0.0 (const: unstable) · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter> ⓘ
where Self: Sized, U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 (const: unstable) · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter> ⓘ
where Self: Sized, U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self> ⓘ
where Self: Sized, Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G> ⓘ
where Self: Sized, G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator between items of the original iterator. Read more
1.0.0 (const: unstable) · Source§

fn map<B, F>(self, f: F) -> Map<Self, F> ⓘ
where Self: Sized, F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each element. Read more
1.21.0 (const: unstable) · Source§

fn for_each<F>(self, f: F)
where Self: Sized, F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 (const: unstable) · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P> ⓘ
where Self: Sized, P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element should be yielded. Read more
1.0.0 (const: unstable) · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> ⓘ
where Self: Sized, F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 (const: unstable) · Source§

fn enumerate(self) -> Enumerate<Self> ⓘ
where Self: Sized,

Creates an iterator which gives the current iteration count as well as the next value. Read more
1.0.0 (const: unstable) · Source§

fn peekable(self) -> Peekable<Self> ⓘ
where Self: Sized,

Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See their documentation for more information. Read more
1.0.0 (const: unstable) · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> ⓘ
where Self: Sized, P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 (const: unstable) · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> ⓘ
where Self: Sized, P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 (const: unstable) · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P> ⓘ
where Self: Sized, P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 (const: unstable) · Source§

fn skip(self, n: usize) -> Skip<Self> ⓘ
where Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 (const: unstable) · Source§

fn take(self, n: usize) -> Take<Self> ⓘ
where Self: Sized,

Creates an iterator that yields the first n elements, or fewer if the underlying iterator ends sooner. Read more
1.0.0 (const: unstable) · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> ⓘ
where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but unlike fold, produces a new iterator. Read more
1.0.0 (const: unstable) · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> ⓘ
where Self: Sized, U: IntoIterator, F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 (const: unstable) · Source§

fn flatten(self) -> Flatten<Self> ⓘ
where Self: Sized, Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N> ⓘ
where Self: Sized, F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over self and returns an iterator over the outputs of f. Like slice::windows(), the windows during mapping overlap as well. Read more
1.0.0 (const: unstable) · Source§

fn fuse(self) -> Fuse<Self> ⓘ
where Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 (const: unstable) · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F> ⓘ
where Self: Sized, F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 (const: unstable) · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 (const: unstable) · Source§

fn collect<B>(self) -> B
where B: FromIterator<Self::Item>, Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>( &mut self, ) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where Self: Sized, Self::Item: Try, <Self::Item as Try>::Residual: Residual<B>, B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if a failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where E: Extend<Self::Item>, Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 (const: unstable) · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where Self: Sized, B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where T: 'a, Self: Sized + DoubleEndedIterator<Item = &'a mut T>, P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, such that all those that return true precede all those that return false. Returns the number of true elements found. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where Self: Sized, P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return true precede all those that return false. Read more
1.27.0 (const: unstable) · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Output = B>,

An iterator method that applies a function as long as it returns successfully, producing a single, final value. Read more
1.27.0 (const: unstable) · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where Self: Sized, F: FnMut(Self::Item) -> R, R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. Read more
1.0.0 (const: unstable) · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where Self: Sized, F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, returning the final result. Read more
1.51.0 (const: unstable) · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where Self: Sized, F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing operation. Read more
Source§

fn try_reduce<R>( &mut self, f: impl FnMut(Self::Item, Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where Self: Sized, R: Try<Output = Self::Item>, <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 (const: unstable) · Source§

fn all<F>(&mut self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 (const: unstable) · Source§

fn any<F>(&mut self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 (const: unstable) · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where Self: Sized, P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 (const: unstable) · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where Self: Sized, F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns the first non-none result. Read more
Source§

fn try_find<R>( &mut self, f: impl FnMut(&Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where Self: Sized, R: Try<Output = bool>, <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns the first true result or the first error. Read more
1.0.0 (const: unstable) · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where Self: Sized, P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 (const: unstable) · Source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where P: FnMut(Self::Item) -> bool, Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its index. Read more
1.0.0 (const: unstable) · Source§

fn max(self) -> Option<Self::Item>
where Self: Sized, Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 (const: unstable) · Source§

fn min(self) -> Option<Self::Item>
where Self: Sized, Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 (const: unstable) · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where B: Ord, Self: Sized, F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the specified function. Read more
1.15.0 (const: unstable) · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the specified comparison function. Read more
1.6.0 (const: unstable) · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where B: Ord, Self: Sized, F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the specified function. Read more
1.15.0 (const: unstable) · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the specified comparison function. Read more
1.0.0 (const: unstable) · Source§

fn rev(self) -> Rev<Self> ⓘ
where Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 (const: unstable) · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where FromA: Default + Extend<A>, FromB: Default + Extend<B>, Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 (const: unstable) · Source§

fn copied<'a, T>(self) -> Copied<Self> ⓘ
where T: Copy + 'a, Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 (const: unstable) · Source§

fn cloned<'a, T>(self) -> Cloned<Self> ⓘ
where T: Clone + 'a, Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 (const: unstable) · Source§

fn cycle(self) -> Cycle<Self> ⓘ
where Self: Sized + Clone,

Repeats an iterator endlessly. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N> ⓘ
where Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 (const: unstable) · Source§

fn sum<S>(self) -> S
where Self: Sized, S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 (const: unstable) · Source§

fn product<P>(self) -> P
where Self: Sized, P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements. Read more
1.5.0 (const: unstable) · Source§

fn cmp<I>(self, other: I) -> Ordering
where I: IntoIterator<Item = Self::Item>, Self::Item: Ord, Self: Sized,

Lexicographically compares the elements of this Iterator with those of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those of another with respect to the specified comparison function. Read more
1.5.0 (const: unstable) · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Lexicographically compares the PartialOrd elements of this Iterator with those of another. The comparison works like short-circuit evaluation, returning a result without comparing the remaining elements. As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those of another with respect to the specified comparison function. Read more
1.5.0 (const: unstable) · Source§

fn eq<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialEq<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are equal to those of another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of another with respect to the specified equality function. Read more
1.5.0 (const: unstable) · Source§

fn ne<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialEq<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are not equal to those of another. Read more
1.5.0 (const: unstable) · Source§

fn lt<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are lexicographically less than those of another. Read more
1.5.0 (const: unstable) · Source§

fn le<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are lexicographically less or equal to those of another. Read more
1.5.0 (const: unstable) · Source§

fn gt<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are lexicographically greater than those of another. Read more
1.5.0 (const: unstable) · Source§

fn ge<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are lexicographically greater than or equal to those of another. Read more
1.82.0 (const: unstable) · Source§

fn is_sorted(self) -> bool
where Self: Sized, Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 (const: unstable) · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 (const: unstable) · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Item) -> K, K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction function. Read more
§

impl PartialEq for Handle<SkColorMatrix>

§

fn eq(&self, other: &Handle<SkColorMatrix>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl PartialEq for Handle<skia_textlayout_FontFeature>

§

fn eq(&self, other: &Handle<skia_textlayout_FontFeature>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl<N> PartialEq for Handle<N>
where N: NativeDrop + NativePartialEq,

§

fn eq(&self, rhs: &Handle<N>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl QuickReject<Handle<SkPath>> for Canvas

§

fn quick_reject(&self, path: &Handle<SkPath>) -> 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 (C++): https://fiddle.skia.org/c/@Canvas_quickReject_2

§

impl QuickReject<Handle<SkRegion>> for Handle<SkRegion>

§

fn quick_reject(&self, other: &Handle<SkRegion>) -> bool

§

impl QuickReject<IRect> for Handle<SkRegion>

§

fn quick_reject(&self, rect: &IRect) -> bool

§

impl<N> RefWrapper<N> for Handle<N>
where N: NativeDrop,

§

fn wrap_ref(native: &N) -> &Handle<N>

§

fn wrap_mut(native: &mut N) -> &mut Handle<N>

§

fn inner(&self) -> &N

§

fn inner_mut(&mut self) -> &mut N

§

impl Send for Handle<SkCodecs_Decoder>

§

impl Send for Handle<SkContextOptions>

§

impl Send for Handle<SkContourMeasureIter>

§

impl Send for Handle<SkFont>

§

impl Send for Handle<SkColorInfo>

§

impl Send for Handle<SkImageInfo>

§

impl Send for Handle<SkMeshSpecification_Attribute>

§

impl Send for Handle<SkMeshSpecification_Varying>

§

impl Send for Handle<SkPaint>

§

impl Send for Handle<SkPath>

§

impl Send for Handle<SkRegion>

§

impl Send for Handle<SkStrikeRef>

§

impl Send for Handle<SkStrokeRec>

§

impl Send for Handle<SkTextBlobBuilder>

§

impl Send for Handle<SkVertices_Builder>

§

impl Send for Handle<SkYUVAInfo>

§

impl Send for Handle<SkYUVAPixmapInfo>

§

impl Send for Handle<SkYUVAPixmaps>

§

impl Send for Handle<SkYUVAPixmapInfo_SupportedDataTypes>

§

impl Send for Handle<SkColorMatrix>

§

impl Send for Handle<SkRuntimeEffect_Uniform>

§

impl Send for Handle<SkRuntimeEffect_Child>

§

impl Send for Handle<SkRuntimeEffectBuilder>

§

impl Send for Handle<GrBackendSemaphore>

§

impl Send for Handle<GrBackendFormat>

§

impl Send for Handle<GrBackendRenderTarget>

§

impl Send for Handle<GrGLExtensions>

§

impl Send for Handle<GrYUVABackendTextureInfo>

§

impl Send for Handle<SkString>

§

impl Send for Handle<SkStrings>

§

impl Send for Handle<skia_textlayout_FontArguments>

§

impl Send for Handle<skia_textlayout_StrutStyle>

§

impl Send for Handle<skia_textlayout_FontFeature>

§

impl Send for Handle<skia_textlayout_TextStyle>

§

impl Send for Handle<SkOpBuilder>

§

impl Send for Handle<SkCustomTypefaceBuilder>

§

impl Sync for Handle<SkCodecs_Decoder>

§

impl Sync for Handle<SkContextOptions>

§

impl Sync for Handle<SkContourMeasureIter>

§

impl Sync for Handle<SkFont>

§

impl Sync for Handle<SkColorInfo>

§

impl Sync for Handle<SkImageInfo>

§

impl Sync for Handle<SkMeshSpecification_Attribute>

§

impl Sync for Handle<SkMeshSpecification_Varying>

§

impl Sync for Handle<SkPaint>

§

impl Sync for Handle<SkRegion>

§

impl Sync for Handle<SkStrikeRef>

§

impl Sync for Handle<SkStrokeRec>

§

impl Sync for Handle<SkTextBlobBuilder>

§

impl Sync for Handle<SkVertices_Builder>

§

impl Sync for Handle<SkYUVAInfo>

§

impl Sync for Handle<SkYUVAPixmapInfo>

§

impl Sync for Handle<SkYUVAPixmaps>

§

impl Sync for Handle<SkYUVAPixmapInfo_SupportedDataTypes>

§

impl Sync for Handle<SkColorMatrix>

§

impl Sync for Handle<SkRuntimeEffect_Uniform>

§

impl Sync for Handle<SkRuntimeEffect_Child>

§

impl Sync for Handle<SkRuntimeEffectBuilder>

§

impl Sync for Handle<GrBackendSemaphore>

§

impl Sync for Handle<GrBackendFormat>

§

impl Sync for Handle<GrBackendRenderTarget>

§

impl Sync for Handle<GrGLExtensions>

§

impl Sync for Handle<GrYUVABackendTextureInfo>

§

impl Sync for Handle<SkString>

§

impl Sync for Handle<SkStrings>

§

impl Sync for Handle<skia_textlayout_FontArguments>

§

impl Sync for Handle<skia_textlayout_StrutStyle>

§

impl Sync for Handle<skia_textlayout_FontFeature>

§

impl Sync for Handle<skia_textlayout_TextStyle>

§

impl Sync for Handle<SkOpBuilder>

§

impl Sync for Handle<SkCustomTypefaceBuilder>

§

impl<N> ValueWrapper<N> for Handle<N>
where N: NativeDrop,

§

fn wrap(native: N) -> Handle<N>
where N: NativeDrop,

§

fn unwrap(self) -> N

§

fn inner(&self) -> &N

§

fn inner_mut(&mut self) -> &mut N

Auto Trait Implementations§

§

impl<N> !Freeze for Handle<N>

§

impl<N> !RefUnwindSafe for Handle<N>

§

impl<N> !Send for Handle<N>

§

impl<N> !Sync for Handle<N>

§

impl<N> Unpin for Handle<N>
where N: Unpin,

§

impl<N> UnsafeUnpin for Handle<N>
where N: UnsafeUnpin,

§

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
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringLocalized for T
where T: ToString,

Source§

fn to_string_local(&self, _cx: &impl DataContext) -> String

Method for converting the current type to a String via a translation using fluent.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more