skia_safe

Struct RefHandle

Source
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>

Source

pub fn draw(&mut self, info: &BackendDrawableInfo)

Source§

impl RefHandle<SkImageGenerator>

Source

pub fn unique_id(&self) -> u32

Source

pub fn encoded_data(&mut self) -> Option<Data>

Source

pub fn info(&self) -> &ImageInfo

Source

pub fn is_valid(&self, context: Option<&mut RecordingContext>) -> bool

Source

pub fn is_protected(self) -> bool

Source

pub fn get_pixels( &mut self, info: &ImageInfo, pixels: &mut [u8], row_bytes: usize, ) -> bool

Source

pub fn query_yuva_info( &self, supported_data_types: &SupportedDataTypes, ) -> Option<YUVAPixmapInfo>

Source

pub fn is_texture_generator(&self) -> bool

Source

pub fn from_encoded(_encoded: impl Into<Data>) -> Option<Self>

👎Deprecated since 0.64.0: Removed, will return None. Use Image::deferred_from_encoded_data() or Codec::from_data()
Source§

impl RefHandle<GrBackendTexture>

Source

pub unsafe fn new_gl( (width, height): (i32, i32), mipmapped: Mipmapped, gl_info: TextureInfo, ) -> Self

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

pub unsafe fn new_gl_with_label( (width, height): (i32, i32), mipmapped: Mipmapped, gl_info: TextureInfo, label: impl AsRef<str>, ) -> Self

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

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

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

pub unsafe fn new_vulkan_with_label( (width, height): (i32, i32), vk_info: &ImageInfo, label: impl AsRef<str>, ) -> Self

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

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

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

pub unsafe fn new_metal_with_label( (width, height): (i32, i32), mipmapped: Mipmapped, mtl_info: &TextureInfo, label: impl AsRef<str>, ) -> Self

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

pub fn dimensions(&self) -> ISize

Source

pub fn width(&self) -> i32

Source

pub fn height(&self) -> i32

Source

pub fn label(&self) -> &str

Source

pub fn mipmapped(&self) -> Mipmapped

Source

pub fn has_mip_maps(&self) -> bool

👎Deprecated since 0.35.0: Use has_mipmaps()
Source

pub fn has_mipmaps(&self) -> bool

Source

pub fn backend(&self) -> BackendAPI

Source

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

Source

pub fn gl_texture_parameters_modified(&mut self)

Source

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

Source

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

Source

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

Source

pub fn backend_format(&self) -> BackendFormat

Source

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

Source

pub fn is_protected(&self) -> bool

Source

pub fn is_valid(&self) -> bool

👎Deprecated since 0.37.0: Invalid BackendTextures aren’t supported
Source

pub fn is_same_texture(&mut self, texture: &BackendTexture) -> bool

Source§

impl RefHandle<skia_textlayout_Paragraph>

Source

pub fn max_width(&self) -> scalar

Source

pub fn height(&self) -> scalar

Source

pub fn min_intrinsic_width(&self) -> scalar

Source

pub fn max_intrinsic_width(&self) -> scalar

Source

pub fn alphabetic_baseline(&self) -> scalar

Source

pub fn ideographic_baseline(&self) -> scalar

Source

pub fn longest_line(&self) -> scalar

Source

pub fn did_exceed_max_lines(&self) -> bool

Source

pub fn layout(&mut self, width: scalar)

Source

pub fn paint(&self, canvas: &Canvas, p: impl Into<Point>)

Source

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

Source

pub fn get_rects_for_placeholders(&self) -> Vec<TextBox>

Source

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

Source

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

Source

pub fn get_line_metrics(&self) -> Vec<LineMetrics<'_>>

Source

pub fn line_number(&self) -> usize

Source

pub fn mark_dirty(&mut self)

Source

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)

Source

pub fn unresolved_codepoints(&mut self) -> Vec<Unichar>

Source

pub fn visit<'a, F>(&mut self, visitor: F)
where F: FnMut(usize, Option<&'a VisitorInfo>),

Source

pub fn extended_visit<'a, F>(&mut self, visitor: F)

Source

pub fn get_path_at(&mut self, line_number: usize) -> (usize, Path)

Returns path for a given line

  • line_number - a line number
  • dest - a resulting path

Returns: a number glyphs that could not be converted to path

Source

pub fn get_path(text_blob: &mut TextBlob) -> Path

Returns path for a text blob

  • text_blob - a text blob

Returns: a path

Source

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

Source

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

Source

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.

Source

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.

Source

pub fn get_line_metrics_at(&self, line_number: usize) -> Option<LineMetrics<'_>>

Returns line metrics info for the line

  • line_number - a line number
  • line_metrics - an address to return the info (in case of null just skipped)

Returns: true if the line is found; false if not

Source

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 number
  • include_spaces - indicates if the whitespaces should be included

Returns: the range of the text that is shown in the line

Source

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 index
  • glyph_info - a glyph cluster info filled if not null

Returns: true if glyph cluster was found; false if not

Source

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 coordinate
  • dy - y coordinate
  • glyph_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)

