Struct vizia_core::vg::RCHandle

pub struct RCHandle<Native>(/* private fields */)
where
    Native: NativeRefCounted;
Expand description

A wrapper type represented by a reference counted pointer to the native type.

Implementations§

§

impl RCHandle<SkBlender>

pub fn mode(mode: SkBlendMode) -> RCHandle<SkBlender>

Create a blender that implements the specified BlendMode.

§

impl RCHandle<SkColorFilter>

ColorFilters are optional objects in the drawing pipeline. When present in a paint, they are called with the “src” colors, and return new colors, which are then passed onto the next stage (either ImageFilter or Xfermode).

All subclasses are required to be reentrant-safe : it must be legal to share the same instance between several threads.

pub fn to_a_color_mode(&self) -> Option<(Color, SkBlendMode)>

If the filter can be represented by a source color plus Mode, this returns the color and mode appropriately. If not, this returns None and ignores the parameters.

pub fn to_a_color_matrix(&self) -> Option<[f32; 20]>

If the filter can be represented by a 5x4 matrix, this returns the matrix appropriately. If not, this returns None and ignores the parameter.

pub fn is_alpha_unchanged(&self) -> bool

Returns true if the filter is guaranteed to never change the alpha of a color it filters.

pub fn filter_color(&self, color: impl Into<Color>) -> Color

pub fn filter_color4f( &self, color: impl AsRef<Color4f>, src_color_space: &RCHandle<SkColorSpace>, dst_color_space: Option<&RCHandle<SkColorSpace>>, ) -> Color4f

Converts the src color (in src colorspace), into the dst colorspace, then applies this filter to it, returning the filtered color in the dst colorspace.

pub fn composed( &self, inner: impl Into<RCHandle<SkColorFilter>>, ) -> Option<RCHandle<SkColorFilter>>

Construct a color filter whose effect is to first apply the inner filter and then apply this filter, applied to the output of the inner filter.

result = this(inner(…))

pub fn with_working_color_space( &self, color_space: impl Into<RCHandle<SkColorSpace>>, ) -> Option<RCHandle<SkColorFilter>>

Return a color filter that will compute this filter in a specific color space. By default all filters operate in the destination (surface) color space. This allows filters like Blend and Matrix, or runtime color filters to perform their math in a known space.

§

impl RCHandle<SkColorSpace>

pub fn new_srgb() -> RCHandle<SkColorSpace>

pub fn new_srgb_linear() -> RCHandle<SkColorSpace>

pub fn to_xyzd50_hash(&self) -> XYZD50Hash

pub fn with_linear_gamma(&self) -> RCHandle<SkColorSpace>

pub fn with_srgb_gamma(&self) -> RCHandle<SkColorSpace>

pub fn with_color_spin(&self) -> RCHandle<SkColorSpace>

pub fn is_srgb(&self) -> bool

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

pub fn deserialize(data: impl Into<RCHandle<SkData>>) -> RCHandle<SkColorSpace>

§

impl RCHandle<SkColorTable>

pub fn new(table: &[u8; 256]) -> RCHandle<SkColorTable>

Creates a new ColorTable with ‘table’ used for all four channels. The table is copied into the ColorTable.

pub fn new_per_channel<'a>( table_a: impl Into<Option<&'a [u8; 256]>>, table_r: impl Into<Option<&'a [u8; 256]>>, table_g: impl Into<Option<&'a [u8; 256]>>, table_b: impl Into<Option<&'a [u8; 256]>>, ) -> Option<RCHandle<SkColorTable>>

pub fn alpha_table(&self) -> &[u8; 256]

pub fn red_table(&self) -> &[u8; 256]

pub fn green_table(&self) -> &[u8; 256]

pub fn blue_table(&self) -> &[u8; 256]

§

impl RCHandle<SkContourMeasure>

pub fn length(&self) -> f32

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

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

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

pub fn is_closed(&self) -> bool

§

impl RCHandle<SkData>

pub fn size(&self) -> usize

pub fn is_empty(&self) -> bool

pub fn as_bytes(&self) -> &[u8]

pub fn copy_range(&self, offset: usize, buffer: &mut [u8]) -> &RCHandle<SkData>

pub fn new_copy(data: &[u8]) -> RCHandle<SkData>

pub unsafe fn new_bytes(data: &[u8]) -> RCHandle<SkData>

Constructs Data from a given byte slice without copying it.

Users must make sure that the underlying slice will outlive the lifetime of the Data.

pub unsafe fn new_uninitialized(length: usize) -> RCHandle<SkData>

pub fn new_zero_initialized(length: usize) -> RCHandle<SkData>

pub fn new_subset( data: &RCHandle<SkData>, offset: usize, length: usize, ) -> RCHandle<SkData>

pub fn new_str(str: impl AsRef<str>) -> RCHandle<SkData>

Constructs Data from a copy of a &str.

Functions that use Data as a string container usually expect it to contain a c-string including the terminating 0 byte, so this function converts the Rust str to a CString and calls Self::new_cstr().

pub fn new_cstr(cstr: &CStr) -> RCHandle<SkData>

Constructs Data from a &CStr by copying its contents.

pub fn from_filename(path: impl AsRef<Path>) -> Option<RCHandle<SkData>>

Create a new Data referencing the file with the specified path. If the file cannot be opened, the path contains 0 bytes, or the path is not valid UTF-8, this returns None.

This function opens the file as a memory mapped file for the lifetime of Data returned.

pub fn from_stream(stream: impl Read, size: usize) -> Option<RCHandle<SkData>>

Attempt to read size bytes into a Data. If the read succeeds, return the data, else return None. Either way the stream’s cursor may have been changed as a result of calling read().

pub fn new_empty() -> RCHandle<SkData>

§

impl RCHandle<SkDataTable>

pub fn is_empty(&self) -> bool

pub fn count(&self) -> usize

pub fn at_size(&self, index: usize) -> usize

pub fn at(&self, index: usize) -> &[u8]

pub unsafe fn at_t<T>(&self, index: usize) -> &[T]
where T: Copy,

pub fn at_str(&self, index: usize) -> &CStr

pub fn new_empty() -> RCHandle<SkDataTable>

pub fn from_slices(slices: &[&[u8]]) -> RCHandle<SkDataTable>

pub fn from_slice<T>(slice: &[T]) -> RCHandle<SkDataTable>
where T: Copy,

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

§

impl RCHandle<SkDrawable>

pub fn draw(&mut self, canvas: &Canvas, matrix: Option<&Matrix>)

pub fn draw_at(&mut self, canvas: &Canvas, point: impl Into<Point>)

pub fn snap_gpu_draw_handler( &mut self, api: GrBackendApi, matrix: &Matrix, clip_bounds: impl Into<IRect>, buffer_info: &Handle<SkImageInfo>, ) -> Option<RefHandle<SkDrawable_GpuDrawHandler>>

pub fn make_picture_snapshot(&mut self) -> RCHandle<SkPicture>

pub fn generation_id(&mut self) -> u32

pub fn bounds(&mut self) -> Rect

pub fn approximate_bytes_used(&mut self) -> usize

pub fn notify_drawing_changed(&mut self)

§

impl RCHandle<SkFontStyleSet>

pub fn count(&mut self) -> usize

pub fn style(&mut self, index: usize) -> (FontStyle, Option<String>)

pub fn new_typeface(&mut self, index: usize) -> Option<RCHandle<SkTypeface>>

pub fn match_style( &mut self, index: usize, pattern: FontStyle, ) -> Option<RCHandle<SkTypeface>>

pub fn new_empty() -> RCHandle<SkFontStyleSet>

§

impl RCHandle<SkFontMgr>

pub fn new() -> RCHandle<SkFontMgr>

pub fn empty() -> RCHandle<SkFontMgr>

pub fn count_families(&self) -> usize

pub fn family_name(&self, index: usize) -> String

pub fn family_names( &self, ) -> impl Iterator<Item = String> + Captures<&RCHandle<SkFontMgr>>

pub fn new_styleset(&self, index: usize) -> RCHandle<SkFontStyleSet>

👎Deprecated since 0.41.0: Use new_style_set

pub fn new_style_set(&self, index: usize) -> RCHandle<SkFontStyleSet>

pub fn match_family( &self, family_name: impl AsRef<str>, ) -> RCHandle<SkFontStyleSet>

pub fn match_family_style( &self, family_name: impl AsRef<str>, style: FontStyle, ) -> Option<RCHandle<SkTypeface>>

pub fn match_family_style_character( &self, family_name: impl AsRef<str>, style: FontStyle, bcp_47: &[&str], character: i32, ) -> Option<RCHandle<SkTypeface>>

pub fn match_face_style( &self, _typeface: impl AsRef<RCHandle<SkTypeface>>, _style: FontStyle, ) -> !

👎Deprecated since 0.35.0: Removed without replacement

pub fn new_from_data( &self, bytes: &[u8], ttc_index: impl Into<Option<usize>>, ) -> Option<RCHandle<SkTypeface>>

pub fn legacy_make_typeface<'a>( &self, family_name: impl Into<Option<&'a str>>, style: FontStyle, ) -> Option<RCHandle<SkTypeface>>

§

impl RCHandle<SkImage>

