pub struct RefHandle<N: NativeDrop>(/* private fields */);
Expand description
A wrapper type that represents a native type with a pointer to the native object.
Implementations§
Source§impl RefHandle<SkDrawable_GpuDrawHandler>
impl RefHandle<SkDrawable_GpuDrawHandler>
pub fn draw(&mut self, info: &BackendDrawableInfo)
Source§impl RefHandle<SkImageGenerator>
impl RefHandle<SkImageGenerator>
pub fn unique_id(&self) -> u32
pub fn encoded_data(&mut self) -> Option<Data>
pub fn info(&self) -> &ImageInfo
pub fn is_valid(&self, recorder: Option<&mut dyn Recorder>) -> bool
pub fn is_protected(self) -> bool
pub fn get_pixels( &mut self, info: &ImageInfo, pixels: &mut [u8], row_bytes: usize, ) -> bool
pub fn query_yuva_info( &self, supported_data_types: &SupportedDataTypes, ) -> Option<YUVAPixmapInfo>
pub fn is_texture_generator(&self) -> bool
pub fn from_encoded(_encoded: impl Into<Data>) -> Option<Self>
None
. Use Image::deferred_from_encoded_data() or Codec::from_data()Source§impl RefHandle<SkPathBuilder>
impl RefHandle<SkPathBuilder>
pub fn new() -> Self
pub fn new_path(path: &Path) -> Self
pub fn fill_type(&self) -> PathFillType
pub fn compute_bounds(&self) -> Rect
pub fn snapshot(&self) -> Path
pub fn detach(&mut self) -> Path
pub fn set_fill_type(&mut self, ft: PathFillType) -> &mut Self
pub fn set_is_volatile(&mut self, is_volatile: bool) -> &mut Self
pub fn reset(&mut self) -> &mut Self
pub fn move_to(&mut self, pt: impl Into<Point>) -> &mut Self
pub fn line_to(&mut self, pt: impl Into<Point>) -> &mut Self
pub fn quad_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, ) -> &mut Self
pub fn conic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, w: scalar, ) -> &mut Self
pub fn cubic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, ) -> &mut Self
pub fn close(&mut self) -> &mut Self
pub fn polyline_to(&mut self, points: &[Point]) -> &mut Self
pub fn r_move_to(&mut self, pt: impl Into<Point>) -> &mut Self
pub fn r_line_to(&mut self, pt: impl Into<Point>) -> &mut Self
pub fn r_quad_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, ) -> &mut Self
pub fn r_conic_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, w: scalar, ) -> &mut Self
pub fn r_cubic_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, pt3: impl Into<Point>, ) -> &mut Self
pub fn r_arc_to( &mut self, r: (scalar, scalar), x_axis_rotate: scalar, large_arc: ArcSize, sweep: PathDirection, d: impl Into<Vector>, ) -> &mut Self
pub fn arc_to( &mut self, oval: impl AsRef<Rect>, start_angle_deg: scalar, sweep_angle_deg: scalar, force_move_to: bool, ) -> &mut Self
pub fn arc_to_tangent( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, radius: scalar, ) -> &mut Self
pub fn arc_to_radius( &mut self, r: impl Into<Point>, x_axis_rotate: scalar, large_arc: ArcSize, sweep: PathDirection, xy: impl Into<Point>, ) -> &mut Self
pub fn add_arc( &mut self, oval: impl AsRef<Rect>, start_angle_deg: scalar, sweep_angle_deg: scalar, ) -> &mut Self
pub fn add_rect( &mut self, rect: impl AsRef<Rect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self
pub fn add_oval( &mut self, rect: impl AsRef<Rect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self
pub fn add_rrect( &mut self, rect: impl AsRef<RRect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self
pub fn add_circle( &mut self, center: impl Into<Point>, radius: scalar, dir: impl Into<Option<PathDirection>>, ) -> &mut Self
pub fn add_polygon(&mut self, pts: &[Point], close: bool) -> &mut Self
pub fn add_path(&mut self, path: &Path) -> &mut Self
pub fn add_path_with_transform( &mut self, src: &Path, matrix: &Matrix, mode: impl Into<Option<AddPathMode>>, )
pub fn inc_reserve(&mut self, extra_pt_count: usize, extra_verb_count: usize)
pub fn offset(&mut self, d: impl Into<Vector>) -> &mut Self
pub fn transform( &mut self, matrix: &Matrix, pc: impl Into<Option<ApplyPerspectiveClip>>, ) -> &mut Self
pub fn is_finite(&self) -> bool
pub fn toggle_inverse_fill_type(&mut self) -> &mut Self
pub fn is_empty(&self) -> bool
pub fn get_last_pt(&self) -> Option<Point>
pub fn set_last_pt(&mut self, p: impl Into<Point>)
pub fn count_points(&self) -> usize
pub fn is_inverse_fill_type(&self) -> bool
pub fn points(&self) -> &[Point]
pub fn verbs(&self) -> &[PathVerb] ⓘ
Source§impl RefHandle<GrBackendTexture>
impl RefHandle<GrBackendTexture>
pub unsafe fn new_gl( (width, height): (i32, i32), mipmapped: Mipmapped, gl_info: TextureInfo, ) -> Self
pub unsafe fn new_gl_with_label( (width, height): (i32, i32), mipmapped: Mipmapped, gl_info: TextureInfo, label: impl AsRef<str>, ) -> Self
pub unsafe fn new_vulkan( (width, height): (i32, i32), vk_info: &ImageInfo, ) -> Self
pub unsafe fn new_vulkan_with_label( (width, height): (i32, i32), vk_info: &ImageInfo, label: impl AsRef<str>, ) -> Self
pub unsafe fn new_metal( (width, height): (i32, i32), mipmapped: Mipmapped, mtl_info: &TextureInfo, ) -> Self
pub unsafe fn new_metal_with_label( (width, height): (i32, i32), mipmapped: Mipmapped, mtl_info: &TextureInfo, label: impl AsRef<str>, ) -> Self
pub fn dimensions(&self) -> ISize
pub fn width(&self) -> i32
pub fn height(&self) -> i32
pub fn label(&self) -> &str
pub fn mipmapped(&self) -> Mipmapped
pub fn has_mip_maps(&self) -> bool
pub fn has_mipmaps(&self) -> bool
pub fn backend(&self) -> BackendAPI
pub fn gl_texture_info(&self) -> Option<TextureInfo>
pub fn gl_texture_parameters_modified(&mut self)
pub fn vulkan_image_info(&self) -> Option<ImageInfo>
pub fn set_vulkan_image_layout(&mut self, layout: ImageLayout) -> &mut Self
pub fn metal_texture_info(&self) -> Option<TextureInfo>
pub fn backend_format(&self) -> BackendFormat
pub fn set_mutable_state(&mut self, state: &MutableTextureState)
pub fn is_protected(&self) -> bool
pub fn is_valid(&self) -> bool
pub fn is_same_texture(&mut self, texture: &BackendTexture) -> bool
Source§impl RefHandle<skia_textlayout_Paragraph>
impl RefHandle<skia_textlayout_Paragraph>
pub fn max_width(&self) -> scalar
pub fn height(&self) -> scalar
pub fn min_intrinsic_width(&self) -> scalar
pub fn max_intrinsic_width(&self) -> scalar
pub fn alphabetic_baseline(&self) -> scalar
pub fn ideographic_baseline(&self) -> scalar
pub fn longest_line(&self) -> scalar
pub fn did_exceed_max_lines(&self) -> bool
pub fn layout(&mut self, width: scalar)
pub fn paint(&self, canvas: &Canvas, p: impl Into<Point>)
Sourcepub fn get_rects_for_range(
&self,
range: Range<usize>,
rect_height_style: RectHeightStyle,
rect_width_style: RectWidthStyle,
) -> Vec<TextBox>
pub fn get_rects_for_range( &self, range: Range<usize>, rect_height_style: RectHeightStyle, rect_width_style: RectWidthStyle, ) -> Vec<TextBox>
Returns a vector of bounding boxes that enclose all text between start and end glyph indexes, including start and excluding end
pub fn get_rects_for_placeholders(&self) -> Vec<TextBox>
Sourcepub fn get_glyph_position_at_coordinate(
&self,
p: impl Into<Point>,
) -> PositionWithAffinity
pub fn get_glyph_position_at_coordinate( &self, p: impl Into<Point>, ) -> PositionWithAffinity
Returns the index of the glyph that corresponds to the provided coordinate, with the top left corner as the origin, and +y direction as down
Sourcepub fn get_word_boundary(&self, offset: u32) -> Range<usize> ⓘ
pub fn get_word_boundary(&self, offset: u32) -> Range<usize> ⓘ
Finds the first and last glyphs that define a word containing the glyph at index offset
pub fn get_line_metrics(&self) -> Vec<LineMetrics<'_>>
pub fn line_number(&self) -> usize
pub fn mark_dirty(&mut self)
Sourcepub fn unresolved_glyphs(&mut self) -> Option<usize>
pub fn unresolved_glyphs(&mut self) -> Option<usize>
This function will return the number of unresolved glyphs or
None
if not applicable (has not been shaped yet - valid case)
pub fn unresolved_codepoints(&mut self) -> Vec<Unichar> ⓘ
pub fn visit<'a, F>(&mut self, visitor: F)
pub fn extended_visit<'a, F>(&mut self, visitor: F)
Sourcepub fn get_path_at(&mut self, line_number: usize) -> (usize, Path)
pub fn get_path_at(&mut self, line_number: usize) -> (usize, Path)
Returns path for a given line
line_number
- a line numberdest
- a resulting path
Returns: a number glyphs that could not be converted to path
Sourcepub fn get_path(text_blob: &mut TextBlob) -> Path
pub fn get_path(text_blob: &mut TextBlob) -> Path
Returns path for a text blob
text_blob
- a text blob
Returns: a path
Sourcepub fn contains_emoji(&mut self, text_blob: &mut TextBlob) -> bool
pub fn contains_emoji(&mut self, text_blob: &mut TextBlob) -> bool
Checks if a given text blob contains glyph with emoji
text_blob
- a text blob
Returns: true
if there is such a glyph
Sourcepub fn contains_color_font_or_bitmap(
&mut self,
text_blob: &mut TextBlob,
) -> bool
pub fn contains_color_font_or_bitmap( &mut self, text_blob: &mut TextBlob, ) -> bool
Checks if a given text blob contains colored font or bitmap
text_blob
- a text blob
Returns: true
if there is such a glyph
Sourcepub fn get_line_number_at(&self, code_unit_index: TextIndex) -> Option<usize>
pub fn get_line_number_at(&self, code_unit_index: TextIndex) -> Option<usize>
Finds the line number of the line that contains the given UTF-8 index.
index
- a UTF-8 TextIndex into the paragraph
Returns: the line number the glyph that corresponds to the
given code_unit_index
is in, or -1 if the code_unit_index
is out of bounds, or when the glyph is truncated or
ellipsized away.
Sourcepub fn get_line_number_at_utf16_offset(
&self,
code_unit_index: TextIndex,
) -> Option<usize>
pub fn get_line_number_at_utf16_offset( &self, code_unit_index: TextIndex, ) -> Option<usize>
Finds the line number of the line that contains the given UTF-16 index.
index
- a UTF-16 offset into the paragraph
Returns: the line number the glyph that corresponds to the
given code_unit_index
is in, or -1 if the code_unit_index
is out of bounds, or when the glyph is truncated or
ellipsized away.
Sourcepub fn get_line_metrics_at(&self, line_number: usize) -> Option<LineMetrics<'_>>
pub fn get_line_metrics_at(&self, line_number: usize) -> Option<LineMetrics<'_>>
Returns line metrics info for the line
line_number
- a line numberline_metrics
- an address to return the info (in case of null just skipped)
Returns: true
if the line is found; false
if not
Sourcepub fn get_actual_text_range(
&self,
line_number: usize,
include_spaces: bool,
) -> TextRange
pub fn get_actual_text_range( &self, line_number: usize, include_spaces: bool, ) -> TextRange
Returns the visible text on the line (excluding a possible ellipsis)
line_number
- a line numberinclude_spaces
- indicates if the whitespaces should be included
Returns: the range of the text that is shown in the line
Sourcepub fn get_glyph_cluster_at(
&self,
code_unit_index: TextIndex,
) -> Option<GlyphClusterInfo>
pub fn get_glyph_cluster_at( &self, code_unit_index: TextIndex, ) -> Option<GlyphClusterInfo>
Finds a glyph cluster for text index
code_unit_index
- a text indexglyph_info
- a glyph cluster info filled if not null
Returns: true
if glyph cluster was found; false
if not
Sourcepub fn get_closest_glyph_cluster_at(
&self,
d: impl Into<Point>,
) -> Option<GlyphClusterInfo>
pub fn get_closest_glyph_cluster_at( &self, d: impl Into<Point>, ) -> Option<GlyphClusterInfo>
Finds the closest glyph cluster for a visual text position
dx
- x coordinatedy
- y coordinateglyph_info
- a glyph cluster info filled if not null
Returns: true
if glyph cluster was found; false
if not
(which usually means the paragraph is empty)
Sourcepub fn get_glyph_info_at_utf16_offset(
&mut self,
code_unit_index: usize,
) -> Option<GlyphInfo>
pub fn get_glyph_info_at_utf16_offset( &mut self, code_unit_index: usize, ) -> Option<GlyphInfo>
Retrieves the information associated with the glyph located at the given
code_unit_index
.
code_unit_index
- a UTF-16 offset into the paragraphglyph_info
- an optional GlyphInfo struct to hold the information associated with the glyph found at the given index
Returns: false
only if the offset is out of bounds
Sourcepub fn get_closest_utf16_glyph_info_at(
&mut self,
d: impl Into<Point>,
) -> Option<GlyphInfo>
pub fn get_closest_utf16_glyph_info_at( &mut self, d: impl Into<Point>, ) -> Option<GlyphInfo>
Finds the information associated with the closest glyph to the given paragraph coordinates.
d
- x/y coordinateglyph_info
- an optional GlyphInfo struct to hold the information associated with the glyph found. The text indices and text ranges are described using UTF-16 offsets
Returns: true
if a grapheme cluster was found; false
if not
(which usually means the paragraph is empty)
Sourcepub fn get_font_at(&self, code_unit_index: TextIndex) -> Font
pub fn get_font_at(&self, code_unit_index: TextIndex) -> Font
Returns the font that is used to shape the text at the position
code_unit_index
- text index
Returns: font info or an empty font info if the text is not found
Sourcepub fn get_font_at_utf16_offset(&mut self, code_unit_index: usize) -> Font
pub fn get_font_at_utf16_offset(&mut self, code_unit_index: usize) -> Font
Returns the font used to shape the text at the given UTF-16 offset.
code_unit_index
- a UTF-16 offset in the paragraph
Returns: font info or an empty font info if the text is not found