Source

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 paragraph
  • glyph_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

Source

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 coordinate
  • glyph_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)

Source

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

Source

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

Source

pub fn get_fonts(&self) -> Vec<FontInfo>

Returns the information about all the fonts used to shape the paragraph text

Returns: a list of fonts and text ranges

Source§

impl RefHandle<skia_textlayout_ParagraphBuilder>

Source

pub fn push_style(&mut self, style: &TextStyle) -> &mut Self

Source

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

Source

pub fn peek_style(&mut self) -> TextStyle

Source

pub fn add_text(&mut self, str: impl AsRef<str>) -> &mut Self

Source

pub fn add_placeholder( &mut self, placeholder_style: &PlaceholderStyle, ) -> &mut Self

Source

pub fn build(&mut self) -> Paragraph

Source

pub fn get_text(&mut self) -> &str

Source

pub fn get_paragraph_style(&self) -> ParagraphStyle

Source

pub fn reset(&mut self)

Source

pub fn new( style: &ParagraphStyle, font_collection: impl Into<FontCollection>, ) -> Self

Source§

impl RefHandle<skia_textlayout_ParagraphStyle>

Source

pub fn new() -> Self

Source

pub fn strut_style(&self) -> &StrutStyle

Source

pub fn set_strut_style(&mut self, strut_style: StrutStyle) -> &mut Self

Source

pub fn text_style(&self) -> &TextStyle

Source

pub fn set_text_style(&mut self, text_style: &TextStyle) -> &mut Self

Source

pub fn text_direction(&self) -> TextDirection

Source

pub fn set_text_direction(&mut self, direction: TextDirection) -> &mut Self

Source

pub fn text_align(&self) -> TextAlign

Source

pub fn set_text_align(&mut self, align: TextAlign) -> &mut Self

Source

pub fn max_lines(&self) -> Option<usize>

Source

pub fn set_max_lines(&mut self, lines: impl Into<Option<usize>>) -> &mut Self

Source

pub fn ellipsis(&self) -> &str

Source

pub fn set_ellipsis(&mut self, ellipsis: impl AsRef<str>) -> &mut Self

Source

pub fn height(&self) -> scalar

Source

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

Source

pub fn text_height_behavior(&self) -> TextHeightBehavior

Source

pub fn set_text_height_behavior(&mut self, v: TextHeightBehavior) -> &mut Self

Source

pub fn unlimited_lines(&self) -> bool

Source

pub fn ellipsized(&self) -> bool

Source

pub fn effective_align(&self) -> TextAlign

Source

pub fn hinting_is_on(&self) -> bool

Source

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

Source

pub fn replace_tab_characters(&self) -> bool

Source

pub fn set_replace_tab_characters(&mut self, value: bool) -> &mut Self

Source

pub fn apply_rounding_hack(&self) -> bool

Source

pub fn set_apply_rounding_hack(&mut self, value: bool) -> &mut Self

Source§

impl RefHandle<SkShaper>

Source

pub fn new_primitive() -> Self

👎Deprecated since 0.74.0: use shapers::primitive::primitive_text()
Source

pub fn new_shaper_driven_wrapper( fallback_font_mgr: impl Into<Option<FontMgr>>, ) -> Option<Self>

Source

pub fn new_shape_then_wrap( fallback_font_mgr: impl Into<Option<FontMgr>>, ) -> Option<Self>

Source

pub fn new_shape_dont_wrap_or_reorder( fallback_font_mgr: impl Into<Option<FontMgr>>, ) -> Option<Self>

👎Deprecated since 0.74.0: use shapers::hb::shape_dont_wrap_or_reorder()
Source

pub fn purge_harf_buzz_cache()

Source

pub fn new_core_text() -> Option<Self>

Source

pub fn new(font_mgr: impl Into<Option<FontMgr>>) -> Self

Source

pub fn purge_caches()

Source§

impl RefHandle<SkShaper_FontRunIterator>

Source

pub fn current_font(&self) -> &Font

Source§

impl RefHandle<SkShaper>

Source

pub fn new_font_mgr_run_iterator<'a>( utf8: &'a str, font: &Font, fallback: impl Into<Option<FontMgr>>, ) -> Borrows<'a, FontRunIterator>

Source