pub fn from_raster_data( info: &Handle<SkImageInfo>, pixels: impl Into<RCHandle<SkData>>, row_bytes: usize, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use images::raster_from_data()

Creates Image from ImageInfo, sharing pixels.

Image is returned if ImageInfo is valid. Valid ImageInfo parameters include: dimensions are greater than zero; each dimension fits in 29 bits; ColorType and AlphaType are valid, and ColorType is not ColorType::Unknown; rowBytes are large enough to hold one row of pixels; pixels is not nullptr, and contains enough data for Image.

  • info contains width, height, AlphaType, ColorType, ColorSpace
  • pixels address or pixel storage
  • rowBytes size of pixel row or larger Returns: Image sharing pixels, or None

pub fn from_bitmap(bitmap: &Handle<SkBitmap>) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use images::raster_from_bitmap()

Creates Image from bitmap, sharing or copying bitmap pixels. If the bitmap is marked immutable, and its pixel memory is shareable, it may be shared instead of copied.

Image is returned if bitmap is valid. Valid Bitmap parameters include: dimensions are greater than zero; each dimension fits in 29 bits; ColorType and AlphaType are valid, and ColorType is not ColorType::Unknown; row bytes are large enough to hold one row of pixels; pixel address is not null.

  • bitmap ImageInfo, row bytes, and pixels Returns: created Image, or None

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

pub fn from_generator( image_generator: RefHandle<SkImageGenerator>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use images::deferred_from_generator()

Creates Image from data returned by image_generator. Generated data is owned by Image and may not be shared or accessed.

Image is returned if generator data is valid. Valid data parameters vary by type of data and platform.

imageGenerator may wrap Picture data, codec data, or custom data.

  • image_generator stock or custom routines to retrieve Image Returns: created Image, or None

pub fn from_encoded( data: impl Into<RCHandle<SkData>>, ) -> Option<RCHandle<SkImage>>

pub fn from_encoded_with_alpha_type( data: impl Into<RCHandle<SkData>>, alpha_type: impl Into<Option<SkAlphaType>>, ) -> Option<RCHandle<SkImage>>

Return an image backed by the encoded data, but attempt to defer decoding until the image is actually used/drawn. This deferral allows the system to cache the result, either on the CPU or on the GPU, depending on where the image is drawn. If memory is low, the cache may be purged, causing the next draw of the image to have to re-decode.

If alphaType is None, the image’s alpha type will be chosen automatically based on the image format. Transparent images will default to AlphaType::Premul. If alphaType contains AlphaType::Premul or AlphaType::Unpremul, that alpha type will be used. Forcing opaque (passing AlphaType::Opaque) is not allowed, and will return nullptr.

This is similar to decode_to_{raster,texture}, but this method will attempt to defer the actual decode, while the decode_to… method explicitly decode and allocate the backend when the call is made.

If the encoded format is not supported, None is returned.

  • encoded the encoded data Returns: created Image, or None

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

pub fn decode_to_raster(_encoded: &[u8], _subset: impl Into<Option<IRect>>) -> !

👎Deprecated since 0.35.0: Removed without replacement

pub fn new_raster_from_compressed( data: impl Into<RCHandle<SkData>>, dimensions: impl Into<ISize>, ty: SkTextureCompressionType, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use images::raster_from_compressed_texture_data()

Creates a CPU-backed Image from compressed data.

This method will decompress the compressed data and create an image wrapping it. Any mipmap levels present in the compressed data are discarded.

  • data compressed data to store in Image
  • width width of full Image
  • height height of full Image
  • ty type of compression used Returns: created Image, or None

pub fn from_picture( picture: impl Into<RCHandle<SkPicture>>, dimensions: impl Into<ISize>, matrix: Option<&Matrix>, paint: Option<&Handle<SkPaint>>, bit_depth: SkImages_BitDepth, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use images::deferred_from_picture()

pub fn from_picture_with_props( picture: impl Into<RCHandle<SkPicture>>, dimensions: impl Into<ISize>, matrix: Option<&Matrix>, paint: Option<&Handle<SkPaint>>, bit_depth: SkImages_BitDepth, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, props: SurfaceProps, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use images::deferred_from_picture()

Creates Image from picture. Returned Image width and height are set by dimensions. Image draws picture with matrix and paint, set to bitDepth and colorSpace.

If matrix is None, draws with identity Matrix. If paint is None, draws with default Paint. color_space may be None.

  • picture stream of drawing commands
  • dimensions width and height
  • matrix Matrix to rotate, scale, translate, and so on; may be None
  • paint Paint to apply transparency, filtering, and so on; may be None
  • bitDepth 8-bit integer or 16-bit float: per component
  • color_space range of colors; may be None
  • props props to use when rasterizing the picture Returns: created Image, or None

pub fn new_texture_from_compressed( context: &mut RCHandle<GrDirectContext>, data: RCHandle<SkData>, dimensions: impl Into<ISize>, ty: SkTextureCompressionType, mipmapped: impl Into<Option<skgpu_Mipmapped>>, is_protected: impl Into<Option<skgpu_Protected>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use gpu::images::texture_from_compressed_texture_data()

Creates a GPU-backed Image from compressed data.

This method will return an Image representing the compressed data. If the GPU doesn’t support the specified compression method, the data will be decompressed and then wrapped in a GPU-backed image.

Note: one can query the supported compression formats via gpu::RecordingContext::compressed_backend_format.

  • context GPU context
  • data compressed data to store in Image
  • width width of full Image
  • height height of full Image
  • ty type of compression used
  • mipmapped does ‘data’ contain data for all the mipmap levels?
  • is_protected do the contents of ‘data’ require DRM protection (on Vulkan)? Returns: created Image, or None

pub fn from_compressed( _context: &mut RCHandle<GrRecordingContext>, _data: RCHandle<SkData>, _dimensions: impl Into<ISize>, _ct: SkTextureCompressionType, ) -> !

👎Deprecated since 0.35.0: Removed without replacement

pub fn from_texture( context: &mut RCHandle<GrRecordingContext>, backend_texture: &RefHandle<GrBackendTexture>, origin: GrSurfaceOrigin, color_type: ColorType, alpha_type: SkAlphaType, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Option<RCHandle<SkImage>>

Creates Image from GPU texture associated with context. GPU texture must stay valid and unchanged until texture_release_proc is called. texture_release_proc is passed release_context when Image is deleted or no longer refers to texture.

Image is returned if format of backend_texture is recognized and supported. Recognized formats vary by GPU back-end.

Note: When using a DDL recording context, texture_release_proc will be called on the GPU thread after the DDL is played back on the direct context.

  • context GPU context
  • backend_texture Texture residing on GPU
  • origin Origin of backend_texture
  • color_type Color type of the resulting image
  • alpha_type Alpha type of the resulting image
  • color_space This describes the color space of this image’s contents, as seen after sampling. In general, if the format of the backend texture is SRGB, some linear color_space should be supplied (e.g., ColorSpace::new_srgb_linear())). If the format of the backend texture is linear, then the color_space should include a description of the transfer function as well (e.g., ColorSpace::MakeSRGB).
  • texture_release_proc Function called when texture can be released
  • release_context State passed to texture_release_proc Returns: Created Image, or None

pub fn from_pixmap_cross_context( context: &mut RCHandle<GrDirectContext>, pixmap: &Pixmap<'_>, build_mips: bool, limit_to_max_texture_size: impl Into<Option<bool>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.27.0: renamed, use new_cross_context_from_pixmap

pub fn new_cross_context_from_pixmap( context: &mut RCHandle<GrDirectContext>, pixmap: &Pixmap<'_>, build_mips: bool, limit_to_max_texture_size: impl Into<Option<bool>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use gpu::images::cross_context_texture_from_pixmap()

Creates Image from pixmap. Image is uploaded to GPU back-end using context.

Created Image is available to other GPU contexts, and is available across thread boundaries. All contexts must be in the same GPU share group, or otherwise share resources.

When Image is no longer referenced, context releases texture memory asynchronously.

ColorSpace of Image is determined by pixmap.color_space().

Image is returned referring to GPU back-end if context is not None, format of data is recognized and supported, and if context supports moving resources between contexts. Otherwise, pixmap pixel data is copied and Image as returned in raster format if possible; None may be returned. Recognized GPU formats vary by platform and GPU back-end.

  • context GPU context
  • pixmap ImageInfo, pixel address, and row bytes
  • build_mips create Image as mip map if true
  • limit_to_max_texture_size downscale image to GPU maximum texture size, if necessary Returns: created Image, or None

pub fn from_adopted_texture( context: &mut RCHandle<GrRecordingContext>, backend_texture: &RefHandle<GrBackendTexture>, texture_origin: GrSurfaceOrigin, color_type: ColorType, alpha_type: impl Into<Option<SkAlphaType>>, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use gpu::images::adopt_texture_from()

Creates Image from backend_texture associated with context. backend_texture and returned Image are managed internally, and are released when no longer needed.

Image is returned if format of backend_texture is recognized and supported. Recognized formats vary by GPU back-end.

  • context GPU context
  • backend_texture texture residing on GPU
  • texture_origin origin of backend_texture
  • color_type color type of the resulting image
  • alpha_type alpha type of the resulting image
  • color_space range of colors; may be None Returns: created Image, or None

pub fn from_yuva_textures( context: &mut RCHandle<GrRecordingContext>, yuva_textures: &Handle<GrYUVABackendTextures>, image_color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use gpu::images::texture_from_yuva_textures()

Creates an Image from YUV[A] planar textures. This requires that the textures stay valid for the lifetime of the image. The ReleaseContext can be used to know when it is safe to either delete or overwrite the textures. If ReleaseProc is provided it is also called before return on failure.

  • context GPU context
  • yuva_textures A set of textures containing YUVA data and a description of the data and transformation to RGBA.
  • image_color_space range of colors of the resulting image after conversion to RGB; may be None
  • texture_release_proc called when the backend textures can be released
  • release_context state passed to texture_release_proc Returns: created Image, or None

pub fn from_yuva_pixmaps( context: &mut RCHandle<GrRecordingContext>, yuva_pixmaps: &Handle<SkYUVAPixmaps>, build_mips: impl Into<Option<skgpu_Mipmapped>>, limit_to_max_texture_size: impl Into<Option<bool>>, image_color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.63.0: use gpu::images::texture_from_yuva_pixmaps()

Creates Image from crate::YUVAPixmaps.

The image will remain planar with each plane converted to a texture using the passed gpu::RecordingContext.

crate::YUVAPixmaps has a crate::YUVAInfo which specifies the transformation from YUV to RGB. The ColorSpace of the resulting RGB values is specified by image_color_space. This will be the ColorSpace reported by the image and when drawn the RGB values will be converted from this space into the destination space (if the destination is tagged).

Currently, this is only supported using the GPU backend and will fail if context is None.

crate::YUVAPixmaps does not need to remain valid after this returns.

  • context GPU context
  • pixmaps The planes as pixmaps with supported crate::YUVAInfo that specifies conversion to RGB.
  • build_mips create internal YUVA textures as mip map if Yes. This is silently ignored if the context does not support mip maps.
  • limit_to_max_texture_size downscale image to GPU maximum texture size, if necessary
  • image_color_space range of colors of the resulting image; may be None Returns: created Image, or None

pub fn from_nv12_textures_copy( _context: &mut RCHandle<GrDirectContext>, _yuv_color_space: SkYUVColorSpace, _nv12_textures: &[RefHandle<GrBackendTexture>; 2], _image_origin: GrSurfaceOrigin, _image_color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> !

👎Deprecated since 0.37.0: Removed without replacement

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

Returns a ImageInfo describing the width, height, color type, alpha type, and color space of the Image.

Returns: image info of Image.

pub fn width(&self) -> i32

Returns pixel count in each row.

Returns: pixel width in Image

pub fn height(&self) -> i32

Returns pixel row count.

Returns: pixel height in Image

pub fn dimensions(&self) -> ISize

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

Returns: integral size of width() and height()

pub fn bounds(&self) -> IRect

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

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

pub fn unique_id(&self) -> u32

Returns value unique to image. Image contents cannot change after Image is created. Any operation to create a new Image will receive generate a new unique number.

Returns: unique identifier

pub fn alpha_type(&self) -> SkAlphaType

Returns AlphaType.

AlphaType returned was a parameter to an Image constructor, or was parsed from encoded data.

Returns: AlphaType in Image

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

pub fn color_type(&self) -> ColorType

Returns ColorType if known; otherwise, returns ColorType::Unknown.

Returns: ColorType of Image

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

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

Returns a smart pointer to ColorSpace, the range of colors, associated with Image. The smart pointer tracks the number of objects sharing this ColorSpace reference so the memory is released when the owners destruct.

The returned ColorSpace is immutable.

ColorSpace returned was passed to an Image constructor, or was parsed from encoded data. ColorSpace returned may be ignored when Image is drawn, depending on the capabilities of the crate::Surface receiving the drawing.

Returns: ColorSpace in Image, or None, wrapped in a smart pointer

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

pub fn is_alpha_only(&self) -> bool

Returns true if Image pixels represent transparency only. If true, each pixel is packed in 8 bits as defined by ColorType::Alpha8.

Returns: true if pixels represent a transparency mask

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

pub fn is_opaque(&self) -> bool

Returns true if pixels ignore their alpha value and are treated as fully opaque.

Returns: true if AlphaType is AlphaType::Opaque

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 and mipmap sampling.

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

to_raw_shader functions like to_shader, but for images that contain non-color data. This includes images encoding things like normals, material properties (eg, roughness), heightmaps, or any other purely mathematical data that happens to be stored in an image. These types of images are useful with some programmable shaders (see: crate::RuntimeEffect).

Raw image shaders work like regular image shaders (including filtering and tiling), with a few major differences:

  • No color space transformation is ever applied (the color space of the image is ignored).
  • Images with an alpha type of Unpremul are not automatically premultiplied.
  • Bicubic filtering is not supported. If SamplingOptions::use_cubic is true, these factories will return None.

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

Copies Image pixel address, row bytes, and ImageInfo to pixmap, if address is available, and returns true. If pixel address is not available, return false and leave pixmap unchanged.

  • pixmap storage for pixel state if pixels are readable; otherwise, ignored Returns: true if Image has direct access to pixels

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

pub fn is_texture_backed(&self) -> bool

Returns true if the contents of Image was created on or uploaded to GPU memory, and is available as a GPU texture.

Returns: true if Image is a GPU texture

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

pub fn texture_size(&self) -> usize

Returns an approximation of the amount of texture memory used by the image. Returns zero if the image is not texture backed or if the texture has an external format.

pub fn is_valid(&self, context: &mut RCHandle<GrRecordingContext>) -> bool

Returns true if Image can be drawn on either raster surface or GPU surface. If context is None, tests if Image draws on raster surface; otherwise, tests if Image draws on GPU surface associated with context.

Image backed by GPU texture may become invalid if associated context is invalid. lazy image may be invalid and may not draw to raster surface or GPU surface or both.

  • context GPU context Returns: true if Image can be drawn

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

pub fn flush<'a>( &self, context: &mut RCHandle<GrDirectContext>, flush_info: impl Into<Option<&'a FlushInfo>>, ) -> GrSemaphoresSubmitted

👎Deprecated since 0.63.0: use gpu::DirectContext::flush()

pub fn flush_with_info( &self, context: &mut RCHandle<GrDirectContext>, flush_info: &FlushInfo, ) -> GrSemaphoresSubmitted

👎Deprecated since 0.46.0: use gpu::DirectContext::flush()

Flushes any pending uses of texture-backed images in the GPU backend. If the image is not texture-backed (including promise texture images) or if the gpu::DirectContext does not have the same context ID as the context backing the image then this is a no-op.

If the image was not used in any non-culled draws in the current queue of work for the passed gpu::DirectContext then this is a no-op unless the gpu::FlushInfo contains semaphores or a finish proc. Those are respected even when the image has not been used.

  • context the context on which to flush pending usages of the image.
  • info flush options

pub fn flush_and_submit(&self, context: &mut RCHandle<GrDirectContext>)

👎Deprecated since 0.63.0: use gpu::DirectContext::flush_and_submit()

Version of flush() that uses a default gpu::FlushInfo. Also submits the flushed work to the GPU.

pub fn backend_texture( &self, flush_pending_gr_context_io: bool, ) -> Option<(RefHandle<GrBackendTexture>, GrSurfaceOrigin)>

👎Deprecated since 0.63.0: use gpu::images::get_backend_texture_from_image()

Retrieves the back-end texture. If Image has no back-end texture, Noneis returned.

If flush_pending_gr_context_io is true, completes deferred I/O operations.

If origin in not None, copies location of content drawn into Image.

  • flush_pending_gr_context_io flag to flush outstanding requests Returns: back-end API texture handle; invalid on failure

pub fn read_pixels_with_context<'a, P>( &self, context: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, dst_info: &Handle<SkImageInfo>, pixels: &mut [P], dst_row_bytes: usize, src: impl Into<IPoint>, caching_hint: SkImage_CachingHint, ) -> bool

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

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

  • dst_info.addr() equals None
  • dst_row_bytes is less than dst_info.min_row_bytes()
  • crate::PixelRef is None

Pixels are copied only if pixel conversion is possible. If Image ColorType is ColorType::Gray8, or ColorType::Alpha8; dst_info.color_type() must match. If Image ColorType is ColorType::Gray8, dst_info.color_space() must match. If Image AlphaType is AlphaType::Opaque, dst_info.alpha_type() must match. If Image ColorSpace 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 width() or height() is zero or negative. Returns false if abs(src_x) >= Image width(), or if abs(src_y) >= Image height().

If caching_hint is CachingHint::Allow, pixels may be retained locally. If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.

  • context the gpu::DirectContext in play, if it exists
  • dst_info destination width, height, ColorType, AlphaType, ColorSpace
  • dst_pixels destination pixel storage
  • dst_row_bytes destination row length
  • src_x column index whose absolute value is less than width()
  • src_y row index whose absolute value is less than height()
  • caching_hint whether the pixels should be cached locally Returns: true if pixels are copied to dst_pixels

pub fn read_pixels_to_pixmap_with_context<'a>( &self, context: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, dst: &Pixmap<'_>, src: impl Into<IPoint>, caching_hint: SkImage_CachingHint, ) -> bool

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

dst specifies width, height, ColorType, AlphaType, ColorSpace, pixel storage, and row bytes of destination. dst.row_bytes() specifics the gap from one destination row to the next. Returns true if pixels are copied. Returns false if:

Pixels are copied only if pixel conversion is possible. If Image ColorType is ColorType::Gray8, or ColorType::Alpha8; dst.color_type() must match. If Image ColorType is ColorType::Gray8, dst.color_space() must match. If Image AlphaType is AlphaType::Opaque, dst.alpha_type() must match. If Image ColorSpace is None, dst.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 width() or height() is zero or negative. Returns false if abs(src_x) >= Image width(), or if abs(src_y) >= Image height().

If caching_hint is CachingHint::Allow, pixels may be retained locally. If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.

  • context the gpu::DirectContext in play, if it exists
  • dst destination Pixmap:ImageInfo, pixels, row bytes
  • src_x column index whose absolute value is less than width()
  • src_y row index whose absolute value is less than height()
  • caching_hint whether the pixels should be cached locally_z Returns: true if pixels are copied to dst

pub fn read_pixels<P>( &self, dst_info: &Handle<SkImageInfo>, pixels: &mut [P], dst_row_bytes: usize, src: impl Into<IPoint>, caching_hint: SkImage_CachingHint, ) -> bool

pub unsafe fn read_pixels_to_pixmap( &self, dst: &Pixmap<'_>, src: impl Into<IPoint>, caching_hint: SkImage_CachingHint, ) -> bool

pub fn scale_pixels( &self, dst: &Pixmap<'_>, sampling: impl Into<SamplingOptions>, caching_hint: impl Into<Option<SkImage_CachingHint>>, ) -> bool

Copies Image to dst, scaling pixels to fit dst.width() and dst.height(), and converting pixels to match dst.color_type() and dst.alpha_type(). Returns true if pixels are copied. Returns false if dst.addr() is None, or dst.row_bytes() is less than dst ImageInfo::min_row_bytes.

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

If caching_hint is CachingHint::Allow, pixels may be retained locally. If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.

  • dst destination Pixmap:ImageInfo, pixels, row bytes Returns: true if pixels are scaled to fit dst

pub fn encode_to_data_with_context( &self, context: impl Into<Option<RCHandle<GrDirectContext>>>, image_format: SkEncodedImageFormat, quality: impl Into<Option<u32>>, ) -> Option<RCHandle<SkData>>

👎Deprecated since 0.63.0: Use encode

Encodes Image pixels, returning result as Data.

Returns None if encoding fails, or if encoded_image_format is not supported.

Image encoding in a format requires both building with one or more of: SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP; and platform support for the encoded format.

If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, encoded_image_format can additionally be one of: EncodedImageFormat::ICO, EncodedImageFormat::BMP, EncodedImageFormat::GIF.

quality is a platform and format specific metric trading off size and encoding error. When used, quality equaling 100 encodes with the least error. quality may be ignored by the encoder.

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

pub fn encode_to_data( &self, image_format: SkEncodedImageFormat, ) -> Option<RCHandle<SkData>>

👎Deprecated since 0.63.0: Support for encoding GPU backed images without a context was removed, use encode_to_data_with_context instead

pub fn encode_to_data_with_quality( &self, image_format: SkEncodedImageFormat, quality: u32, ) -> Option<RCHandle<SkData>>

👎Deprecated since 0.63.0: Support for encoding GPU backed images without a context was removed, use encode_to_data_with_context instead

Encodes Image pixels, returning result as Data.

Returns None if encoding fails, or if encoded_image_format is not supported.

Image encoding in a format requires both building with one or more of: SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP; and platform support for the encoded format.

If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, encoded_image_format can additionally be one of: EncodedImageFormat::ICO, EncodedImageFormat::BMP, EncodedImageFormat::GIF.

quality is a platform and format specific metric trading off size and encoding error. When used, quality equaling 100 encodes with the least error. quality may be ignored by the encoder.

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

pub fn encoded_data(&self) -> Option<RCHandle<SkData>>

Returns encoded Image pixels as Data, if Image was created from supported encoded stream format. Platform support for formats vary and may require building with one or more of: SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP.

Returns None if Image contents are not encoded.

Returns: encoded Image, or None

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

pub fn new_subset(&self, rect: impl AsRef<IRect>) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.64.0: use make_subset()

pub fn new_subset_with_context<'a>( &self, rect: impl AsRef<IRect>, direct: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.64.0: use make_subset()

Returns subset of this image.

Returns None if any of the following are true:

  • Subset is empty
  • Subset is not contained inside the image’s bounds
  • Pixels in the image could not be read or copied

If this image is texture-backed, the context parameter is required and must match the context of the source image. If the context parameter is provided, and the image is raster-backed, the subset will be converted to texture-backed.

  • subset bounds of returned Image
  • context the gpu::DirectContext in play, if it exists Returns: the subsetted image, or None

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

pub fn make_subset<'a>( &self, direct: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, subset: impl AsRef<IRect>, ) -> Option<RCHandle<SkImage>>

Returns subset of this image.

Returns None if any of the following are true: - Subset is empty - Subset is not contained inside the image’s bounds - Pixels in the source image could not be read or copied - This image is texture-backed and the provided context is null or does not match the source image’s context.

If the source image was texture-backed, the resulting image will be texture-backed also. Otherwise, the returned image will be raster-backed.

  • direct - the gpu::DirectContext of the source image (None is ok if the source image is not texture-backed).
  • subset - bounds of returned Image Returns: the subsetted image, or None

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

pub fn has_mipmaps(&self) -> bool

Returns true if the image has mipmap levels.

pub fn with_default_mipmaps(&self) -> Option<RCHandle<SkImage>>

Returns an image with the same “base” pixels as the this image, but with mipmap levels automatically generated and attached.

pub fn new_texture_image( &self, context: &mut RCHandle<GrDirectContext>, mipmapped: skgpu_Mipmapped, ) -> Option<RCHandle<SkImage>>

pub fn new_texture_image_budgeted( &self, direct_context: &mut RCHandle<GrDirectContext>, mipmapped: skgpu_Mipmapped, budgeted: Budgeted, ) -> Option<RCHandle<SkImage>>

Returns Image backed by GPU texture associated with context. Returned Image is compatible with crate::Surface created with dst_color_space. The returned Image respects mipmapped setting; if mipmapped equals gpu::Mipmapped::Yes, the backing texture allocates mip map levels.

The mipmapped parameter is effectively treated as No if MIP maps are not supported by the GPU.

Returns original Image if the image is already texture-backed, the context matches, and mipmapped is compatible with the backing GPU texture. crate::Budgeted is ignored in this case.

Returns None if context is None, or if Image was created with another gpu::DirectContext.

  • direct_context the gpu::DirectContext in play, if it exists
  • mipmapped whether created Image texture must allocate mip map levels
  • budgeted whether to count a newly created texture for the returned image counts against the context’s budget. Returns: created Image, or None

pub fn to_non_texture_image(&self) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.64.0: use make_non_texture_image()

Returns raster image or lazy image. Copies Image backed by GPU texture into CPU memory if needed. Returns original Image if decoded in raster bitmap, or if encoded in a stream.

Returns None if backed by GPU texture and copy fails.

Returns: raster image, lazy image, or None

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

pub fn make_non_texture_image<'a>( &self, context: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, ) -> Option<RCHandle<SkImage>>

Returns raster image or lazy image. Copies Image backed by GPU texture into CPU memory if needed. Returns original Image if decoded in raster bitmap, or if encoded in a stream.

Returns None if backed by GPU texture and copy fails.

Returns: raster image, lazy image, or None

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

pub fn to_raster_image( &self, caching_hint: impl Into<Option<SkImage_CachingHint>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.64.0: use make_raster_image()

Returns raster image. Copies Image backed by GPU texture into CPU memory, or decodes Image from lazy image. Returns original Image if decoded in raster bitmap.

Returns None if copy, decode, or pixel read fails.

If caching_hint is CachingHint::Allow, pixels may be retained locally. If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.

Returns: raster image, or None

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

pub fn make_raster_image<'a>( &self, context: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, caching_hint: impl Into<Option<SkImage_CachingHint>>, ) -> Option<RCHandle<SkImage>>

Returns raster image. Copies Image backed by GPU texture into CPU memory, or decodes Image from lazy image. Returns original Image if decoded in raster bitmap.

Returns None if copy, decode, or pixel read fails.

If caching_hint is CachingHint::Allow, pixels may be retained locally. If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.

Returns: raster image, or None

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

pub fn new_with_filter( &self, _context: Option<&mut RCHandle<GrRecordingContext>>, filter: &RCHandle<SkImageFilter>, clip_bounds: impl Into<IRect>, subset: impl Into<IRect>, ) -> Option<(RCHandle<SkImage>, IRect, IPoint)>

👎Deprecated since 0.67.0: use images::make_with_filter()

Creates filtered Image. filter processes original Image, potentially changing color, position, and size. subset is the bounds of original Image processed by filter. clip_bounds is the expected bounds of the filtered Image. out_subset is required storage for the actual bounds of the filtered Image. offset is required storage for translation of returned Image.

Returns None if Image could not be created or if the recording context provided doesn’t match the GPU context in which the image was created. If None is returned, out_subset and offset are undefined.

Useful for animation of ImageFilter that varies size from frame to frame. Returned Image is created larger than required by filter so that GPU texture can be reused with different sized effects. out_subset describes the valid bounds of GPU texture returned. offset translates the returned Image to keep subsequent animation frames aligned with respect to each other.

  • context the gpu::RecordingContext in play - if it exists
  • filter how Image is sampled when transformed
  • subset bounds of Image processed by filter
  • clip_bounds expected bounds of filtered Image
  • out_subset storage for returned Image bounds
  • offset storage for returned Image translation Returns: filtered Image, or None

pub fn is_lazy_generated(&self) -> bool

Returns true if Image is backed by an image-generator or other service that creates and caches its pixels or texture on-demand.

Returns: true if Image is created as needed

example: https://fiddle.skia.org/c/@Image_isLazyGenerated_a example: https://fiddle.skia.org/c/@Image_isLazyGenerated_b

pub fn new_color_space( &self, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.64.0: use make_color_space()

pub fn new_color_space_with_context<'a>( &self, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, direct: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, ) -> Option<RCHandle<SkImage>>

👎Deprecated since 0.64.0: use make_color_space()

Creates Image in target ColorSpace. Returns None if Image could not be created.

Returns original Image if it is in target ColorSpace. Otherwise, converts pixels from Image ColorSpace to target ColorSpace. If Image color_space() returns None, Image ColorSpace is assumed to be s_rgb.

If this image is texture-backed, the context parameter is required and must match the context of the source image.

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

pub fn make_color_space<'a>( &self, direct: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Option<RCHandle<SkImage>>

Creates Image in target ColorSpace. Returns None if Image could not be created.

Returns original Image if it is in target ColorSpace. Otherwise, converts pixels from Image ColorSpace to target ColorSpace. If Image color_space() returns None, Image ColorSpace is assumed to be s_rgb.

If this image is texture-backed, the context parameter is required and must match the context of the source image.

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

pub fn reinterpret_color_space( &self, new_color_space: impl Into<RCHandle<SkColorSpace>>, ) -> Option<RCHandle<SkImage>>

Creates a new Image identical to this one, but with a different ColorSpace. This does not convert the underlying pixel data, so the resulting image will draw differently.

§

impl RCHandle<SkImageFilter>

pub fn filter_bounds<'a>( &self, src: impl AsRef<IRect>, ctm: &Matrix, map_direction: SkImageFilter_MapDirection, input_rect: impl Into<Option<&'a IRect>>, ) -> IRect

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

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

pub fn count_inputs(&self) -> usize

pub fn input(&self, i: usize) -> Option<RCHandle<SkImageFilter>>

👎Deprecated: use get_input()

pub fn get_input(&self, i: usize) -> Option<RCHandle<SkImageFilter>>

pub fn inputs( &self, ) -> impl Iterator<Item = Option<RCHandle<SkImageFilter>>> + Captures<&RCHandle<SkImageFilter>>

pub fn compute_fast_bounds(&self, bounds: impl AsRef<Rect>) -> Rect

pub fn can_compute_fast_bounds(&self) -> bool

pub fn with_local_matrix( &self, matrix: &Matrix, ) -> Option<RCHandle<SkImageFilter>>

§

impl RCHandle<SkMaskFilter>

pub fn blur( style: SkBlurStyle, sigma: f32, respect_ctm: impl Into<Option<bool>>, ) -> Option<RCHandle<SkMaskFilter>>

Create a blur mask filter.

  • style The BlurStyle to use
  • sigma Standard deviation of the Gaussian blur to apply. Must be > 0.
  • respect_ctm if true the blur’s sigma is modified by the ctm. Returns the new blur mask filter

pub fn approximate_filtered_bounds(&self, src: impl AsRef<Rect>) -> Rect

Returns the approximate bounds that would result from filtering the src rect. The actual result may be different, but it should be contained within the returned bounds.

pub fn compose( _outer: RCHandle<SkMaskFilter>, _inner: RCHandle<SkMaskFilter>, ) -> !

👎Deprecated since 0.30.0: removed without replacement

pub fn combine( _filter_a: RCHandle<SkMaskFilter>, _filter_b: RCHandle<SkMaskFilter>, _mode: SkCoverageMode, ) -> !

👎Deprecated since 0.30.0: removed without replacement

pub fn with_matrix(&self, _matrix: &Matrix) -> !

👎Deprecated since 0.29.0: removed without replacement
§

impl RCHandle<SkPathEffect>

pub fn sum( first: impl Into<RCHandle<SkPathEffect>>, second: impl Into<RCHandle<SkPathEffect>>, ) -> RCHandle<SkPathEffect>

pub fn compose( first: impl Into<RCHandle<SkPathEffect>>, second: impl Into<RCHandle<SkPathEffect>>, ) -> RCHandle<SkPathEffect>

pub fn as_a_dash(&self) -> Option<DashInfo>

pub fn filter_path( &self, src: &Handle<SkPath>, stroke_rec: &Handle<SkStrokeRec>, cull_rect: impl AsRef<Rect>, ) -> Option<(Handle<SkPath>, Handle<SkStrokeRec>)>

pub fn filter_path_inplace( &self, dst: &mut Handle<SkPath>, src: &Handle<SkPath>, stroke_rec: &mut Handle<SkStrokeRec>, cull_rect: impl AsRef<Rect>, ) -> bool

pub fn filter_path_inplace_with_matrix( &self, dst: &mut Handle<SkPath>, src: &Handle<SkPath>, stroke_rec: &mut Handle<SkStrokeRec>, cull_rect: impl AsRef<Rect>, ctm: &Matrix, ) -> bool

pub fn needs_ctm(&self) -> bool

§

impl RCHandle<SkPicture>

pub fn from_data(data: &RCHandle<SkData>) -> Option<RCHandle<SkPicture>>

pub fn from_bytes(bytes: &[u8]) -> Option<RCHandle<SkPicture>>

pub fn playback(&self, canvas: &Canvas)

pub fn cull_rect(&self) -> Rect

pub fn unique_id(&self) -> u32

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

pub fn new_placeholder(cull: impl AsRef<Rect>) -> RCHandle<SkPicture>

pub fn approximate_op_count(&self) -> usize

pub fn approximate_op_count_nested( &self, nested: impl Into<Option<bool>>, ) -> usize

pub fn approximate_bytes_used(&self) -> usize

pub fn to_shader<'a, 'b>( &self, tm: impl Into<Option<(SkTileMode, SkTileMode)>>, mode: SkFilterMode, local_matrix: impl Into<Option<&'a Matrix>>, tile_rect: impl Into<Option<&'b Rect>>, ) -> RCHandle<SkShader>

§

impl RCHandle<SkPixelRef>

pub fn dimensions(&self) -> ISize

pub fn width(&self) -> i32

pub fn height(&self) -> i32

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

pub fn row_bytes(&self) -> usize

pub fn generation_id(&self) -> u32

pub fn notify_pixels_changed(&mut self)

pub fn is_immutable(&self) -> bool

pub fn set_immutable(&mut self)

pub fn notify_added_to_cache(&mut self)

§

impl RCHandle<SkShader>

Shaders specify the source color(s) for what is being drawn. If a paint has no shader, then the paint’s color is used. If the paint has a shader, then the shader’s color(s) are use instead, but they are modulated by the paint’s alpha. This makes it easy to create a shader once (e.g. bitmap tiling or gradient) and then change its transparency w/o having to modify the original shader… only the paint’s alpha needs to be modified.

pub fn is_opaque(&self) -> bool

Returns true if the shader is guaranteed to produce only opaque colors, subject to the crate::Paint using the shader to apply an opaque alpha value. Subclasses should override this to allow some optimizations.

pub fn image( &self, ) -> Option<(RCHandle<SkImage>, Matrix, (SkTileMode, SkTileMode))>

Returns iff this shader is backed by a single Image. If not, returns None.

pub fn is_a_image(&self) -> bool

pub fn with_local_matrix(&self, matrix: &Matrix) -> RCHandle<SkShader>

Return a shader that will apply the specified local_matrix to this shader. The specified matrix will be applied before any matrix associated with this shader.

pub fn with_color_filter( &self, color_filter: impl Into<RCHandle<SkColorFilter>>, ) -> RCHandle<SkShader>

Create a new shader that produces the same colors as invoking this shader and then applying the color filter.

pub fn with_working_color_space( &self, color_space: impl Into<RCHandle<SkColorSpace>>, ) -> RCHandle<SkShader>

Return a shader that will compute this shader in a specific color space. By default, all shaders operate in the destination (surface) color space. The results of a shader are still always converted to the destination - this API has no impact on simple shaders or images. Primarily, it impacts shaders that perform mathematical operations, like Blend shaders, or runtime shaders.

§

impl RCHandle<SkSurface>

pub fn new_raster_direct<'pixels>( image_info: &Handle<SkImageInfo>, pixels: &'pixels mut [u8], row_bytes: impl Into<Option<usize>>, surface_props: Option<&SurfaceProps>, ) -> Option<Borrows<'pixels, RCHandle<SkSurface>>>

👎Deprecated since 0.64.0: use surfaces::wrap_pixels()

Allocates raster Surface. Canvas returned by Surface draws directly into pixels.

Surface is returned if all parameters are valid. Valid parameters include: info dimensions are greater than zero; info contains crate::ColorType and crate::AlphaType supported by raster surface; pixels is not None; row_bytes is large enough to contain info width pixels of crate::ColorType.

Pixel buffer size should be info height times computed row_bytes. Pixels are not initialized. To access pixels after drawing, Self::peek_pixels() or Self::read_pixels().

  • image_info - width, height, crate::ColorType, crate::AlphaType, crate::ColorSpace, of raster surface; width and height must be greater than zero
  • pixels - pointer to destination pixels buffer
  • row_bytes - interval from one Surface row to the next
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None Returns: Surface if all parameters are valid; otherwise, None

pub fn new_raster( image_info: &Handle<SkImageInfo>, row_bytes: impl Into<Option<usize>>, surface_props: Option<&SurfaceProps>, ) -> Option<RCHandle<SkSurface>>

👎Deprecated since 0.64.0: use surfaces::raster()

Allocates raster Surface. Canvas returned by Surface draws directly into pixels. Allocates and zeroes pixel memory. Pixel memory size is image_info.height() times row_bytes, or times image_info.min_row_bytes() if row_bytes is zero. Pixel memory is deleted when Surface is deleted.

Surface is returned if all parameters are valid. Valid parameters include: info dimensions are greater than zero; info contains crate::ColorType and crate::AlphaType supported by raster surface; row_bytes is large enough to contain info width pixels of crate::ColorType, or is zero.

If row_bytes is zero, a suitable value will be chosen internally.

  • image_info - width, height, crate::ColorType, crate::AlphaType, crate::ColorSpace, of raster surface; width and height must be greater than zero
  • row_bytes - interval from one Surface row to the next; may be zero
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None Returns: Surface if all parameters are valid; otherwise, None

pub fn new_raster_n32_premul( size: impl Into<ISize>, ) -> Option<RCHandle<SkSurface>>

👎Deprecated since 0.64.0: use surfaces::raster_n32_premul()

Allocates raster Surface. Canvas returned by Surface draws directly into pixels. Allocates and zeroes pixel memory. Pixel memory size is height times width times four. Pixel memory is deleted when Surface is deleted.

Internally, sets ImageInfo to width, height, native color type, and crate::AlphaType::Premul.

Surface is returned if width and height are greater than zero.

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

  • width - pixel column count; must be greater than zero
  • height - pixel row count; must be greater than zero
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None Returns: Surface if all parameters are valid; otherwise, None
§

impl RCHandle<SkSurface>

pub fn from_backend_texture( context: &mut RCHandle<GrRecordingContext>, backend_texture: &RefHandle<GrBackendTexture>, origin: GrSurfaceOrigin, sample_cnt: impl Into<Option<usize>>, color_type: ColorType, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, surface_props: Option<&SurfaceProps>, ) -> Option<RCHandle<SkSurface>>

👎Deprecated since 0.64.0: use gpu::surfaces::wrap_backend_texture()

Wraps a GPU-backed texture into Surface. Caller must ensure the texture is valid for the lifetime of returned Surface. If sample_cnt greater than zero, creates an intermediate MSAA Surface which is used for drawing backend_texture.

Surface is returned if all parameters are valid. backend_texture is valid if its pixel configuration agrees with color_space and context; for instance, if backend_texture has an sRGB configuration, then context must support sRGB, and color_space must be present. Further, backend_texture width and height must not exceed context capabilities, and the context must be able to support back-end textures.

  • context - GPU context
  • backend_texture - texture residing on GPU
  • sample_cnt - samples per pixel, or 0 to disable full scene anti-aliasing
  • color_space - range of colors; may be None
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None Returns: Surface if all parameters are valid; otherwise, None

pub fn from_backend_render_target( context: &mut RCHandle<GrRecordingContext>, backend_render_target: &Handle<GrBackendRenderTarget>, origin: GrSurfaceOrigin, color_type: ColorType, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, surface_props: Option<&SurfaceProps>, ) -> Option<RCHandle<SkSurface>>

👎Deprecated since 0.64.0: use gpu::surfaces::wrap_backend_render_target()

Wraps a GPU-backed buffer into Surface. Caller must ensure backend_render_target is valid for the lifetime of returned Surface.

Surface is returned if all parameters are valid. backend_render_target is valid if its pixel configuration agrees with color_space and context; for instance, if backend_render_target has an sRGB configuration, then context must support sRGB, and color_space must be present. Further, backend_render_target width and height must not exceed context capabilities, and the context must be able to support back-end render targets.

  • context - GPU context
  • backend_render_target - GPU intermediate memory buffer
  • color_space - range of colors
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None Returns: Surface if all parameters are valid; otherwise, None

pub fn new_render_target( context: &mut RCHandle<GrRecordingContext>, budgeted: Budgeted, image_info: &Handle<SkImageInfo>, sample_count: impl Into<Option<usize>>, surface_origin: impl Into<Option<GrSurfaceOrigin>>, surface_props: Option<&SurfaceProps>, should_create_with_mips: impl Into<Option<bool>>, ) -> Option<RCHandle<SkSurface>>

👎Deprecated since 0.64.0: use gpu::surfaces::render_target()

Returns Surface on GPU indicated by context. Allocates memory for pixels, based on the width, height, and crate::ColorType in ImageInfo. budgeted selects whether allocation for pixels is tracked by context. image_info describes the pixel format in crate::ColorType, and transparency in crate::AlphaType, and color matching in crate::ColorSpace.

sample_count requests the number of samples per pixel. Pass zero to disable multi-sample anti-aliasing. The request is rounded up to the next supported count, or rounded down if it is larger than the maximum supported count.

surface_origin pins either the top-left or the bottom-left corner to the origin.

should_create_with_mips hints that Image returned by Image::image_snapshot is mip map.

  • context - GPU context
  • image_info - width, height, crate::ColorType, crate::AlphaType, crate::ColorSpace; width, or height, or both, may be zero
  • sample_count - samples per pixel, or 0 to disable full scene anti-aliasing
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None
  • should_create_with_mips - hint that Surface will host mip map images Returns: Surface if all parameters are valid; otherwise, None
§

impl RCHandle<SkSurface>

pub fn new_null(size: impl Into<ISize>) -> Option<RCHandle<SkSurface>>

👎Deprecated since 0.64.0: use surfaces::null()

Returns Surface without backing pixels. Drawing to Canvas returned from Surface has no effect. Calling Self::image_snapshot() on returned Surface returns None.

  • width - one or greater
  • height - one or greater Returns: Surface if width and height are positive; otherwise, None

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

pub fn width(&self) -> i32

Returns pixel count in each row; may be zero or greater.

Returns: number of pixel columns

pub fn height(&self) -> i32

Returns pixel row count; may be zero or greater.

Returns: number of pixel rows

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

Returns an ImageInfo describing the surface.

pub fn generation_id(&mut self) -> u32

Returns unique value identifying the content of Surface. Returned value changes each time the content changes. Content is changed by drawing, or by calling Self::notify_content_will_change().

Returns: unique content identifier

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

pub fn notify_content_will_change( &mut self, mode: SkSurface_ContentChangeMode, ) -> &mut RCHandle<SkSurface>

Notifies that Surface contents will be changed by code outside of Skia. Subsequent calls to Self::generation_id() return a different value.

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

§

impl RCHandle<SkSurface>

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

Returns the recording context being used by the Surface.

Returns: the recording context, if available; None otherwise

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

rust-skia helper, not in Skia

pub fn get_backend_texture( &mut self, handle_access: SkSurface_BackendHandleAccess, ) -> Option<RefHandle<GrBackendTexture>>

👎Deprecated since 0.64.0: use gpu::surfaces::get_backend_texture()

Retrieves the back-end texture. If Surface has no back-end texture, None is returned.

The returned gpu::BackendTexture should be discarded if the Surface is drawn to or deleted.

Returns: GPU texture reference; None on failure

pub fn get_backend_render_target( &mut self, handle_access: SkSurface_BackendHandleAccess, ) -> Option<Handle<GrBackendRenderTarget>>

👎Deprecated since 0.64.0: use gpu::surfaces::get_backend_render_target()

Retrieves the back-end render target. If Surface has no back-end render target, None is returned.

The returned gpu::BackendRenderTarget should be discarded if the Surface is drawn to or deleted.

Returns: GPU render target reference; None on failure

pub fn replace_backend_texture( &mut self, backend_texture: &RefHandle<GrBackendTexture>, origin: GrSurfaceOrigin, ) -> bool

If the surface was made via Self::from_backend_texture then it’s backing texture may be substituted with a different texture. The contents of the previous backing texture are copied into the new texture. Canvas state is preserved. The original sample count is used. The gpu::BackendFormat and dimensions of replacement texture must match that of the original.

  • backend_texture - the new backing texture for the surface

pub fn replace_backend_texture_with_mode( &mut self, backend_texture: &RefHandle<GrBackendTexture>, origin: GrSurfaceOrigin, mode: impl Into<Option<SkSurface_ContentChangeMode>>, ) -> bool

If the surface was made via Self::from_backend_texture() then it’s backing texture may be substituted with a different texture. The contents of the previous backing texture are copied into the new texture. Canvas state is preserved. The original sample count is used. The gpu::BackendFormat and dimensions of replacement texture must match that of the original.

  • backend_texture - the new backing texture for the surface
  • mode - Retain or discard current Content
§

impl RCHandle<SkSurface>

pub fn canvas(&mut self) -> &Canvas

Returns Canvas that draws into Surface. Subsequent calls return the same Canvas. Canvas returned is managed and owned by Surface, and is deleted when Surface is deleted.

Returns: drawing Canvas for Surface

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

pub fn new_surface( &mut self, image_info: &Handle<SkImageInfo>, ) -> Option<RCHandle<SkSurface>>

Returns a compatible Surface, or None. Returned Surface contains the same raster, GPU, or null properties as the original. Returned Surface does not share the same pixels.

Returns None if image_info width or height are zero, or if image_info is incompatible with Surface.

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

pub fn new_surface_with_dimensions( &mut self, dim: impl Into<ISize>, ) -> Option<RCHandle<SkSurface>>

Calls Self::new_surface() with the same ImageInfo as this surface, but with the specified width and height.

pub fn image_snapshot(&mut self) -> RCHandle<SkImage>

Returns Image capturing Surface contents. Subsequent drawing to Surface contents are not captured. Image allocation is accounted for if Surface was created with gpu::Budgeted::Yes.

Returns: Image initialized with Surface contents

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

pub fn image_snapshot_with_bounds( &mut self, bounds: impl AsRef<IRect>, ) -> Option<RCHandle<SkImage>>

Like the no-parameter version, this returns an image of the current surface contents. This variant takes a rectangle specifying the subset of the surface that is of interest. These bounds will be sanitized before being used.

  • If bounds extends beyond the surface, it will be trimmed to just the intersection of it and the surface.
  • If bounds does not intersect the surface, then this returns None.
  • If bounds == the surface, then this is the same as calling the no-parameter variant.

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

pub fn draw( &mut self, canvas: &Canvas, offset: impl Into<Point>, sampling: impl Into<SamplingOptions>, paint: Option<&Handle<SkPaint>>, )

Draws Surface contents to canvas, with its top-left corner at (offset.x, offset.y).

If Paint paint is not None, apply crate::ColorFilter, alpha, crate::ImageFilter, and crate::BlendMode.

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

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

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

Copies crate::Rect of pixels to dst.

Source crate::Rect corners are (src.x, src.y) and Surface (width(), height()). Destination crate::Rect corners are (0, 0) and (dst.width(), dst.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to dst_color_type() and dst_alpha_type() if required.

Pixels are readable when Surface is raster, or backed by a GPU.

The destination pixel storage must be allocated by the caller.

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

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

Does not copy, and returns false if:

  • Source and destination rectangles do not intersect.
  • Pixmap pixels could not be allocated.
  • dst.row_bytes() is too small to contain one row of pixels.
  • dst - storage for pixels copied from Surface
  • src_x - offset into readable pixels on x-axis; may be negative
  • src_y - offset into readable pixels on y-axis; may be negative Returns: true if pixels were copied

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

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

Copies crate::Rect of pixels from Canvas into dst_pixels.

Source crate::Rect corners are (src.x, src.y) and Surface (width(), height()). Destination crate::Rect corners are (0, 0) and (dst_info.width(), dst_info.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to dst_info_color_type() and dst_info_alpha_type() if required.

Pixels are readable when Surface is raster, or backed by a GPU.

The destination pixel storage must be allocated by the caller.

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

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

Does not copy, and returns false if:

  • Source and destination rectangles do not intersect.
  • Surface pixels could not be converted to dst_info.color_type() or dst_info.alpha_type().
  • dst_row_bytes is too small to contain one row of pixels.
  • dst_info - width, height, crate::ColorType, and crate::AlphaType of dst_pixels
  • dst_pixels - storage for pixels; dst_info.height() times dst_row_bytes, or larger
  • dst_row_bytes - size of one destination row; dst_info.width() times pixel size, or larger
  • src.x - offset into readable pixels on x-axis; may be negative
  • src.y - offset into readable pixels on y-axis; may be negative Returns: true if pixels were copied

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

Copies crate::Rect of pixels from Surface into bitmap.

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

Pixels are readable when Surface is raster, or backed by a GPU.

The destination pixel storage must be allocated by the caller.

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

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

Does not copy, and returns false if:

  • Source and destination rectangles do not intersect.
  • Surface pixels could not be converted to dst.color_type() or dst.alpha_type().
  • dst pixels could not be allocated.
  • dst.row_bytes() is too small to contain one row of pixels.
  • dst - storage for pixels copied from Surface
  • src.x - offset into readable pixels on x-axis; may be negative
  • src.y - offset into readable pixels on y-axis; may be negative Returns: true if pixels were copied

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

pub fn write_pixels_from_pixmap( &mut self, src: &Pixmap<'_>, dst: impl Into<IPoint>, )

Copies crate::Rect of pixels from the src Pixmap to the Surface.

Source crate::Rect corners are (0, 0) and (src.width(), src.height()). Destination crate::Rect corners are (dst.x, dst.y) and (dst.x + Surface width(), dst.y + Surface height()).

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

  • src - storage for pixels to copy to Surface
  • dst.x - x-axis position relative to Surface to begin copy; may be negative
  • dst.y - y-axis position relative to Surface to begin copy; may be negative

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

pub fn write_pixels_from_bitmap( &mut self, bitmap: &Handle<SkBitmap>, dst: impl Into<IPoint>, )

Copies crate::Rect of pixels from the src Bitmap to the Surface.

Source crate::Rect corners are (0, 0) and (src.width(), src.height()). Destination crate::Rect corners are (dst.x, dst.y) and (dst.x+ Surface width(),dst.y + Surface height()).

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

  • src - storage for pixels to copy to Surface
  • dst.x - x-axis position relative to Surface to begin copy; may be negative
  • dst.y - y-axis position relative to Surface to begin copy; may be negative

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

pub fn props(&self) -> &SurfaceProps

Returns SurfaceProps for surface.

Returns: LCD striping orientation and setting for device independent fonts

§

impl RCHandle<SkSurface>

pub fn resolve_msaa(&mut self)

👎Deprecated since 0.65.0: Use gpu::surfaces::resolve_msaa

If a surface is GPU texture backed, is being drawn with MSAA, and there is a resolve texture, this call will insert a resolve command into the stream of gpu commands. In order for the resolve to actually have an effect, the work still needs to be flushed and submitted to the GPU after recording the resolve command. If a resolve is not supported or the Surface has no dirty work to resolve, then this call is a no-op.

This call is most useful when the Surface is created by wrapping a single sampled gpu texture, but asking Skia to render with MSAA. If the client wants to use the wrapped texture outside of Skia, the only way to trigger a resolve is either to call this command or use Self::flush().

§

impl RCHandle<SkTextBlob>

pub fn new( str: impl AsRef<str>, font: &Handle<SkFont>, ) -> Option<RCHandle<SkTextBlob>>

pub fn bounds(&self) -> &Rect

pub fn unique_id(&self) -> u32

pub fn get_intercepts( &self, bounds: [f32; 2], paint: Option<&Handle<SkPaint>>, ) -> Vec<f32>

pub fn from_str( str: impl AsRef<str>, font: &Handle<SkFont>, ) -> Option<RCHandle<SkTextBlob>>

pub fn from_text( text: impl EncodedText, font: &Handle<SkFont>, ) -> Option<RCHandle<SkTextBlob>>

pub fn from_pos_text_h( text: impl EncodedText, x_pos: &[f32], const_y: f32, font: &Handle<SkFont>, ) -> Option<RCHandle<SkTextBlob>>

pub fn from_pos_text( text: impl EncodedText, pos: &[Point], font: &Handle<SkFont>, ) -> Option<RCHandle<SkTextBlob>>

pub fn from_rsxform( text: impl EncodedText, xform: &[RSXform], font: &Handle<SkFont>, ) -> Option<RCHandle<SkTextBlob>>

§

impl RCHandle<SkTypeface>

pub fn font_style(&self) -> FontStyle

pub fn is_bold(&self) -> bool

pub fn is_italic(&self) -> bool

pub fn is_fixed_pitch(&self) -> bool

pub fn variation_design_position(&self) -> Option<Vec<Coordinate>>

pub fn variation_design_parameters(&self) -> Option<Vec<Axis>>

pub fn unique_id(&self) -> u32

pub fn equal( face_a: impl AsRef<RCHandle<SkTypeface>>, face_b: impl AsRef<RCHandle<SkTypeface>>, ) -> bool

pub fn clone_with_arguments( &self, arguments: &FontArguments<'_, '_>, ) -> Option<RCHandle<SkTypeface>>

pub fn serialize_stream( &self, write: impl Write, behavior: SkTypeface_SerializeBehavior, )

pub fn serialize( &self, behavior: SkTypeface_SerializeBehavior, ) -> RCHandle<SkData>

pub fn make_deserialize( data: impl Read, last_resort_mgr: impl Into<Option<RCHandle<SkFontMgr>>>, ) -> Option<RCHandle<SkTypeface>>

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

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

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

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

pub fn count_glyphs(&self) -> usize

pub fn count_tables(&self) -> usize

pub fn table_tags(&self) -> Option<Vec<u32>>

pub fn get_table_size(&self, tag: u32) -> Option<usize>

pub fn get_table_data(&self, tag: u32, data: &mut [u8]) -> usize

pub fn copy_table_data(&self, tag: u32) -> Option<RCHandle<SkData>>

pub fn units_per_em(&self) -> Option<i32>

pub fn get_kerning_pair_adjustments( &self, glyphs: &[u16], adjustments: &mut [i32], ) -> bool

pub fn new_family_name_iterator(&self) -> impl Iterator<Item = LocalizedString>

pub fn family_name(&self) -> String

pub fn post_script_name(&self) -> Option<String>

pub fn to_font_data(&self) -> Option<(Vec<u8>, usize)>

pub fn bounds(&self) -> Rect

§

impl RCHandle<SkVertices>

pub fn new_copy( mode: SkVertices_VertexMode, positions: &[Point], texs: &[Point], colors: &[Color], indices: Option<&[u16]>, ) -> RCHandle<SkVertices>

pub const MAX_CUSTOM_ATTRIBUTES: usize = 8usize

pub fn unique_id(&self) -> u32

pub fn mode(&self) -> SkVertices_VertexMode

👎Deprecated since 0.29.0: will be removed without replacement

pub fn bounds(&self) -> &Rect

pub fn has_colors(&self) -> bool

👎Deprecated since 0.29.0: will be removed without replacement

pub fn has_tex_coords(&self) -> bool

👎Deprecated since 0.29.0: will be removed without replacement

pub fn has_bones(&self) -> bool

👎Deprecated since 0.29.0: returns false

pub fn has_indices(&self) -> bool

👎Deprecated since 0.29.0: will be removed without replacement

pub fn vertex_count(&self) -> usize

👎Deprecated since 0.29.0: will be removed without replacement

pub fn index_count(&self) -> usize

👎Deprecated since 0.29.0: will be removed without replacement

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

👎Deprecated since 0.29.0: will be removed without replacement

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

👎Deprecated since 0.29.0: will be removed without replacement

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

👎Deprecated since 0.29.0: will be removed without replacement

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

👎Deprecated since 0.29.0: returns None

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

👎Deprecated since 0.29.0: returns None

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

👎Deprecated since 0.29.0: will be removed without replacement

pub fn is_volatile(&self) -> bool

👎Deprecated since 0.29.0: returns false

pub fn apply_bones(&self, _bones: &[Bone]) -> !

👎Deprecated since 0.29.0: removed without replacement

pub fn approximate_size(&self) -> usize

pub fn decode(_buffer: &[u8]) -> !

👎Deprecated since 0.31.0: removed without replacement

pub fn encode(&self) -> !

👎Deprecated since 0.31.0: removed without replacement
§

impl RCHandle<SkShader>

pub fn fractal_perlin_noise( base_frequency: (f32, f32), num_octaves: usize, seed: f32, tile_size: impl Into<Option<ISize>>, ) -> Option<RCHandle<SkShader>>

pub fn turbulence_perlin_noise( base_frequency: (f32, f32), num_octaves: usize, seed: f32, tile_size: impl Into<Option<ISize>>, ) -> Option<RCHandle<SkShader>>

§

impl RCHandle<SkPathEffect>

pub fn path_1d( path: &Handle<SkPath>, advance: f32, phase: f32, style: SkPath1DPathEffect_Style, ) -> Option<RCHandle<SkPathEffect>>

§

impl RCHandle<SkPathEffect>

pub fn line_2d(width: f32, matrix: &Matrix) -> Option<RCHandle<SkPathEffect>>

pub fn path_2d(matrix: &Matrix, path: &Handle<SkPath>) -> RCHandle<SkPathEffect>

§

impl RCHandle<SkBlender>

pub fn arithmetic( k1: f32, k2: f32, k3: f32, k4: f32, enforce_premul: bool, ) -> Option<RCHandle<SkBlender>>

§

impl RCHandle<SkColorFilter>

pub fn new_lighting( mul: impl Into<Color>, add: impl Into<Color>, ) -> Option<RCHandle<SkColorFilter>>

👎Deprecated since 0.56.0: Use color_filters::lighting()
§

impl RCHandle<SkPathEffect>

pub fn corner_path(radius: f32) -> Option<RCHandle<SkPathEffect>>

§

impl RCHandle<SkPathEffect>

pub fn dash(intervals: &[f32], phase: f32) -> Option<RCHandle<SkPathEffect>>

§

impl RCHandle<SkPathEffect>

pub fn discrete( seg_length: f32, dev: f32, seed_assist: impl Into<Option<u32>>, ) -> Option<RCHandle<SkPathEffect>>

§

impl RCHandle<SkShader>

pub fn linear_gradient<'a>( points: (impl Into<Point>, impl Into<Point>), colors: impl Into<GradientShaderColors<'a>>, pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, flags: impl Into<Option<Flags>>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

pub fn linear_gradient_with_interpolation<'a>( points: (impl Into<Point>, impl Into<Point>), colors: (&[Color4f], impl Into<Option<RCHandle<SkColorSpace>>>), pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, interpolation: impl Into<Interpolation>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

pub fn radial_gradient<'a>( center: impl Into<Point>, radius: f32, colors: impl Into<GradientShaderColors<'a>>, pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, flags: impl Into<Option<Flags>>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

pub fn radial_gradient_with_interpolation<'a>( center_and_radius: (impl Into<Point>, f32), colors: (&[Color4f], impl Into<Option<RCHandle<SkColorSpace>>>), pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, interpolation: impl Into<Interpolation>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

pub fn two_point_conical_gradient<'a>( start: impl Into<Point>, start_radius: f32, end: impl Into<Point>, end_radius: f32, colors: impl Into<GradientShaderColors<'a>>, pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, flags: impl Into<Option<Flags>>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

pub fn two_point_conical_gradient_with_interpolation<'a>( start_and_radius: (impl Into<Point>, f32), end_and_radius: (impl Into<Point>, f32), colors: (&[Color4f], impl Into<Option<RCHandle<SkColorSpace>>>), pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, interpolation: impl Into<Interpolation>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

pub fn sweep_gradient<'a>( center: impl Into<Point>, colors: impl Into<GradientShaderColors<'a>>, pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, angles: impl Into<Option<(f32, f32)>>, flags: impl Into<Option<Flags>>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

pub fn sweep_gradient_with_interpolation<'a>( center: impl Into<Point>, colors: (&[Color4f], impl Into<Option<RCHandle<SkColorSpace>>>), pos: impl Into<Option<&'a [f32]>>, mode: SkTileMode, angles: impl Into<Option<(f32, f32)>>, interpolation: impl Into<Interpolation>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

§

impl RCHandle<SkColorFilter>

pub fn high_contrast( config: &HighContrastConfig, ) -> Option<RCHandle<SkColorFilter>>

§

impl RCHandle<SkImageFilter>

pub fn arithmetic<'a>( inputs: impl Into<ArithmeticFPInputs>, background: impl Into<Option<RCHandle<SkImageFilter>>>, foreground: impl Into<Option<RCHandle<SkImageFilter>>>, crop_rect: impl Into<Option<&'a IRect>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn blur<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, sigma: (f32, f32), tile_mode: impl Into<Option<SkTileMode>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn color_filter<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, cf: impl Into<RCHandle<SkColorFilter>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn compose( outer: impl Into<RCHandle<SkImageFilter>>, inner: impl Into<RCHandle<SkImageFilter>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn crop( rect: impl AsRef<Rect>, tile_mode: impl Into<Option<SkTileMode>>, input: impl Into<Option<RCHandle<SkImageFilter>>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn displacement_map_effect<'a>( channel_selectors: (SkColorChannel, SkColorChannel), scale: f32, displacement: impl Into<Option<RCHandle<SkImageFilter>>>, color: impl Into<Option<RCHandle<SkImageFilter>>>, crop_rect: impl Into<Option<&'a IRect>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn distant_lit_diffuse_lighting<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, direction: impl Into<Point3>, light_color: impl Into<Color>, surface_scale: f32, kd: f32, ) -> Option<RCHandle<SkImageFilter>>

pub fn point_lit_diffuse_lighting<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, location: impl Into<Point3>, light_color: impl Into<Color>, surface_scale: f32, kd: f32, ) -> Option<RCHandle<SkImageFilter>>

pub fn spot_lit_diffuse_lighting<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, location: impl Into<Point3>, target: impl Into<Point3>, specular_exponent: f32, cutoff_angle: f32, light_color: impl Into<Color>, surface_scale: f32, kd: f32, ) -> Option<RCHandle<SkImageFilter>>

pub fn distant_lit_specular_lighting<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, direction: impl Into<Point3>, light_color: impl Into<Color>, surface_scale: f32, ks: f32, shininess: f32, ) -> Option<RCHandle<SkImageFilter>>

pub fn point_lit_specular_lighting<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, location: impl Into<Point3>, light_color: impl Into<Color>, surface_scale: f32, ks: f32, shininess: f32, ) -> Option<RCHandle<SkImageFilter>>

pub fn spot_lit_specular_lighting<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, location: impl Into<Point3>, target: impl Into<Point3>, specular_exponent: f32, cutoff_angle: f32, light_color: impl Into<Color>, surface_scale: f32, ks: f32, shininess: f32, ) -> Option<RCHandle<SkImageFilter>>

pub fn magnifier<'a>( self, lens_bounds: impl AsRef<Rect>, zoom_amount: f32, inset: f32, sampling_options: SamplingOptions, crop_rect: impl Into<Option<&'a IRect>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn matrix_convolution<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, kernel_size: impl Into<ISize>, kernel: &[f32], gain: f32, bias: f32, kernel_offset: impl Into<IPoint>, tile_mode: SkTileMode, convolve_alpha: bool, ) -> Option<RCHandle<SkImageFilter>>

pub fn merge<'a>( filters: impl IntoIterator<Item = Option<RCHandle<SkImageFilter>>>, crop_rect: impl Into<Option<&'a IRect>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn dilate<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, radii: (f32, f32), ) -> Option<RCHandle<SkImageFilter>>

pub fn erode<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, radii: (f32, f32), ) -> Option<RCHandle<SkImageFilter>>

pub fn offset<'a>( self, crop_rect: impl Into<Option<&'a IRect>>, delta: impl Into<Point>, ) -> Option<RCHandle<SkImageFilter>>

pub fn from_picture<'a>( picture: impl Into<RCHandle<SkPicture>>, crop_rect: impl Into<Option<&'a Rect>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn tile( self, src: impl AsRef<Rect>, dst: impl AsRef<Rect>, ) -> Option<RCHandle<SkImageFilter>>

§

impl RCHandle<SkPicture>

pub fn as_image_filter<'a>( &self, crop_rect: impl Into<Option<&'a Rect>>, ) -> Option<RCHandle<SkImageFilter>>

pub fn into_image_filter<'a>( self, crop_rect: impl Into<Option<&'a Rect>>, ) -> Option<RCHandle<SkImageFilter>>

§

impl RCHandle<SkColorFilter>

pub fn luma() -> RCHandle<SkColorFilter>

§

impl RCHandle<SkColorFilter>

pub fn overdraw(colors: &[Color; 6]) -> RCHandle<SkColorFilter>

§

impl RCHandle<SkRuntimeEffect>

pub fn make_for_color_filer<'a>( sksl: impl AsRef<str>, options: impl Into<Option<&'a Options>>, ) -> Result<RCHandle<SkRuntimeEffect>, String>

pub fn make_for_shader<'a>( sksl: impl AsRef<str>, options: impl Into<Option<&'a Options>>, ) -> Result<RCHandle<SkRuntimeEffect>, String>

pub fn make_for_blender<'a>( sksl: impl AsRef<str>, options: impl Into<Option<&'a Options>>, ) -> Result<RCHandle<SkRuntimeEffect>, String>

pub fn make_shader<'a>( &self, uniforms: impl Into<RCHandle<SkData>>, children: &[ChildPtr], local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>

pub fn make_color_filter<'a>( &self, inputs: impl Into<RCHandle<SkData>>, children: impl Into<Option<&'a [ChildPtr]>>, ) -> Option<RCHandle<SkColorFilter>>

pub fn make_blender<'a>( &self, uniforms: impl Into<RCHandle<SkData>>, children: impl Into<Option<&'a [ChildPtr]>>, ) -> Option<RCHandle<SkBlender>>

pub fn source(&self) -> &str

pub fn input_size(&self) -> usize

👎Deprecated since 0.35.0: Use uniform_size() instead

pub fn uniform_size(&self) -> usize

pub fn inputs(&self) -> &[Handle<SkRuntimeEffect_Uniform>]

👎Deprecated since 0.35.0: Use uniforms() instead

pub fn uniforms(&self) -> &[Handle<SkRuntimeEffect_Uniform>]

pub fn children(&self) -> &[Handle<SkRuntimeEffect_Child>]

pub fn find_input( &self, name: impl AsRef<str>, ) -> Option<&Handle<SkRuntimeEffect_Uniform>>

👎Deprecated since 0.35.0: Use find_uniform()

pub fn find_uniform( &self, name: impl AsRef<str>, ) -> Option<&Handle<SkRuntimeEffect_Uniform>>

pub fn find_child( &self, name: impl AsRef<str>, ) -> Option<&Handle<SkRuntimeEffect_Child>>

pub fn allow_shader(&self) -> bool

pub fn allow_color_filter(&self) -> bool

pub fn allow_blender(&self) -> bool

§

impl RCHandle<SkMaskFilter>

pub fn from_shader( shader: impl Into<RCHandle<SkShader>>, ) -> RCHandle<SkMaskFilter>