pub fn new_trivial_font_run_iterator( font: &Font, utf8_bytes: usize, ) -> FontRunIterator

Source§

impl RefHandle<SkShaper_BiDiRunIterator>

Source

pub fn current_level(&self) -> u8

Source§

impl RefHandle<SkShaper>

Source

pub fn new_bidi_run_iterator( utf8: &str, bidi_level: u8, ) -> Option<Borrows<'_, BiDiRunIterator>>

Source

pub fn new_icu_bidi_run_iterator( utf8: &str, level: u8, ) -> Option<Borrows<'_, BiDiRunIterator>>

Source

pub fn new_trivial_bidi_run_iterator( bidi_level: u8, utf8_bytes: usize, ) -> BiDiRunIterator

👎Deprecated since 0.74.0: use shapers::primitive::trivial_bidi_run_iterator()
Source§

impl RefHandle<SkShaper_ScriptRunIterator>

Source§

impl RefHandle<SkShaper>

Source

pub fn new_script_run_iterator( utf8: &str, script: FourByteTag, ) -> Borrows<'_, ScriptRunIterator>

Source

pub fn new_hb_icu_script_run_iterator( utf8: &str, ) -> Borrows<'_, ScriptRunIterator>

Source

pub fn new_trivial_script_run_iterator( bidi_level: u8, utf8_bytes: usize, ) -> ScriptRunIterator

👎Deprecated since 0.74.0: use shapers::primitive::trivial_script_run_iterator
Source§

impl RefHandle<SkShaper_LanguageRunIterator>

Source

pub fn current_language(&self) -> &CStr

Source§

impl RefHandle<SkShaper>

Source§

impl RefHandle<SkShaper>

Source

pub fn shape<'a, 'b: 'a>( &self, utf8: &str, font: &Font, left_to_right: bool, width: scalar, run_handler: &'b mut impl AsRunHandler<'a>, )

Source

pub fn shape_with_iterators<'a, 'b: 'a>( &self, utf8: &str, font_run_iterator: &mut FontRunIterator, bidi_run_iterator: &mut BiDiRunIterator, script_run_iterator: &mut ScriptRunIterator, language_run_iterator: &mut LanguageRunIterator, width: scalar, run_handler: &'b mut impl AsRunHandler<'a>, )

Source

pub fn shape_with_iterators_and_features<'a, 'b: 'a>( &self, utf8: &str, font_run_iterator: &mut FontRunIterator, bidi_run_iterator: &mut BiDiRunIterator, script_run_iterator: &mut ScriptRunIterator, language_run_iterator: &mut LanguageRunIterator, features: &[Feature], width: scalar, run_handler: &'b mut impl AsRunHandler<'a>, )

Source§

impl RefHandle<SkShaper>

Source

pub fn shape_text_blob( &self, text: &str, font: &Font, left_to_right: bool, width: scalar, offset: impl Into<Point>, ) -> Option<(TextBlob, Point)>

Source§

impl RefHandle<Sk3DView>

Source

pub fn new() -> Self

Source

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

Source

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

Source

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

Source

pub fn rotate_x(&mut self, deg: scalar) -> &mut Self

Source

pub fn rotate_y(&mut self, deg: scalar) -> &mut Self

Source

pub fn rotate_z(&mut self, deg: scalar) -> &mut Self

Source

pub fn matrix(&self) -> Matrix

Source

pub fn apply_to_canvas(&self, canvas: &Canvas) -> &Self

Source

pub fn dot_with_normal(&self, d: impl Into<V3>) -> scalar

Trait Implementations§

Source§

impl<N: NativeDrop> Drop for RefHandle<N>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<N: NativeDrop + NativePartialEq> PartialEq for RefHandle<N>

Source§

fn eq(&self, rhs: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

impl<N> PointerWrapper<N> for RefHandle<N>
where N: NativeDrop,

Source§

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

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

fn unwrap(self) -> *mut N

Unwraps the wrapper type into the native pointer.
Source§

fn inner(&self) -> &N

Access the wrapped pointer.
Source§

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

Access the wrapped pointer.
Source§

impl<T> RunIterator for RefHandle<T>
where T: NativeDrop + NativeBase<SkShaper_RunIterator>,

Auto Trait Implementations§

§

impl<N> Freeze for RefHandle<N>

§

impl<N> RefUnwindSafe for RefHandle<N>
where N: RefUnwindSafe,

§

impl<N> !Send for RefHandle<N>

§

impl<N> !Sync for RefHandle<N>

§

impl<N> Unpin for RefHandle<N>

§

impl<N> UnwindSafe for RefHandle<N>
where N: 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
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<I> IntoIterator for I
where I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.