§

impl RCHandle<SkColorFilter>

pub fn from_table(table: &[u8; 256]) -> RCHandle<SkColorFilter>

👎Deprecated since 0.56.0: Use color_filters::table()

pub fn from_argb( table_a: Option<&[u8; 256]>, table_r: Option<&[u8; 256]>, table_g: Option<&[u8; 256]>, table_b: Option<&[u8; 256]>, ) -> RCHandle<SkColorFilter>

👎Deprecated since 0.56.0: Use color_filters::table_argb()
§

impl RCHandle<SkPathEffect>

pub fn trim( start_t: f32, stop_t: f32, mode: impl Into<Option<SkTrimPathEffect_Mode>>, ) -> Option<RCHandle<SkPathEffect>>

§

impl RCHandle<SkImage>

pub fn encode<'a>( &self, context: impl Into<Option<&'a mut RCHandle<GrDirectContext>>>, format: SkEncodedImageFormat, quality: impl Into<Option<u32>>, ) -> Option<RCHandle<SkData>>

§

impl RCHandle<GrDirectContext>

pub fn new_gl<'a>( interface: impl Into<RCHandle<GrGLInterface>>, options: impl Into<Option<&'a ContextOptions>>, ) -> Option<RCHandle<GrDirectContext>>

👎Deprecated since 0.74.0: use gpu::direct_contexts::make_gl()

pub fn reset( &mut self, backend_state: Option<u32>, ) -> &mut RCHandle<GrDirectContext>

pub fn reset_gl_texture_bindings(&mut self) -> &mut RCHandle<GrDirectContext>

pub fn abandon(&mut self) -> &mut RCHandle<GrDirectContext>

pub fn is_device_lost(&mut self) -> bool

pub fn oomed(&mut self) -> bool

pub fn release_resources_and_abandon( &mut self, ) -> &mut RCHandle<GrDirectContext>

pub fn resource_cache_limit(&self) -> usize

pub fn resource_cache_usage(&self) -> ResourceCacheUsage

pub fn resource_cache_purgeable_bytes(&self) -> usize

pub fn set_resource_cache_limits(&mut self, limits: ResourceCacheLimits)

pub fn set_resource_cache_limit(&mut self, max_resource_bytes: usize)

pub fn free_gpu_resources(&mut self) -> &mut RCHandle<GrDirectContext>

pub fn perform_deferred_cleanup( &mut self, not_used: Duration, opts: impl Into<Option<GrPurgeResourceOptions>>, ) -> &mut RCHandle<GrDirectContext>

pub fn purge_unlocked_resource_bytes( &mut self, bytes_to_purge: usize, prefer_scratch_resources: bool, ) -> &mut RCHandle<GrDirectContext>

pub fn purge_unlocked_resources( &mut self, opts: GrPurgeResourceOptions, ) -> &mut RCHandle<GrDirectContext>

pub fn flush_and_submit(&mut self) -> &mut RCHandle<GrDirectContext>

pub fn flush_submit_and_sync_cpu(&mut self) -> &mut RCHandle<GrDirectContext>

pub fn flush_with_info(&mut self, info: &FlushInfo) -> GrSemaphoresSubmitted

👎Deprecated since 0.37.0: Use flush()

pub fn flush<'a>( &mut self, info: impl Into<Option<&'a FlushInfo>>, ) -> GrSemaphoresSubmitted

pub fn flush_image_with_info( &mut self, image: &RCHandle<SkImage>, info: &FlushInfo, ) -> GrSemaphoresSubmitted

pub fn flush_image(&mut self, image: &RCHandle<SkImage>)

pub fn flush_and_submit_image(&mut self, image: &RCHandle<SkImage>)

pub fn flush_surface_with_access( &mut self, surface: &mut RCHandle<SkSurface>, access: SkSurfaces_BackendSurfaceAccess, info: &FlushInfo, ) -> GrSemaphoresSubmitted

pub fn flush_surface_with_texture_state( &mut self, surface: &mut RCHandle<SkSurface>, info: &FlushInfo, new_state: Option<&RCHandle<skgpu_MutableTextureState>>, ) -> GrSemaphoresSubmitted

pub fn flush_and_submit_surface( &mut self, surface: &mut RCHandle<SkSurface>, sync_cpu: impl Into<Option<GrSyncCpu>>, )

pub fn flush_surface(&mut self, surface: &mut RCHandle<SkSurface>)

pub fn submit(&mut self, sync_cpu: impl Into<Option<GrSyncCpu>>) -> bool

pub fn check_async_work_completion(&mut self)

pub fn supports_distance_field_text(&self) -> bool

pub fn compressed_backend_format( &self, compression: SkTextureCompressionType, ) -> Handle<GrBackendFormat>

pub fn set_backend_texture_state( &mut self, backend_texture: &RefHandle<GrBackendTexture>, state: &RCHandle<skgpu_MutableTextureState>, ) -> bool

pub fn set_backend_texture_state_and_return_previous( &mut self, backend_texture: &RefHandle<GrBackendTexture>, state: &RCHandle<skgpu_MutableTextureState>, ) -> Option<RCHandle<skgpu_MutableTextureState>>

pub fn set_backend_render_target_state( &mut self, target: &Handle<GrBackendRenderTarget>, state: &RCHandle<skgpu_MutableTextureState>, ) -> bool

pub fn set_backend_render_target_state_and_return_previous( &mut self, target: &Handle<GrBackendRenderTarget>, state: &RCHandle<skgpu_MutableTextureState>, ) -> Option<RCHandle<skgpu_MutableTextureState>>

pub fn delete_backend_texture(&mut self, texture: &RefHandle<GrBackendTexture>)

pub fn precompile_shader( &mut self, key: &RCHandle<SkData>, data: &RCHandle<SkData>, ) -> bool

pub fn id(&self) -> DirectContextId

§

impl RCHandle<GrGLInterface>

pub fn new_native() -> Option<RCHandle<GrGLInterface>>

pub fn new_load_with<F>(load_fn: F) -> Option<RCHandle<GrGLInterface>>
where F: FnMut(&str) -> *const c_void,

pub fn new_load_with_cstr<F>(load_fn: F) -> Option<RCHandle<GrGLInterface>>
where F: FnMut(&CStr) -> *const c_void,

pub fn validate(&self) -> bool

pub fn extensions(&self) -> &Handle<GrGLExtensions>

pub fn extensions_mut(&mut self) -> &mut Handle<GrGLExtensions>

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

§

impl RCHandle<skgpu_MutableTextureState>

pub fn copied(&self) -> RCHandle<skgpu_MutableTextureState>

pub fn backend(&self) -> skgpu_BackendApi

§

impl RCHandle<GrRecordingContext>

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

pub fn backend(&self) -> GrBackendApi

pub fn default_backend_format( &self, ct: ColorType, renderable: skgpu_Renderable, ) -> Handle<GrBackendFormat>

pub fn compressed_backend_format( &self, compression_type: SkTextureCompressionType, ) -> Handle<GrBackendFormat>

pub fn abandoned(&mut self) -> bool

pub fn color_type_supported_as_surface(&self, color_type: ColorType) -> bool

pub fn max_texture_size(&self) -> i32

pub fn max_render_target_size(&self) -> i32

pub fn color_type_supported_as_image(&self, color_type: ColorType) -> bool

pub fn supports_protected_content(&self) -> bool

pub fn max_surface_sample_count_for_color_type( &self, color_type: ColorType, ) -> usize

§

impl RCHandle<skia_textlayout_FontCollection>

pub fn new() -> RCHandle<skia_textlayout_FontCollection>

pub fn font_managers_count(&self) -> usize

pub fn set_asset_font_manager( &mut self, font_manager: impl Into<Option<RCHandle<SkFontMgr>>>, )

pub fn set_dynamic_font_manager( &mut self, font_manager: impl Into<Option<RCHandle<SkFontMgr>>>, )

pub fn set_test_font_manager( &mut self, font_manager: impl Into<Option<RCHandle<SkFontMgr>>>, )

pub fn set_default_font_manager<'a>( &mut self, font_manager: impl Into<Option<RCHandle<SkFontMgr>>>, default_family_name: impl Into<Option<&'a str>>, )

pub fn set_default_font_manager_and_family_names( &mut self, font_manager: impl Into<Option<RCHandle<SkFontMgr>>>, family_names: &[impl AsRef<str>], )

pub fn fallback_manager(&self) -> Option<RCHandle<SkFontMgr>>

pub fn find_typefaces( &mut self, family_names: &[impl AsRef<str>], font_style: FontStyle, ) -> Vec<RCHandle<SkTypeface>>

pub fn find_typefaces_with_font_arguments<'fa>( &mut self, family_names: &[impl AsRef<str>], font_style: FontStyle, font_args: impl Into<Option<&'fa Handle<skia_textlayout_FontArguments>>>, ) -> Vec<RCHandle<SkTypeface>>

pub fn default_fallback_char( &mut self, unicode: i32, font_style: FontStyle, locale: impl AsRef<str>, ) -> Option<RCHandle<SkTypeface>>

pub fn default_fallback(&mut self) -> Option<RCHandle<SkTypeface>>

pub fn default_emoji_fallback( &mut self, emoji_start: i32, font_style: FontStyle, locale: impl AsRef<str>, ) -> Option<RCHandle<SkTypeface>>

pub fn disable_font_fallback(&mut self)

pub fn enable_font_fallback(&mut self)

pub fn font_fallback_enabled(&self) -> bool

pub fn paragraph_cache(&self) -> &Handle<skia_textlayout_ParagraphCache>

pub fn paragraph_cache_mut( &mut self, ) -> &mut Handle<skia_textlayout_ParagraphCache>

pub fn clear_caches(&mut self)

§

impl RCHandle<skia_textlayout_TypefaceFontStyleSet>

pub fn new( family_name: impl AsRef<str>, ) -> RCHandle<skia_textlayout_TypefaceFontStyleSet>

pub fn family_name(&self) -> &str

pub fn alias(&self) -> &str

pub fn append_typeface( &mut self, typeface: RCHandle<SkTypeface>, ) -> &mut RCHandle<skia_textlayout_TypefaceFontStyleSet>

§

impl RCHandle<skia_textlayout_TypefaceFontProvider>

pub fn new() -> RCHandle<skia_textlayout_TypefaceFontProvider>

pub fn register_typeface<'a>( &mut self, typeface: RCHandle<SkTypeface>, alias: impl Into<Option<&'a str>>, ) -> usize

§

impl RCHandle<SkSVGDOM>

pub fn read<R>( reader: R, font_mgr: impl Into<RCHandle<SkFontMgr>>, ) -> Result<RCHandle<SkSVGDOM>, LoadError>
where R: Read,

pub fn from_str( svg: impl AsRef<str>, font_mgr: impl Into<RCHandle<SkFontMgr>>, ) -> Result<RCHandle<SkSVGDOM>, LoadError>

pub fn from_bytes( svg: &[u8], font_mgr: impl Into<RCHandle<SkFontMgr>>, ) -> Result<RCHandle<SkSVGDOM>, LoadError>

pub fn render(&self, canvas: &Canvas)

pub fn set_container_size(&mut self, size: impl Into<Size>)

§

impl RCHandle<SkOrderedFontMgr>

pub fn new() -> RCHandle<SkOrderedFontMgr>

pub fn append(&mut self, font_mgr: impl Into<RCHandle<SkFontMgr>>)

Trait Implementations§

§

impl<N> AsRef<RCHandle<N>> for RCHandle<N>
where N: NativeRefCounted,

§

fn as_ref(&self) -> &RCHandle<N>

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<N> Clone for RCHandle<N>
where N: NativeRefCounted,

§

fn clone(&self) -> RCHandle<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<H> ConditionallySend for RCHandle<H>
where H: NativeRefCountedBase,

RCHandle<H> is conditionally Send and can be sent to another thread when its reference count is 1.

§

fn can_send(&self) -> bool

Returns true if the handle can be sent to another thread.
§

fn wrap_send(self) -> Result<Sendable<RCHandle<H>>, RCHandle<H>>

Wrap the handle in a type that can be sent to another thread and unwrapped there. Read more
§

impl Debug for RCHandle<GrDirectContext>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<GrGLInterface>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<GrRecordingContext>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkBlender>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkColorFilter>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkColorSpace>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkColorTable>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkContourMeasure>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkData>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkDataTable>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkDrawable>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkFontMgr>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkFontStyleSet>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkImage>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkImageFilter>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkMaskFilter>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkOrderedFontMgr>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkPathEffect>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkPicture>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkPixelRef>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkRuntimeEffect>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkSVGDOM>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkShader>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkSurface>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkTextBlob>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkTypeface>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<SkVertices>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<skgpu_MutableTextureState>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<skia_textlayout_FontCollection>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<skia_textlayout_TypefaceFontProvider>

§

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

Formats the value using the given formatter. Read more
§

impl Debug for RCHandle<skia_textlayout_TypefaceFontStyleSet>

§

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

Formats the value using the given formatter. Read more
§

impl Default for RCHandle<SkFontMgr>

§

fn default() -> RCHandle<SkFontMgr>

Returns the “default value” for a type. Read more
§

impl Default for RCHandle<SkFontStyleSet>

§

fn default() -> RCHandle<SkFontStyleSet>

Returns the “default value” for a type. Read more
§

impl Default for RCHandle<SkOrderedFontMgr>

§

fn default() -> RCHandle<SkOrderedFontMgr>

Returns the “default value” for a type. Read more
§

impl Default for RCHandle<SkShader>

§

fn default() -> RCHandle<SkShader>

Returns the “default value” for a type. Read more
§

impl Default for RCHandle<skgpu_MutableTextureState>

§

fn default() -> RCHandle<skgpu_MutableTextureState>

Returns the “default value” for a type. Read more
§

impl Default for RCHandle<skia_textlayout_TypefaceFontProvider>

§

fn default() -> RCHandle<skia_textlayout_TypefaceFontProvider>

Returns the “default value” for a type. Read more
§

impl Deref for RCHandle<GrDirectContext>

§

type Target = RCHandle<GrRecordingContext>

The resulting type after dereferencing.
§

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

Dereferences the value.
§

impl Deref for RCHandle<SkData>

§

type Target = [u8]

The resulting type after dereferencing.
§

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

Dereferences the value.
§

impl Deref for RCHandle<SkOrderedFontMgr>

§

type Target = RCHandle<SkFontMgr>

The resulting type after dereferencing.
§

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

Dereferences the value.
§

impl Deref for RCHandle<skia_textlayout_TypefaceFontProvider>

§

type Target = RCHandle<SkFontMgr>

The resulting type after dereferencing.
§

fn deref( &self, ) -> &<RCHandle<skia_textlayout_TypefaceFontProvider> as Deref>::Target

Dereferences the value.
§

impl Deref for RCHandle<skia_textlayout_TypefaceFontStyleSet>

§

type Target = RCHandle<SkFontStyleSet>

The resulting type after dereferencing.
§

fn deref( &self, ) -> &<RCHandle<skia_textlayout_TypefaceFontStyleSet> as Deref>::Target

Dereferences the value.
§

impl DerefMut for RCHandle<GrDirectContext>

§

fn deref_mut(&mut self) -> &mut <RCHandle<GrDirectContext> as Deref>::Target

Mutably dereferences the value.
§

impl DerefMut for RCHandle<SkOrderedFontMgr>

§

fn deref_mut(&mut self) -> &mut <RCHandle<SkOrderedFontMgr> as Deref>::Target

Mutably dereferences the value.
§

impl DerefMut for RCHandle<skia_textlayout_TypefaceFontProvider>

§

fn deref_mut( &mut self, ) -> &mut <RCHandle<skia_textlayout_TypefaceFontProvider> as Deref>::Target

Mutably dereferences the value.
§

impl DerefMut for RCHandle<skia_textlayout_TypefaceFontStyleSet>

§

fn deref_mut( &mut self, ) -> &mut <RCHandle<skia_textlayout_TypefaceFontStyleSet> as Deref>::Target

Mutably dereferences the value.
§

impl<N> Drop for RCHandle<N>
where N: NativeRefCounted,

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<N> Flattenable for RCHandle<N>
where N: NativeFlattenable + NativeRefCountedBase,

§

fn type_name(&self) -> &CStr

§

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

§

fn deserialize(data: &[u8]) -> Option<RCHandle<N>>

§

impl<N> From<&RCHandle<N>> for RCHandle<N>
where N: NativeRefCounted,

A reference counted handle is cheap to clone, so we do support a conversion from a reference to a ref counter to an owned handle.

§

fn from(rch: &RCHandle<N>) -> RCHandle<N>

Converts to this type from the input type.
§

impl From<SkBlendMode> for RCHandle<SkBlender>

§

fn from(mode: SkBlendMode) -> RCHandle<SkBlender>

Converts to this type from the input type.
§

impl From<RCHandle<GrDirectContext>> for RCHandle<GrRecordingContext>

§

fn from( direct_context: RCHandle<GrDirectContext>, ) -> RCHandle<GrRecordingContext>

Converts to this type from the input type.
§

impl From<RCHandle<SkBlender>> for ChildPtr

§

fn from(blender: RCHandle<SkBlender>) -> ChildPtr

Converts to this type from the input type.
§

impl From<RCHandle<SkColorFilter>> for ChildPtr

§

fn from(color_filter: RCHandle<SkColorFilter>) -> ChildPtr

Converts to this type from the input type.
§

impl From<RCHandle<SkOrderedFontMgr>> for RCHandle<SkFontMgr>

§

fn from(font_mgr: RCHandle<SkOrderedFontMgr>) -> RCHandle<SkFontMgr>

Converts to this type from the input type.
§

impl From<RCHandle<SkShader>> for ChildPtr

§

fn from(shader: RCHandle<SkShader>) -> ChildPtr

Converts to this type from the input type.
§

impl From<RCHandle<skia_textlayout_TypefaceFontProvider>> for RCHandle<SkFontMgr>

§

fn from( provider: RCHandle<skia_textlayout_TypefaceFontProvider>, ) -> RCHandle<SkFontMgr>

Converts to this type from the input type.
§

impl Index<usize> for RCHandle<SkDataTable>

§

type Output = [u8]

The returned type after indexing.
§

fn index( &self, index: usize, ) -> &<RCHandle<SkDataTable> as Index<usize>>::Output

Performs the indexing (container[index]) operation. Read more
§

impl<N> PartialEq for RCHandle<N>
where N: NativeRefCounted + NativePartialEq,

§

fn eq(&self, rhs: &RCHandle<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq for RCHandle<SkData>

§

fn eq(&self, other: &RCHandle<SkData>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<N> PointerWrapper<N> for RCHandle<N>
where N: NativeRefCounted,

§

fn wrap(ptr: *mut N) -> Option<RCHandle<N>>

Wraps a native pointer into a wrapper type. Returns None if the pointer is null.
§

fn unwrap(self) -> *mut N

Unwraps the wrapper type into the native pointer.
§

fn inner(&self) -> &N

Access the wrapped pointer.
§

fn inner_mut(&mut self) -> &mut N

Access the wrapped pointer.
§

impl Send for RCHandle<SkBlender>

§

impl Send for RCHandle<SkColorFilter>

§

impl Send for RCHandle<SkColorSpace>

§

impl Send for RCHandle<SkColorTable>

§

impl Send for RCHandle<SkContourMeasure>

§

impl Send for RCHandle<SkData>

§

impl Send for RCHandle<SkDataTable>

§

impl Send for RCHandle<SkImage>

§

impl Send for RCHandle<SkImageFilter>

§

impl Send for RCHandle<SkMaskFilter>

§

impl Send for RCHandle<SkPathEffect>

§

impl Send for RCHandle<SkPicture>

§

impl Send for RCHandle<SkPixelRef>

§

impl Send for RCHandle<SkSVGDOM>

§

impl Send for RCHandle<SkShader>

§

impl Send for RCHandle<SkTextBlob>

§

impl Send for RCHandle<SkTypeface>

§

impl Send for RCHandle<SkVertices>

§

impl Send for RCHandle<skgpu_MutableTextureState>

§

impl Sync for RCHandle<SkBlender>

§

impl Sync for RCHandle<SkColorFilter>

§

impl Sync for RCHandle<SkColorSpace>

§

impl Sync for RCHandle<SkColorTable>

§

impl Sync for RCHandle<SkContourMeasure>

§

impl Sync for RCHandle<SkData>

§

impl Sync for RCHandle<SkDataTable>

§

impl Sync for RCHandle<SkImage>

§

impl Sync for RCHandle<SkImageFilter>

§

impl Sync for RCHandle<SkMaskFilter>

§

impl Sync for RCHandle<SkPathEffect>

§

impl Sync for RCHandle<SkPicture>

§

impl Sync for RCHandle<SkPixelRef>

§

impl Sync for RCHandle<SkSVGDOM>

§

impl Sync for RCHandle<SkShader>

§

impl Sync for RCHandle<SkTextBlob>

§

impl Sync for RCHandle<SkTypeface>

§

impl Sync for RCHandle<SkVertices>

§

impl Sync for RCHandle<skgpu_MutableTextureState>

Auto Trait Implementations§

§

impl<Native> Freeze for RCHandle<Native>

§

impl<Native> RefUnwindSafe for RCHandle<Native>
where Native: RefUnwindSafe,

§

impl<Native> !Send for RCHandle<Native>

§

impl<Native> !Sync for RCHandle<Native>

§

impl<Native> Unpin for RCHandle<Native>

§

impl<Native> UnwindSafe for RCHandle<Native>
where Native: RefUnwindSafe,

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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