Struct vizia_core::vg::Handle
pub struct Handle<N>(/* private fields */)
where
N: NativeDrop;
Expand description
Wraps a native type that can be represented in Rust memory.
This type requires an implementation of the NativeDrop
trait.
Implementations§
§impl Handle<SkCodecs_Decoder>
impl Handle<SkCodecs_Decoder>
pub fn id(&self) -> &'static str
pub fn is_format(&self, data: &[u8]) -> bool
pub fn from_stream<'a>( &self, stream: &'a mut impl Read, ) -> Result<Codec<'a>, SkCodec_Result>
§impl Handle<SkBitmap>
impl Handle<SkBitmap>
pub fn new() -> Handle<SkBitmap>
pub fn new() -> Handle<SkBitmap>
Creates an empty Bitmap
without pixels, with ColorType::Unknown
, AlphaType::Unknown
,
and with a width and height of zero. PixelRef
origin is set to (0, 0)
.
Use Self::set_info()
to associate ColorType
, AlphaType
, width, and height after
Bitmap
has been created.
pub fn info(&self) -> &Handle<SkImageInfo>
pub fn info(&self) -> &Handle<SkImageInfo>
Returns width, height, AlphaType
, ColorType, and ColorSpace
.
pub fn width(&self) -> i32
pub fn width(&self) -> i32
Returns pixel count in each row. Should be equal or less than row_bytes()
/
info().bytes_per_pixel()
.
May be less than pixel_ref().width()
. Will not exceed pixel_ref().width()
less
pixel_ref_origin().x
.
pub fn height(&self) -> i32
pub fn height(&self) -> i32
Returns pixel row count.
Maybe be less than pixel_ref().height()
. Will not exceed pixel_ref().height()
less
pixel_ref_origin().y
.
pub fn color_type(&self) -> ColorType
pub fn alpha_type(&self) -> SkAlphaType
pub fn color_space(&self) -> Option<RCHandle<SkColorSpace>>
pub fn color_space(&self) -> Option<RCHandle<SkColorSpace>>
Returns ColorSpace
, the range of colors, associated with ImageInfo
. The returned
ColorSpace
is immutable.
pub fn bytes_per_pixel(&self) -> usize
pub fn bytes_per_pixel(&self) -> usize
Returns number of bytes per pixel required by ColorType
.
Returns zero if color_type()
is ColorType::Unknown
.
pub fn row_bytes_as_pixels(&self) -> usize
pub fn row_bytes_as_pixels(&self) -> usize
Returns number of pixels that fit on row. Should be greater than or equal to width()
.
pub fn shift_per_pixel(&self) -> usize
pub fn shift_per_pixel(&self) -> usize
Returns bit shift converting row bytes to row pixels.
Returns zero for ColorType::Unknown
.
pub fn draws_nothing(&self) -> bool
pub fn draws_nothing(&self) -> bool
pub fn row_bytes(&self) -> usize
pub fn row_bytes(&self) -> usize
Returns row bytes, the interval from one pixel row to the next. Row bytes is at least as
large as: width()
* info().bytes_per_pixel()
.
Returns zero if color_type()
is ColorType::Unknown
, or if row bytes supplied to
set_info()
is not large enough to hold a row of pixels.
pub fn set_alpha_type(&mut self, alpha_type: SkAlphaType) -> bool
pub fn set_alpha_type(&mut self, alpha_type: SkAlphaType) -> bool
Sets AlphaType
, if alpha_type
is compatible with ColorType
. Returns true
unless
alpha_type
is AlphaType::Unknown
and current AlphaType
is not AlphaType::Unknown
.
Returns true
if ColorType
is ColorType::Unknown
. alpha_type
is ignored, and
AlphaType
remains AlphaType::Unknown
.
Returns true
if ColorType
is ColorType::RGB565
or ColorType::Gray8
.
alpha_type
is ignored, and AlphaType
remains AlphaType::Opaque
.
If ColorType
is ColorType::ARGB4444
, ColorType::RGBA8888
,
ColorType::BGRA8888
, or ColorType::RGBAF16
: returns true
unless alpha_type
is
AlphaType::Unknown
and AlphaType
is not AlphaType::Unknown
. If AlphaType
is
AlphaType::Unknown
, alpha_type
is ignored.
If ColorType
is ColorType::Alpha8
, returns true
unless alpha_type
is
AlphaType::Unknown
and AlphaType
is not AlphaType::Unknown
. If AlphaType
is
kUnknown_SkAlphaType, alpha_type
is ignored. If alpha_type
is AlphaType::Unpremul
,
it is treated as AlphaType::Premul
.
This changes AlphaType
in PixelRef
; all bitmaps sharing PixelRef
are affected.
pub fn set_color_space(
&mut self,
color_space: impl Into<Option<RCHandle<SkColorSpace>>>,
)
pub fn set_color_space( &mut self, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, )
Sets the ColorSpace
associated with this Bitmap
.
The raw pixel data is not altered by this call; no conversion is performed.
This changes ColorSpace
in PixelRef
; all bitmaps sharing PixelRef
are affected.
pub fn pixels(&mut self) -> *mut c_void
pub fn pixels(&mut self) -> *mut c_void
Returns pixel address, the base address corresponding to the pixel origin.
pub fn compute_byte_size(&self) -> usize
pub fn compute_byte_size(&self) -> usize
Returns minimum memory required for pixel storage.
Does not include unused memory on last row when row_bytes_as_pixels()
exceeds width()
.
Returns usize::MAX
if result does not fit in usize
.
Returns zero if height()
or width()
is 0.
Returns height()
times row_bytes()
if color_type()
is ColorType::Unknown
.
pub fn is_immutable(&self) -> bool
pub fn is_immutable(&self) -> bool
Returns true
if pixels can not change.
Most immutable Bitmap
checks trigger an assert only on debug builds.
pub fn set_immutable(&mut self)
pub fn set_immutable(&mut self)
pub fn reset(&mut self)
pub fn reset(&mut self)
Resets to its initial state; all fields are set to zero, as if Bitmap
had
been initialized by Bitmap::new()
.
Sets width, height, row bytes to zero; pixel address to None
; ColorType
to
ColorType::Unknown
; and AlphaType
to AlphaType::Unknown
.
If PixelRef
is allocated, its reference count is decreased by one, releasing its memory
if Bitmap
is the sole owner.
pub fn compute_is_opaque(bm: &Handle<SkBitmap>) -> bool
pub fn compute_is_opaque(bm: &Handle<SkBitmap>) -> bool
Returns true
if all pixels are opaque. ColorType
determines how pixels are encoded, and
whether pixel describes alpha. Returns true
for ColorType
without alpha in each pixel;
for other ColorType
, returns true
if all pixels have alpha values equivalent to 1.0 or
greater.
Returns false
for ColorType::Unknown
.
pub fn dimensions(&self) -> ISize
pub fn dimensions(&self) -> ISize
Returns ISize { width(), height() }
.
pub fn get_subset(&self) -> IRect
pub fn get_subset(&self) -> IRect
Returns the bounds of this bitmap, offset by its PixelRef
origin.
pub fn set_info(
&mut self,
image_info: &Handle<SkImageInfo>,
row_bytes: impl Into<Option<usize>>,
) -> bool
pub fn set_info( &mut self, image_info: &Handle<SkImageInfo>, row_bytes: impl Into<Option<usize>>, ) -> bool
Sets width, height, AlphaType
, ColorType, ColorSpace
, and optional row_bytes
.
Frees pixels, and returns true
if successful.
row_bytes
must equal or exceed image_info.min_row_bytes()
. If image_info.color_space()
is ColorType::Unknown
, row_bytes
is ignored and treated as zero; for all other
ColorSpace
values, row_bytes
of zero is treated as image_info.min_row_bytes()
.
Calls reset()
and returns false
if:
- rowBytes exceeds 31 bits
image_info.width()
is negativeimage_info.height()
is negativerow_bytes
is positive and less thanimage_info.width()
timesimage_info.bytes_per_pixel()
pub fn try_alloc_pixels_flags(
&mut self,
image_info: &Handle<SkImageInfo>,
) -> bool
pub fn try_alloc_pixels_flags( &mut self, image_info: &Handle<SkImageInfo>, ) -> bool
Sets ImageInfo
to info following the rules in set_info()
and allocates pixel memory.
Memory is zeroed.
Returns false
and calls reset()
if ImageInfo
could not be set, or memory could not
be allocated, or memory could not optionally be zeroed.
On most platforms, allocating pixel memory may succeed even though there is not sufficient
memory to hold pixels; allocation does not take place until the pixels are written to. The
actual behavior depends on the platform implementation of calloc()
.
pub fn alloc_pixels_flags(&mut self, image_info: &Handle<SkImageInfo>)
pub fn alloc_pixels_flags(&mut self, image_info: &Handle<SkImageInfo>)
Sets ImageInfo
to info following the rules in set_info()
and allocates pixel memory.
Memory is zeroed.
Returns false
and calls reset()
if ImageInfo
could not be set, or memory could not be
allocated, or memory could not optionally be zeroed.
On most platforms, allocating pixel memory may succeed even though there is not sufficient
memory to hold pixels; allocation does not take place until the pixels are written to. The
actual behavior depends on the platform implementation of calloc()
.
pub fn try_alloc_pixels_info(
&mut self,
image_info: &Handle<SkImageInfo>,
row_bytes: impl Into<Option<usize>>,
) -> bool
pub fn try_alloc_pixels_info( &mut self, image_info: &Handle<SkImageInfo>, row_bytes: impl Into<Option<usize>>, ) -> bool
Sets ImageInfo
to info following the rules in set_info()
and allocates pixel memory.
row_bytes
must equal or exceed info.width()
times info.bytes_per_pixel()
, or equal
None
. Pass in None
for row_bytes
to compute the minimum valid value.
Returns false
and calls reset()
if ImageInfo
could not be set, or memory could not be
allocated.
On most platforms, allocating pixel memory may succeed even though there is not sufficient
memory to hold pixels; allocation does not take place until the pixels are written to. The
actual behavior depends on the platform implementation of malloc()
.
pub fn alloc_pixels_info(
&mut self,
image_info: &Handle<SkImageInfo>,
row_bytes: impl Into<Option<usize>>,
)
pub fn alloc_pixels_info( &mut self, image_info: &Handle<SkImageInfo>, row_bytes: impl Into<Option<usize>>, )
Sets ImageInfo
to info following the rules in set_info()
and allocates pixel memory.
row_bytes
must equal or exceed info.width()
times info.bytes_per_pixel()
, or equal
None
. Pass in None
for row_bytes
to compute the minimum valid value.
Aborts execution if SkImageInfo could not be set, or memory could be allocated.
On most platforms, allocating pixel memory may succeed even though there is not sufficient
memory to hold pixels; allocation does not take place until the pixels are written to. The
actual behavior depends on the platform implementation of malloc()
.
pub fn try_alloc_n32_pixels(
&mut self,
_: (i32, i32),
is_opaque: impl Into<Option<bool>>,
) -> bool
pub fn try_alloc_n32_pixels( &mut self, _: (i32, i32), is_opaque: impl Into<Option<bool>>, ) -> bool
Sets ImageInfo
to width, height, and native color type; and allocates pixel memory. If
is_opaque
is true
, sets ImageInfo
to AlphaType::Opaque
; otherwise, sets to
AlphaType::Premul
.
Calls reset()
and returns false
if width exceeds 29 bits or is negative, or height is
negative.
Returns false
if allocation fails.
Use to create Bitmap
that matches crate::PMColor
, the native pixel arrangement on
the platform. Bitmap
drawn to output device skips converting its pixel format.
pub fn alloc_n32_pixels(
&mut self,
_: (i32, i32),
is_opaque: impl Into<Option<bool>>,
)
pub fn alloc_n32_pixels( &mut self, _: (i32, i32), is_opaque: impl Into<Option<bool>>, )
Sets ImageInfo
to width, height, and native color type; and allocates pixel memory. If
is_opaque
is true
, sets ImageInfo
to AlphaType::Opaque
; otherwise, sets to
AlphaType::Premul
.
Aborts if width exceeds 29 bits or is negative, or height is negative, or allocation fails.
Use to create Bitmap
that matches crate::PMColor
, the native pixel arrangement on
the platform. Bitmap
drawn to output device skips converting its pixel format.
pub unsafe fn install_pixels(
&mut self,
info: &Handle<SkImageInfo>,
pixels: *mut c_void,
row_bytes: usize,
) -> bool
pub unsafe fn install_pixels( &mut self, info: &Handle<SkImageInfo>, pixels: *mut c_void, row_bytes: usize, ) -> bool
Sets ImageInfo
to info following the rules in set_info()
, and creates PixelRef
containing pixels
and row_bytes
.
If ImageInfo
could not be set, or row_bytes
is less than info.min_row_bytes(): calls
reset(), and returns
false`.
Otherwise, if pixels equals ptr::null_mut()
: sets ImageInfo
, returns true
.
Caller must ensure that pixels are valid for the lifetime of Bitmap
and PixelRef
.
pub fn try_alloc_pixels(&mut self) -> bool
pub fn try_alloc_pixels(&mut self) -> bool
Allocates pixel memory with HeapAllocator, and replaces existing PixelRef
. The
allocation size is determined by ImageInfo
width, height, and ColorType
.
Returns false
if info().color_type()
is ColorType::Unknown
, or allocation fails.
pub fn alloc_pixels(&mut self)
pub fn alloc_pixels(&mut self)
Allocates pixel memory with HeapAllocator, and replaces existing PixelRef
. The
allocation size is determined by ImageInfo
width, height, and ColorType
.
Aborts if info().color_type()
is ColorType::Unknown
, or allocation fails.
pub fn pixel_ref_origin(&self) -> IPoint
pub fn pixel_ref_origin(&self) -> IPoint
Returns origin of pixels within PixelRef
. Bitmap
bounds is always contained
by PixelRef
bounds, which may be the same size or larger. Multiple Bitmap
can share the same PixelRef
, where each Bitmap
has different bounds.
The returned origin added to Bitmap
dimensions equals or is smaller than the
PixelRef
dimensions.
Returns (0, 0)
if PixelRef
is None
.
pub fn set_pixel_ref(
&mut self,
pixel_ref: impl Into<Option<RCHandle<SkPixelRef>>>,
offset: impl Into<IPoint>,
)
pub fn set_pixel_ref( &mut self, pixel_ref: impl Into<Option<RCHandle<SkPixelRef>>>, offset: impl Into<IPoint>, )
Replaces pixel_ref
and origin in Bitmap
. offset
specifies the offset within the
PixelRef
pixels for the top-left corner of the bitmap.
Asserts in debug builds if offset is out of range. Pins offset to legal range in release builds.
The caller is responsible for ensuring that the pixels match the ColorType
and
AlphaType
in ImageInfo
.
pub fn is_ready_to_draw(&self) -> bool
pub fn is_ready_to_draw(&self) -> bool
Returns true
if Bitmap
can be drawn.
pub fn generation_id(&self) -> u32
pub fn generation_id(&self) -> u32
pub fn notify_pixels_changed(&self)
pub fn notify_pixels_changed(&self)
Marks that pixels in PixelRef
have changed. Subsequent calls to generation_id()
return
a different value.
pub fn erase_color(&self, c: impl Into<Color>)
pub fn erase_color(&self, c: impl Into<Color>)
Replaces pixel values with c
, interpreted as being in the sRGB ColorSpace
. All pixels
contained by [bounds(&self)
] are affected. If the [color_type(&self)
] is
ColorType::Gray8
or ColorType::RGB565
, then alpha is ignored; RGB is treated as
opaque. If [color_type(&self)
] is ColorType::Alpha8
, then RGB is ignored.
Input color is ultimately converted to an Color4f
, so Self::erase_color_4f
will have
higher color resolution.
pub fn erase_color_4f(&self, c: impl AsRef<Color4f>)
pub fn erase_color_4f(&self, c: impl AsRef<Color4f>)
Replaces pixel values with c
, interpreted as being in the sRGB ColorSpace
. All pixels
contained by [bounds(&self)
] are affected. If the [color_type(&self)
] is
ColorType::Gray8
or ColorType::RGB565, then alpha is ignored; RGB is treated as
opaque. If [color_type(&self)
] is ColorType::Alpha8
, then RGB is ignored.
pub fn erase_argb(&self, a: u8, r: u8, g: u8, b: u8)
pub fn erase_argb(&self, a: u8, r: u8, g: u8, b: u8)
Replaces pixel values with unpremultiplied color built from a
, r
, g
, and b
,
interpreted as being in the sRGB ColorSpace
. All pixels contained by [bounds(&self)
]
are affected. If the [color_type(&self)
] is ColorType::Gray8
or ColorType::RGB565
,
then a
is ignored; r
, g
, and b
are treated as opaque. If [color_type(&self)
] is
ColorType::Alpha8
, then r
, g
, and b
are ignored.
pub fn erase(&self, c: impl Into<Color>, area: impl AsRef<IRect>)
pub fn erase(&self, c: impl Into<Color>, area: impl AsRef<IRect>)
Replaces pixel values inside area with c. interpreted as being in the sRGB ColorSpace
.
If area does not intersect bounds()
, call has no effect.
If the color_type()
is ColorType::Gray8
ColorType::RGB565
, then alpha is ignored;
RGB is treated as opaque. If color_type()
is ColorType::Alpha8
, then RGB is ignored.
Input color is ultimately converted to an Color4f
, so Self::erase_4f
will have
higher color resolution.
pub fn erase_4f(&self, c: impl AsRef<Color4f>, area: impl AsRef<IRect>)
pub fn erase_4f(&self, c: impl AsRef<Color4f>, area: impl AsRef<IRect>)
Replaces pixel values inside area with c. interpreted as being in the sRGB ColorSpace
.
If area does not intersect bounds()
, call has no effect.
If the color_type()
is ColorType::Gray8
ColorType::RGB565
, then alpha is ignored;
RGB is treated as opaque. If color_type()
is ColorType::Alpha8
, then RGB is ignored.
pub fn get_color(&self, p: impl Into<IPoint>) -> Color
pub fn get_color(&self, p: impl Into<IPoint>) -> Color
Returns pixel at (x, y)
as unpremultiplied color.
Returns black with alpha if ColorType
is ColorType::Alpha8
Input is not validated: out of bounds values of x
or y
trigger an assert()
.
Fails if ColorType
is ColorType::Unknown
or pixel address is nullptr
.
ColorSpace
in ImageInfo
is ignored. Some color precision may be lost in the
conversion to unpremultiplied color; original pixel data may have additional precision.
pub fn get_color_4f(&self, p: impl Into<IPoint>) -> Color4f
pub fn get_color_4f(&self, p: impl Into<IPoint>) -> Color4f
Returns pixel at (x, y)
as unpremultiplied color.
Returns black with alpha if ColorType is ColorType::Alpha8
Input is not validated: out of bounds values of x or y trigger an assert()
.
Fails if ColorType is ColorType::Unknown or pixel address is None
.
ColorSpace
in ImageInfo
is ignored. Some color precision may be lost in the
conversion to unpremultiplied color.
pub fn get_alpha_f(&self, p: impl Into<IPoint>) -> f32
pub fn get_alpha_f(&self, p: impl Into<IPoint>) -> f32
Look up the pixel at (x,y)
and return its alpha component, normalized to [0..1]
. This is
roughly equivalent to get_color().a()
, but can be more efficient (and more precise if the
pixels store more than 8 bits per component).
pub fn get_addr(&self, p: impl Into<IPoint>) -> *const c_void
pub fn get_addr(&self, p: impl Into<IPoint>) -> *const c_void
Returns pixel address at (x, y)
.
Input is not validated: out of bounds values of x
or y
, or ColorType::Unknown
,
trigger an assert()
. Returns nullptr
if ColorType
is ColorType::Unknown
, or
PixelRef
is nullptr
.
Performs a lookup of pixel size; for better performance, call one of: get_addr8()
,
get_addr16()
, or get_addr32()
.
pub fn extract_subset(
&self,
dst: &mut Handle<SkBitmap>,
subset: impl AsRef<IRect>,
) -> bool
pub fn extract_subset( &self, dst: &mut Handle<SkBitmap>, subset: impl AsRef<IRect>, ) -> bool
Shares PixelRef
with dst
. Pixels are not copied; Bitmap
and dst point to the same
pixels; dst Self::bounds()
are set to the intersection of subset and the original
Self::bounds()
.
Subset may be larger than Self::bounds()
. Any area outside of Self::bounds()
is
ignored.
Any contents of dst are discarded.
Return false
if:
- dst is
nullptr
PixelRef
isnullptr
- subset does not intersect
Self::bounds()
pub unsafe fn read_pixels(
&self,
dst_info: &Handle<SkImageInfo>,
dst_pixels: *mut c_void,
dst_row_bytes: usize,
src_x: i32,
src_y: i32,
) -> bool
pub unsafe fn read_pixels( &self, dst_info: &Handle<SkImageInfo>, dst_pixels: *mut c_void, dst_row_bytes: usize, src_x: i32, src_y: i32, ) -> bool
Copies a crate::Rect
of pixels from Bitmap
to dst_pixels
. Copy starts at (src_x, src_y)
, and does not exceed Bitmap
(width(), height())
.
dst_info
specifies width, height, ColorType, AlphaType
, and ColorSpace
of
destination.
dst_row_bytes
specifics the gap from one destination row to the next. Returns true
if
pixels are copied. Returns false
if:
dst_info
has no addressdst_row_bytes
is less thandst_info.min_row_bytes()
PixelRef
isnullptr
Pixels are copied only if pixel conversion is possible. If Self::color_type()
is
ColorType::Gray8
, or ColorType::Alpha8
; dst_info.color_type()
must match. If
Self::color_type()
is ColorType::Gray8
, dst_info.color_space()
must match. If
Self::alpha_type()
is AlphaType::Opaque
, dst_info.alpha_type()
must match. If
Self::color_space()
is nullptr
, dst_info.color_space()
must match. Returns false
if pixel conversion is not possible.
src_x
and src_y
may be negative to copy only top or left of source. Returns false
if
Self::width()
or Self::height()
is zero or negative. Returns false
if abs(src_x)
=
Self::width()
, or ifabs(src_y)
>=Self::height()
.
pub fn extract_alpha(
&self,
dst: &mut Handle<SkBitmap>,
paint: Option<&Handle<SkPaint>>,
) -> Option<IPoint>
pub fn extract_alpha( &self, dst: &mut Handle<SkBitmap>, paint: Option<&Handle<SkPaint>>, ) -> Option<IPoint>
Sets dst to alpha described by pixels. Returns false
if dst
cannot be written to or
dst
pixels cannot be allocated.
If paint
is not None
and contains crate::MaskFilter
, crate::MaskFilter
generates
mask alpha from Bitmap
. Uses HeapAllocator
to reserve memory for dst
PixelRef
.
Returns offset to top-left position for dst
for alignment with Bitmap
; (0, 0)
unless
crate::MaskFilter generates mask.
pub fn peek_pixels(&self) -> Option<Pixmap<'_>>
pub fn peek_pixels(&self) -> Option<Pixmap<'_>>
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>>
pub fn to_shader<'a>( &self, tile_modes: impl Into<Option<(SkTileMode, SkTileMode)>>, sampling: impl Into<SamplingOptions>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<RCHandle<SkShader>>
Make a shader with the specified tiling, matrix and sampling.
Defaults to clamp in both X and Y.
§impl Handle<SkContourMeasureIter>
impl Handle<SkContourMeasureIter>
pub fn new( path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> Handle<SkContourMeasureIter> ⓘ
pub fn from_path( path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> Handle<SkContourMeasureIter> ⓘ
pub fn reset( &mut self, path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> &mut Handle<SkContourMeasureIter> ⓘ
§impl Handle<SkFont>
impl Handle<SkFont>
pub fn new( typeface: impl Into<RCHandle<SkTypeface>>, size: impl Into<Option<f32>>, ) -> Handle<SkFont>
pub fn from_typeface( typeface: impl Into<RCHandle<SkTypeface>>, size: impl Into<Option<f32>>, ) -> Handle<SkFont>
pub fn from_typeface_with_params( typeface: impl Into<RCHandle<SkTypeface>>, size: f32, scale: f32, skew: f32, ) -> Handle<SkFont>
pub fn is_force_auto_hinting(&self) -> bool
pub fn is_embedded_bitmaps(&self) -> bool
pub fn is_subpixel(&self) -> bool
pub fn is_linear_metrics(&self) -> bool
pub fn is_embolden(&self) -> bool
pub fn is_baseline_snap(&self) -> bool
pub fn set_force_auto_hinting( &mut self, force_auto_hinting: bool, ) -> &mut Handle<SkFont>
pub fn set_embedded_bitmaps( &mut self, embedded_bitmaps: bool, ) -> &mut Handle<SkFont>
pub fn set_subpixel(&mut self, subpixel: bool) -> &mut Handle<SkFont>
pub fn set_linear_metrics( &mut self, linear_metrics: bool, ) -> &mut Handle<SkFont>
pub fn set_embolden(&mut self, embolden: bool) -> &mut Handle<SkFont>
pub fn set_baseline_snap(&mut self, baseline_snap: bool) -> &mut Handle<SkFont>
pub fn edging(&self) -> SkFont_Edging
pub fn set_edging(&mut self, edging: SkFont_Edging) -> &mut Handle<SkFont>
pub fn set_hinting(&mut self, hinting: SkFontHinting) -> &mut Handle<SkFont>
pub fn hinting(&self) -> SkFontHinting
pub fn with_size(&self, size: f32) -> Option<Handle<SkFont>>
pub fn typeface(&self) -> RCHandle<SkTypeface>
pub fn size(&self) -> f32
pub fn scale_x(&self) -> f32
pub fn skew_x(&self) -> f32
pub fn set_typeface( &mut self, tf: impl Into<RCHandle<SkTypeface>>, ) -> &mut Handle<SkFont>
pub fn set_size(&mut self, size: f32) -> &mut Handle<SkFont>
pub fn set_scale_x(&mut self, scale_x: f32) -> &mut Handle<SkFont>
pub fn set_skew_x(&mut self, skew_x: f32) -> &mut Handle<SkFont>
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 count_str(&self, str: impl AsRef<str>) -> usize
pub fn count_text(&self, text: impl EncodedText) -> usize
pub fn str_to_glyphs_vec(&self, str: impl AsRef<str>) -> Vec<u16>
pub fn text_to_glyphs_vec(&self, text: impl EncodedText) -> Vec<u16>
pub fn measure_str( &self, str: impl AsRef<str>, paint: Option<&Handle<SkPaint>>, ) -> (f32, Rect)
pub fn measure_text( &self, text: impl EncodedText, paint: Option<&Handle<SkPaint>>, ) -> (f32, Rect)
pub fn unichar_to_glyph(&self, uni: i32) -> u16
pub fn unichar_to_glyphs(&self, uni: &[i32], glyphs: &mut [u16])
pub fn get_widths(&self, glyphs: &[u16], widths: &mut [f32])
pub fn get_widths_bounds( &self, glyphs: &[u16], widths: Option<&mut [f32]>, bounds: Option<&mut [Rect]>, paint: Option<&Handle<SkPaint>>, )
pub fn get_bounds( &self, glyphs: &[u16], bounds: &mut [Rect], paint: Option<&Handle<SkPaint>>, )
pub fn get_pos(&self, glyphs: &[u16], pos: &mut [Point], origin: Option<Point>)
pub fn get_x_pos(&self, glyphs: &[u16], x_pos: &mut [f32], origin: Option<f32>)
pub fn get_intercepts<'a>( &self, glyphs: &[u16], pos: &[Point], _: (f32, f32), paint: impl Into<Option<&'a Handle<SkPaint>>>, ) -> Vec<f32>
pub fn get_path(&self, glyph_id: u16) -> Option<Handle<SkPath>>
pub fn metrics(&self) -> (f32, FontMetrics)
pub fn spacing(&self) -> f32
§impl Handle<SkColorInfo>
impl Handle<SkColorInfo>
pub fn new( ct: ColorType, at: SkAlphaType, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkColorInfo>
pub fn color_space(&self) -> Option<RCHandle<SkColorSpace>>
pub fn color_type(&self) -> ColorType
pub fn alpha_type(&self) -> SkAlphaType
pub fn is_opaque(&self) -> bool
pub fn is_gamma_close_to_srgb(&self) -> bool
pub fn with_alpha_type( &self, new_alpha_type: SkAlphaType, ) -> Handle<SkColorInfo>
pub fn with_color_type(&self, new_color_type: ColorType) -> Handle<SkColorInfo>
pub fn with_color_space( &self, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkColorInfo>
pub fn bytes_per_pixel(&self) -> usize
pub fn shift_per_pixel(&self) -> usize
§impl Handle<SkImageInfo>
impl Handle<SkImageInfo>
pub fn new( dimensions: impl Into<ISize>, ct: ColorType, at: SkAlphaType, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkImageInfo>
pub fn from_color_info( dimensions: impl Into<ISize>, color_info: Handle<SkColorInfo>, ) -> Handle<SkImageInfo>
pub fn new_n32( dimensions: impl Into<ISize>, at: SkAlphaType, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkImageInfo>
pub fn new_s32( dimensions: impl Into<ISize>, at: SkAlphaType, ) -> Handle<SkImageInfo>
pub fn new_n32_premul( dimensions: impl Into<ISize>, cs: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkImageInfo>
pub fn new_a8(dimensions: impl Into<ISize>) -> Handle<SkImageInfo>
pub fn new_unknown(dimensions: Option<ISize>) -> Handle<SkImageInfo>
pub fn width(&self) -> i32
pub fn height(&self) -> i32
pub fn color_type(&self) -> ColorType
pub fn alpha_type(&self) -> SkAlphaType
pub fn color_space(&self) -> Option<RCHandle<SkColorSpace>>
pub fn is_empty(&self) -> bool
pub fn color_info(&self) -> &Handle<SkColorInfo>
pub fn is_opaque(&self) -> bool
pub fn dimensions(&self) -> ISize
pub fn bounds(&self) -> IRect
pub fn is_gamma_close_to_srgb(&self) -> bool
pub fn with_dimensions( &self, new_dimensions: impl Into<ISize>, ) -> Handle<SkImageInfo>
pub fn with_alpha_type( &self, new_alpha_type: SkAlphaType, ) -> Handle<SkImageInfo>
pub fn with_color_type(&self, new_color_type: ColorType) -> Handle<SkImageInfo>
pub fn with_color_space( &self, new_color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Handle<SkImageInfo>
pub fn bytes_per_pixel(&self) -> usize
pub fn shift_per_pixel(&self) -> usize
pub fn min_row_bytes(&self) -> usize
pub fn compute_offset( &self, point: impl Into<IPoint>, row_bytes: usize, ) -> usize
pub fn compute_byte_size(&self, row_bytes: usize) -> usize
pub fn compute_min_byte_size(&self) -> usize
pub fn valid_row_bytes(&self, row_bytes: usize) -> bool
pub fn reset(&mut self) -> &mut Handle<SkImageInfo>
§impl Handle<SkPaint>
impl Handle<SkPaint>
pub fn new<'a>( color: impl AsRef<Color4f>, color_space: impl Into<Option<&'a RCHandle<SkColorSpace>>>, ) -> Handle<SkPaint>
pub fn reset(&mut self) -> &mut Handle<SkPaint>
pub fn is_anti_alias(&self) -> bool
pub fn set_anti_alias(&mut self, anti_alias: bool) -> &mut Handle<SkPaint>
pub fn is_dither(&self) -> bool
pub fn set_dither(&mut self, dither: bool) -> &mut Handle<SkPaint>
pub fn style(&self) -> SkPaint_Style
pub fn set_style(&mut self, style: SkPaint_Style) -> &mut Handle<SkPaint>
pub fn set_stroke(&mut self, stroke: bool) -> &mut Handle<SkPaint>
pub fn color(&self) -> Color
pub fn color4f(&self) -> Color4f
pub fn set_color(&mut self, color: impl Into<Color>) -> &mut Handle<SkPaint>
pub fn set_color4f<'a>( &mut self, color: impl AsRef<Color4f>, color_space: impl Into<Option<&'a RCHandle<SkColorSpace>>>, ) -> &mut Handle<SkPaint>
pub fn alpha_f(&self) -> f32
pub fn alpha(&self) -> u8
pub fn set_alpha_f(&mut self, alpha: f32) -> &mut Handle<SkPaint>
pub fn set_alpha(&mut self, alpha: u8) -> &mut Handle<SkPaint>
pub fn set_argb(&mut self, a: u8, r: u8, g: u8, b: u8) -> &mut Handle<SkPaint>
pub fn stroke_width(&self) -> f32
pub fn set_stroke_width(&mut self, width: f32) -> &mut Handle<SkPaint>
pub fn stroke_miter(&self) -> f32
pub fn set_stroke_miter(&mut self, miter: f32) -> &mut Handle<SkPaint>
pub fn stroke_cap(&self) -> SkPaint_Cap
pub fn set_stroke_cap(&mut self, cap: SkPaint_Cap) -> &mut Handle<SkPaint>
pub fn stroke_join(&self) -> SkPaint_Join
pub fn set_stroke_join(&mut self, join: SkPaint_Join) -> &mut Handle<SkPaint>
pub fn shader(&self) -> Option<RCHandle<SkShader>>
pub fn set_shader( &mut self, shader: impl Into<Option<RCHandle<SkShader>>>, ) -> &mut Handle<SkPaint>
pub fn color_filter(&self) -> Option<RCHandle<SkColorFilter>>
pub fn set_color_filter( &mut self, color_filter: impl Into<Option<RCHandle<SkColorFilter>>>, ) -> &mut Handle<SkPaint>
pub fn as_blend_mode(&self) -> Option<SkBlendMode>
pub fn blend_mode_or(&self, default_mode: SkBlendMode) -> SkBlendMode
pub fn blend_mode(&self) -> SkBlendMode
pub fn is_src_over(&self) -> bool
pub fn set_blend_mode(&mut self, mode: SkBlendMode) -> &mut Handle<SkPaint>
pub fn blender(&self) -> Option<RCHandle<SkBlender>>
pub fn set_blender( &mut self, blender: impl Into<Option<RCHandle<SkBlender>>>, ) -> &mut Handle<SkPaint>
pub fn path_effect(&self) -> Option<RCHandle<SkPathEffect>>
pub fn set_path_effect( &mut self, path_effect: impl Into<Option<RCHandle<SkPathEffect>>>, ) -> &mut Handle<SkPaint>
pub fn mask_filter(&self) -> Option<RCHandle<SkMaskFilter>>
pub fn set_mask_filter( &mut self, mask_filter: impl Into<Option<RCHandle<SkMaskFilter>>>, ) -> &mut Handle<SkPaint>
pub fn image_filter(&self) -> Option<RCHandle<SkImageFilter>>
pub fn set_image_filter( &mut self, image_filter: impl Into<Option<RCHandle<SkImageFilter>>>, ) -> &mut Handle<SkPaint>
pub fn nothing_to_draw(&self) -> bool
§impl Handle<SkPath>
impl Handle<SkPath>
Path
contain geometry. Path
may be empty, or contain one or more verbs that
outline a figure. Path
always starts with a move verb to a Cartesian coordinate,
and may be followed by additional verbs that add lines or curves.
Adding a close verb makes the geometry into a continuous loop, a closed contour.
Path
may contain any number of contours, each beginning with a move verb.
Path
contours may contain only a move verb, or may also contain lines,
quadratic beziers, conics, and cubic beziers. Path
contours may be open or
closed.
When used to draw a filled area, Path
describes whether the fill is inside or
outside the geometry. Path
also describes the winding rule used to fill
overlapping contours.
Internally, Path
lazily computes metrics likes bounds and convexity. Call
Path::update_bounds_cache
to make Path
thread safe.
pub fn new_from(
points: &[Point],
verbs: &[u8],
conic_weights: &[f32],
fill_type: SkPathFillType,
is_volatile: impl Into<Option<bool>>,
) -> Handle<SkPath>
pub fn new_from( points: &[Point], verbs: &[u8], conic_weights: &[f32], fill_type: SkPathFillType, is_volatile: impl Into<Option<bool>>, ) -> Handle<SkPath>
Create a new path with the specified segments.
The points and weights arrays are read in order, based on the sequence of verbs.
Move 1 point Line 1 point Quad 2 points Conic 2 points and 1 weight Cubic 3 points Close 0 points
If an illegal sequence of verbs is encountered, or the specified number of points or weights is not sufficient given the verbs, an empty Path is returned.
A legal sequence of verbs consists of any number of Contours. A contour always begins with a Move verb, followed by 0 or more segments: Line, Quad, Conic, Cubic, followed by an optional Close.
pub fn rect( rect: impl AsRef<Rect>, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>
pub fn oval( oval: impl AsRef<Rect>, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>
pub fn oval_with_start_index( oval: impl AsRef<Rect>, dir: SkPathDirection, start_index: usize, ) -> Handle<SkPath>
pub fn circle( center: impl Into<Point>, radius: f32, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>
pub fn rrect( rect: impl AsRef<RRect>, dir: impl Into<Option<SkPathDirection>>, ) -> Handle<SkPath>
pub fn rrect_with_start_index( rect: impl AsRef<RRect>, dir: SkPathDirection, start_index: usize, ) -> Handle<SkPath>
pub fn polygon( pts: &[Point], is_closed: bool, fill_type: impl Into<Option<SkPathFillType>>, is_volatile: impl Into<Option<bool>>, ) -> Handle<SkPath>
pub fn line(a: impl Into<Point>, b: impl Into<Point>) -> Handle<SkPath>
pub fn new() -> Handle<SkPath>
pub fn new() -> Handle<SkPath>
pub fn detach(&mut self) -> Handle<SkPath>
pub fn detach(&mut self) -> Handle<SkPath>
Returns a copy of this path in the current state, and resets the path to empty.
pub fn is_interpolatable(&self, compare: &Handle<SkPath>) -> bool
pub fn is_interpolatable(&self, compare: &Handle<SkPath>) -> bool
pub fn interpolate(
&self,
ending: &Handle<SkPath>,
weight: f32,
) -> Option<Handle<SkPath>>
pub fn interpolate( &self, ending: &Handle<SkPath>, weight: f32, ) -> Option<Handle<SkPath>>
Interpolates between Path
with Point
array of equal size.
Copy verb array and weights to out, and set out Point
array to a weighted
average of this Point
array and ending Point
array, using the formula:
(Path Point * weight) + ending Point * (1 - weight).
weight is most useful when between zero (ending Point
array) and
one (this Point_Array); will work with values outside of this
range.
interpolate()
returns false
and leaves out unchanged if Point
array is not
the same size as ending Point
array. Call is_interpolatable()
to check Path
compatibility prior to calling interpolate().
pub fn fill_type(&self) -> SkPathFillType
pub fn fill_type(&self) -> SkPathFillType
Returns PathFillType
, the rule used to fill Path
.
Returns: current PathFillType
setting
pub fn set_fill_type(&mut self, ft: SkPathFillType) -> &mut Handle<SkPath>
pub fn set_fill_type(&mut self, ft: SkPathFillType) -> &mut Handle<SkPath>
Sets FillType, the rule used to fill Path
. While there is no check
that ft is legal, values outside of FillType are not supported.
pub fn is_inverse_fill_type(&self) -> bool
pub fn is_inverse_fill_type(&self) -> bool
Returns if FillType describes area outside Path
geometry. The inverse fill area
extends indefinitely.
Returns: true
if FillType is InverseWinding
or InverseEvenOdd
pub fn toggle_inverse_fill_type(&mut self) -> &mut Handle<SkPath>
pub fn toggle_inverse_fill_type(&mut self) -> &mut Handle<SkPath>
Replaces FillType with its inverse. The inverse of FillType describes the area unmodified by the original FillType.
pub fn convexity_type(&self) -> !
pub fn convexity_type_or_unknown(&self) -> !
pub fn is_convex(&self) -> bool
pub fn is_convex(&self) -> bool
Returns true
if the path is convex. If necessary, it will first compute the convexity.
pub fn is_oval(&self) -> Option<Rect>
pub fn is_oval(&self) -> Option<Rect>
pub fn is_rrect(&self) -> Option<RRect>
pub fn is_rrect(&self) -> Option<RRect>
pub fn is_arc(&self) -> Option<Arc>
pub fn is_arc(&self) -> Option<Arc>
Returns true
if path is representable as an oval arc. In other words, could this
path be drawn using crate::Canvas::draw_arc
.
arc receives parameters of arc
arc
- storage for arc; may beNone
Returns:true
ifPath
contains only a single arc from an oval
pub fn reset(&mut self) -> &mut Handle<SkPath>
pub fn reset(&mut self) -> &mut Handle<SkPath>
pub fn rewind(&mut self) -> &mut Handle<SkPath>
pub fn rewind(&mut self) -> &mut Handle<SkPath>
Sets Path
to its initial state, preserving internal storage.
Removes verb array, Point
array, and weights, and sets FillType to Winding
.
Internal storage associated with Path
is retained.
Use rewind()
instead of reset()
if Path
storage will be reused and performance
is critical.
Returns: reference to Path
pub fn is_last_contour_closed(&self) -> bool
pub fn is_last_contour_closed(&self) -> bool
Returns if contour is closed.
Contour is closed if Path
Verb
array was last modified by close()
. When stroked,
closed contour draws crate::paint::Join
instead of crate::paint::Cap
at first and last Point
.
Returns: true
if the last contour ends with a Verb::Close
example: https://fiddle.skia.org/c/@Path_isLastContourClosed
pub fn is_volatile(&self) -> bool
pub fn is_volatile(&self) -> bool
Returns true
if the path is volatile; it will not be altered or discarded
by the caller after it is drawn. Path
by default have volatile set false
, allowing
crate::Surface
to attach a cache of data which speeds repeated drawing. If true
, crate::Surface
may not speed repeated drawing.
Returns: true
if caller will alter Path
after drawing
pub fn set_is_volatile(&mut self, is_volatile: bool) -> &mut Handle<SkPath>
pub fn set_is_volatile(&mut self, is_volatile: bool) -> &mut Handle<SkPath>
Specifies whether Path
is volatile; whether it will be altered or discarded
by the caller after it is drawn. Path
by default have volatile set false
, allowing
Device
to attach a cache of data which speeds repeated drawing.
Mark temporary paths, discarded or modified after use, as volatile
to inform Device
that the path need not be cached.
Mark animating Path
volatile to improve performance.
Mark unchanging Path
non-volatile to improve repeated rendering.
raster surface Path
draws are affected by volatile for some shadows.
GPU surface Path
draws are affected by volatile for some shadows and concave geometries.
pub fn is_line_degenerate(
p1: impl Into<Point>,
p2: impl Into<Point>,
exact: bool,
) -> bool
pub fn is_line_degenerate( p1: impl Into<Point>, p2: impl Into<Point>, exact: bool, ) -> bool
Tests if line between Point
pair is degenerate.
Line with no length or that moves a very short distance is degenerate; it is
treated as a point.
exact changes the equality test. If true
, returns true
only if p1 equals p2.
If false
, returns true
if p1 equals or nearly equals p2.
p1
- line start pointp2
- line end pointexact
- iffalse
, allow nearly equals Returns:true
if line is degenerate; its length is effectively zero
pub fn is_quad_degenerate(
p1: impl Into<Point>,
p2: impl Into<Point>,
p3: impl Into<Point>,
exact: bool,
) -> bool
pub fn is_quad_degenerate( p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, exact: bool, ) -> bool
Tests if quad is degenerate. Quad with no length or that moves a very short distance is degenerate; it is treated as a point.
p1
- quad start pointp2
- quad control pointp3
- quad end pointexact
- iftrue
, returnstrue
only if p1, p2, and p3 are equal; iffalse
, returnstrue
if p1, p2, and p3 are equal or nearly equal Returns:true
if quad is degenerate; its length is effectively zero
pub fn is_cubic_degenerate(
p1: impl Into<Point>,
p2: impl Into<Point>,
p3: impl Into<Point>,
p4: impl Into<Point>,
exact: bool,
) -> bool
pub fn is_cubic_degenerate( p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, p4: impl Into<Point>, exact: bool, ) -> bool
Tests if cubic is degenerate. Cubic with no length or that moves a very short distance is degenerate; it is treated as a point.
p1
- cubic start pointp2
- cubic control point 1p3
- cubic control point 2p4
- cubic end pointexact
- iftrue
, returnstrue
only if p1, p2, p3, and p4 are equal; iffalse
, returnstrue
if p1, p2, p3, and p4 are equal or nearly equal Returns:true
if cubic is degenerate; its length is effectively zero
pub fn is_line(&self) -> Option<(Point, Point)>
pub fn is_line(&self) -> Option<(Point, Point)>
Returns true
if Path
contains only one line;
Verb
array has two entries: Verb::Move
, Verb::Line
.
If Path
contains one line and line is not None
, line is set to
line start point and line end point.
Returns false
if Path
is not one line; line is unaltered.
line
- storage for line. May beNone
Returns:true
ifPath
contains exactly one line
pub fn count_points(&self) -> usize
pub fn count_points(&self) -> usize
pub fn get_point(&self, index: usize) -> Option<Point>
pub fn get_point(&self, index: usize) -> Option<Point>
pub fn get_points(&self, points: &mut [Point]) -> usize
pub fn get_points(&self, points: &mut [Point]) -> usize
Returns number of points in Path
. Up to max points are copied.
points may be None
; then, max must be zero.
If max is greater than number of points, excess points storage is unaltered.
pub fn count_verbs(&self) -> usize
pub fn count_verbs(&self) -> usize
Returns the number of verbs: Verb::Move
, Verb::Line
, Verb::Quad
, Verb::Conic
,
Verb::Cubic
, and Verb::Close
; added to Path
.
Returns: length of verb array
pub fn get_verbs(&self, verbs: &mut [u8]) -> usize
pub fn get_verbs(&self, verbs: &mut [u8]) -> usize
Returns the number of verbs in the path. Up to max verbs are copied. The verbs are copied as one byte per verb.
verbs
- storage for verbs, may beNone
max
- maximum number to copy into verbs Returns: the actual number of verbs in the path
pub fn approximate_bytes_used(&self) -> usize
pub fn approximate_bytes_used(&self) -> usize
Returns the approximate byte size of the Path
in memory.
Returns: approximate size
pub fn swap(&mut self, other: &mut Handle<SkPath>) -> &mut Handle<SkPath>
pub fn swap(&mut self, other: &mut Handle<SkPath>) -> &mut Handle<SkPath>
Exchanges the verb array, Point
array, weights, and FillType
with other.
Cached state is also exchanged. swap()
internally exchanges pointers, so
it is lightweight and does not allocate memory.
swap()
usage has largely been replaced by PartialEq.
Path
do not copy their content on assignment until they are written to,
making assignment as efficient as swap().
other
-Path
exchanged by value
example: https://fiddle.skia.org/c/@Path_swap
pub fn bounds(&self) -> &Rect
pub fn bounds(&self) -> &Rect
Returns minimum and maximum axes values of Point
array.
Returns (0, 0, 0, 0) if Path
contains no points. Returned bounds width and height may
be larger or smaller than area affected when Path
is drawn.
Rect
returned includes all Point
added to Path
, including Point
associated with
Verb::Move
that define empty contours.
pub fn update_bounds_cache(&mut self) -> &mut Handle<SkPath>
pub fn update_bounds_cache(&mut self) -> &mut Handle<SkPath>
Updates internal bounds so that subsequent calls to bounds()
are instantaneous.
Unaltered copies of Path
may also access cached bounds through bounds()
.
For now, identical to calling bounds()
and ignoring the returned value.
Call to prepare Path
subsequently drawn from multiple threads,
to avoid a race condition where each draw separately computes the bounds.
pub fn compute_tight_bounds(&self) -> Rect
pub fn compute_tight_bounds(&self) -> Rect
Returns minimum and maximum axes values of the lines and curves in Path
.
Returns (0, 0, 0, 0) if Path
contains no points.
Returned bounds width and height may be larger or smaller than area affected
when Path
is drawn.
Includes Point
associated with Verb::Move
that define empty
contours.
Behaves identically to bounds()
when Path
contains
only lines. If Path
contains curves, computed bounds includes
the maximum extent of the quad, conic, or cubic; is slower than bounds()
;
and unlike bounds()
, does not cache the result.
Returns: tight bounds of curves in Path
pub fn conservatively_contains_rect(&self, rect: impl AsRef<Rect>) -> bool
pub fn conservatively_contains_rect(&self, rect: impl AsRef<Rect>) -> bool
Returns true
if rect is contained by Path
.
May return false
when rect is contained by Path
.
For now, only returns true
if Path
has one contour and is convex.
rect may share points and edges with Path
and be contained.
Returns true
if rect is empty, that is, it has zero width or height; and
the Point
or line described by rect is contained by Path
.
example: https://fiddle.skia.org/c/@Path_conservativelyContainsRect
pub fn inc_reserve(&mut self, extra_pt_count: usize) -> &mut Handle<SkPath>
pub fn inc_reserve(&mut self, extra_pt_count: usize) -> &mut Handle<SkPath>
pub fn inc_reserve_with_verb_and_conic(
&mut self,
extra_pt_count: usize,
extra_verb_count: impl Into<Option<usize>>,
extract_conic_count: impl Into<Option<usize>>,
) -> &mut Handle<SkPath>
pub fn inc_reserve_with_verb_and_conic( &mut self, extra_pt_count: usize, extra_verb_count: impl Into<Option<usize>>, extract_conic_count: impl Into<Option<usize>>, ) -> &mut Handle<SkPath>
Grows Path
verb array and Point
array to contain extra_pt_count
additional Point
.
May improve performance and use less memory by
reducing the number and size of allocations when creating Path
.
extra_pt_count
- number of additionalPoint
to allocateextra_verb_count
- number of additional verbsextra_conic_count
- number of additional conics
pub fn shrink_to_fit(&mut self) -> !
pub fn move_to(&mut self, p: impl Into<Point>) -> &mut Handle<SkPath>
pub fn move_to(&mut self, p: impl Into<Point>) -> &mut Handle<SkPath>
pub fn r_move_to(&mut self, d: impl Into<Point>) -> &mut Handle<SkPath>
pub fn r_move_to(&mut self, d: impl Into<Point>) -> &mut Handle<SkPath>
Adds beginning of contour relative to last point.
If Path
is empty, starts contour at (dx, dy).
Otherwise, start contour at last point offset by (dx, dy).
Function name stands for “relative move to”.
dx
- offset from last point to contour start on x-axisdy
- offset from last point to contour start on y-axis Returns: reference toPath
pub fn line_to(&mut self, p: impl Into<Point>) -> &mut Handle<SkPath>
pub fn line_to(&mut self, p: impl Into<Point>) -> &mut Handle<SkPath>
Adds line from last point to (x, y). If Path
is empty, or last Verb
is
Verb::Close
, last point is set to (0, 0) before adding line.
line_to()
appends Verb::Move
to verb array and (0, 0) to Point
array, if needed.
line_to()
then appends Verb::Line
to verb array and (x, y) to Point
array.
x
- end of added line on x-axisy
- end of added line on y-axis Returns: reference toPath
pub fn r_line_to(&mut self, d: impl Into<Point>) -> &mut Handle<SkPath>
pub fn r_line_to(&mut self, d: impl Into<Point>) -> &mut Handle<SkPath>
Adds line from last point to vector (dx, dy). If Path
is empty, or last Verb
is
Verb::Close
, last point is set to (0, 0) before adding line.
Appends Verb::Move
to verb array and (0, 0) to Point
array, if needed;
then appends Verb::Line
to verb array and line end to Point
array.
Line end is last point plus vector (dx, dy).
Function name stands for “relative line to”.
dx
- offset from last point to line end on x-axisdy
- offset from last point to line end on y-axis Returns: reference toPath
example: https://fiddle.skia.org/c/@Path_rLineTo example: https://fiddle.skia.org/c/@Quad_a example: https://fiddle.skia.org/c/@Quad_b
pub fn quad_to(
&mut self,
p1: impl Into<Point>,
p2: impl Into<Point>,
) -> &mut Handle<SkPath>
pub fn quad_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, ) -> &mut Handle<SkPath>
Adds quad from last point towards (x1, y1), to (x2, y2).
If Path
is empty, or last Verb
is Verb::Close
, last point is set to (0, 0)
before adding quad.
Appends Verb::Move
to verb array and (0, 0) to Point
array, if needed;
then appends Verb::Quad
to verb array; and (x1, y1), (x2, y2)
to Point
array.
pub fn r_quad_to(
&mut self,
dx1: impl Into<Point>,
dx2: impl Into<Point>,
) -> &mut Handle<SkPath>
pub fn r_quad_to( &mut self, dx1: impl Into<Point>, dx2: impl Into<Point>, ) -> &mut Handle<SkPath>
Adds quad from last point towards vector (dx1, dy1), to vector (dx2, dy2).
If Path
is empty, or last Verb
is Verb::Close
, last point is set to (0, 0) before adding quad.
Appends Verb::Move
to verb array and (0, 0) to Point
array,
if needed; then appends Verb::Quad
to verb array; and appends quad
control and quad end to Point
array.
Quad control is last point plus vector (dx1, dy1).
Quad end is last point plus vector (dx2, dy2).
Function name stands for “relative quad to”.
dx1
- offset from last point to quad control on x-axisdy1
- offset from last point to quad control on y-axisdx2
- offset from last point to quad end on x-axisdy2
- offset from last point to quad end on y-axis Returns: reference toPath
example: https://fiddle.skia.org/c/@Conic_Weight_a example: https://fiddle.skia.org/c/@Conic_Weight_b example: https://fiddle.skia.org/c/@Conic_Weight_c example: https://fiddle.skia.org/c/@Path_rQuadTo
pub fn conic_to(
&mut self,
p1: impl Into<Point>,
p2: impl Into<Point>,
w: f32,
) -> &mut Handle<SkPath>
pub fn conic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, w: f32, ) -> &mut Handle<SkPath>
Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.
If Path
is empty, or last Verb
is Verb::Close
, last point is set to (0, 0)
before adding conic.
Appends Verb::Move
to verb array and (0, 0) to Point
array, if needed.
If w is finite and not one, appends Verb::Conic
to verb array;
and (x1, y1), (x2, y2) to Point
array; and w to conic weights.
If w is one, appends Verb::Quad
to verb array, and
(x1, y1), (x2, y2) to Point
array.
If w is not finite, appends Verb::Line
twice to verb array, and
(x1, y1), (x2, y2) to Point
array.
pub fn r_conic_to(
&mut self,
d1: impl Into<Point>,
d2: impl Into<Point>,
w: f32,
) -> &mut Handle<SkPath>
pub fn r_conic_to( &mut self, d1: impl Into<Point>, d2: impl Into<Point>, w: f32, ) -> &mut Handle<SkPath>
Adds conic from last point towards vector (dx1, dy1), to vector (dx2, dy2),
weighted by w. If Path
is empty, or last Verb
is Verb::Close
, last point is set to (0, 0) before adding conic.
Appends Verb::Move
to verb array and (0, 0) to Point
array,
if needed.
If w is finite and not one, next appends Verb::Conic
to verb array,
and w is recorded as conic weight; otherwise, if w is one, appends
Verb::Quad
to verb array; or if w is not finite, appends Verb::Line
twice to verb array.
In all cases appends Point
control and end to Point
array.
control is last point plus vector (dx1, dy1).
end is last point plus vector (dx2, dy2).
Function name stands for “relative conic to”.
dx1
- offset from last point to conic control on x-axisdy1
- offset from last point to conic control on y-axisdx2
- offset from last point to conic end on x-axisdy2
- offset from last point to conic end on y-axisw
- weight of added conic Returns: reference toPath
pub fn cubic_to(
&mut self,
p1: impl Into<Point>,
p2: impl Into<Point>,
p3: impl Into<Point>,
) -> &mut Handle<SkPath>
pub fn cubic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, ) -> &mut Handle<SkPath>
Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at
(x3, y3). If Path
is empty, or last Verb
is Verb::Close
, last point is set to
(0, 0) before adding cubic.
Appends Verb::Move
to verb array and (0, 0) to Point
array, if needed;
then appends Verb::Cubic
to verb array; and (x1, y1), (x2, y2), (x3, y3)
to Point
array.
pub fn r_cubic_to(
&mut self,
d1: impl Into<Point>,
d2: impl Into<Point>,
d3: impl Into<Point>,
) -> &mut Handle<SkPath>
pub fn r_cubic_to( &mut self, d1: impl Into<Point>, d2: impl Into<Point>, d3: impl Into<Point>, ) -> &mut Handle<SkPath>
Adds cubic from last point towards vector (dx1, dy1), then towards
vector (dx2, dy2), to vector (dx3, dy3).
If Path
is empty, or last Verb
is Verb::Close
, last point is set to (0, 0) before adding cubic.
Appends Verb::Move
to verb array and (0, 0) to Point
array,
if needed; then appends Verb::Cubic
to verb array; and appends cubic
control and cubic end to Point
array.
Cubic control is last point plus vector (dx1, dy1).
Cubic end is last point plus vector (dx2, dy2).
Function name stands for “relative cubic to”.
dx1
- offset from last point to first cubic control on x-axisdy1
- offset from last point to first cubic control on y-axisdx2
- offset from last point to second cubic control on x-axisdy2
- offset from last point to second cubic control on y-axisdx3
- offset from last point to cubic end on x-axisdy3
- offset from last point to cubic end on y-axis Returns: reference toPath
pub fn arc_to(
&mut self,
oval: impl AsRef<Rect>,
start_angle: f32,
sweep_angle: f32,
force_move_to: bool,
) -> &mut Handle<SkPath>
pub fn arc_to( &mut self, oval: impl AsRef<Rect>, start_angle: f32, sweep_angle: f32, force_move_to: bool, ) -> &mut Handle<SkPath>
Appends arc to Path
. Arc added is part of ellipse
bounded by oval, from start_angle
through sweep_angle
. Both start_angle
and
sweep_angle
are measured in degrees, where zero degrees is aligned with the
positive x-axis, and positive sweeps extends arc clockwise.
arc_to()
adds line connecting Path
last Point
to initial arc Point
if force_move_to
is false
and Path
is not empty. Otherwise, added contour begins with first point
of arc. Angles greater than -360 and less than 360 are treated modulo 360.
oval
- bounds of ellipse containing arcstart_angle
- starting angle of arc in degreessweep_angle
- sweep, in degrees. Positive is clockwise; treated modulo 360force_move_to
-true
to start a new contour with arc Returns: reference toPath
pub fn arc_to_tangent(
&mut self,
p1: impl Into<Point>,
p2: impl Into<Point>,
radius: f32,
) -> &mut Handle<SkPath>
pub fn arc_to_tangent( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, radius: f32, ) -> &mut Handle<SkPath>
Appends arc to Path
, after appending line if needed. Arc is implemented by conic
weighted to describe part of circle. Arc is contained by tangent from
last Path
point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc
is part of circle sized to radius, positioned so it touches both tangent lines.
If last Path Point does not start Arc, arc_to
appends connecting Line to Path.
The length of Vector from (x1, y1) to (x2, y2) does not affect Arc.
Arc sweep is always less than 180 degrees. If radius is zero, or if
tangents are nearly parallel, arc_to
appends Line from last Path Point to (x1, y1).
arc_to_tangent
appends at most one Line and one conic.
arc_to_tangent
implements the functionality of PostScript arct and HTML Canvas arc_to
.
p1.x
- x-axis value common to pair of tangentsp1.y
- y-axis value common to pair of tangentsp2.x
- x-axis value end of second tangentp2.y
- y-axis value end of second tangentradius
- distance from arc to circle center Returns: reference toPath
example: https://fiddle.skia.org/c/@Path_arcTo_2_a example: https://fiddle.skia.org/c/@Path_arcTo_2_b example: https://fiddle.skia.org/c/@Path_arcTo_2_c
pub fn arc_to_rotated(
&mut self,
r: impl Into<Point>,
x_axis_rotate: f32,
large_arc: SkPath_ArcSize,
sweep: SkPathDirection,
end: impl Into<Point>,
) -> &mut Handle<SkPath>
pub fn arc_to_rotated( &mut self, r: impl Into<Point>, x_axis_rotate: f32, large_arc: SkPath_ArcSize, sweep: SkPathDirection, end: impl Into<Point>, ) -> &mut Handle<SkPath>
Appends arc to Path
. Arc is implemented by one or more conics weighted to
describe part of oval with radii (rx, ry) rotated by x_axis_rotate
degrees. Arc
curves from last Path
Point
to (x, y), choosing one of four possible routes:
clockwise or counterclockwise, and smaller or larger.
Arc sweep is always less than 360 degrees. arc_to_rotated()
appends line to (x, y) if
either radii are zero, or if last Path
Point
equals (x, y). arc_to_rotated()
scales radii
(rx, ry) to fit last Path
Point
and (x, y) if both are greater than zero but
too small.
arc_to_rotated()
appends up to four conic curves.
arc_to_rotated()
implements the functionality of SVG arc, although SVG sweep-flag value
is opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise,
while Direction::CW
cast to int is zero.
r.x
- radius on x-axis before x-axis rotationr.y
- radius on y-axis before x-axis rotationx_axis_rotate
- x-axis rotation in degrees; positive values are clockwiselarge_arc
- chooses smaller or larger arcsweep
- chooses clockwise or counterclockwise arcend.x
- end of arcend.y
- end of arc Returns: reference toPath
pub fn r_arc_to_rotated(
&mut self,
r: impl Into<Point>,
x_axis_rotate: f32,
large_arc: SkPath_ArcSize,
sweep: SkPathDirection,
d: impl Into<Point>,
) -> &mut Handle<SkPath>
pub fn r_arc_to_rotated( &mut self, r: impl Into<Point>, x_axis_rotate: f32, large_arc: SkPath_ArcSize, sweep: SkPathDirection, d: impl Into<Point>, ) -> &mut Handle<SkPath>
Appends arc to Path
, relative to last Path
Point
. Arc is implemented by one or
more conic, weighted to describe part of oval with radii (r.x, r.y) rotated by
x_axis_rotate
degrees. Arc curves from last Path
Point
to relative end Point
:
(dx, dy), choosing one of four possible routes: clockwise or
counterclockwise, and smaller or larger. If Path
is empty, the start arc Point
is (0, 0).
Arc sweep is always less than 360 degrees. arc_to()
appends line to end Point
if either radii are zero, or if last Path
Point
equals end Point
.
arc_to()
scales radii (rx, ry) to fit last Path
Point
and end Point
if both are
greater than zero but too small to describe an arc.
arc_to()
appends up to four conic curves.
arc_to()
implements the functionality of svg arc, although SVG “sweep-flag” value is
opposite the integer value of sweep; SVG “sweep-flag” uses 1 for clockwise, while
Direction::CW
cast to int is zero.
r.x
- radius before x-axis rotationr.y
- radius before x-axis rotationx_axis_rotate
- x-axis rotation in degrees; positive values are clockwiselarge_arc
- chooses smaller or larger arcsweep
- chooses clockwise or counterclockwise arcd.x
- x-axis offset end of arc from lastPath
Point
d.y
- y-axis offset end of arc from lastPath
Point
Returns: reference toPath
pub fn close(&mut self) -> &mut Handle<SkPath>
pub fn close(&mut self) -> &mut Handle<SkPath>
Appends Verb::Close
to Path
. A closed contour connects the first and last Point
with line, forming a continuous loop. Open and closed contour draw the same
with fill style. With stroke style, open contour draws
crate::paint::Cap
at contour start and end; closed contour draws
crate::paint::Join
at contour start and end.
close()
has no effect if Path
is empty or last Path
Verb
is Verb::Close
.
Returns: reference to Path
pub fn convert_conic_to_quads(
p0: impl Into<Point>,
p1: impl Into<Point>,
p2: impl Into<Point>,
w: f32,
pts: &mut [Point],
pow2: usize,
) -> Option<usize>
pub fn convert_conic_to_quads( p0: impl Into<Point>, p1: impl Into<Point>, p2: impl Into<Point>, w: f32, pts: &mut [Point], pow2: usize, ) -> Option<usize>
Approximates conic with quad array. Conic is constructed from start Point
p0,
control Point
p1, end Point
p2, and weight w.
Quad array is stored in pts; this storage is supplied by caller.
Maximum quad count is 2 to the pow2.
Every third point in array shares last Point
of previous quad and first Point
of
next quad. Maximum pts storage size is given by:
(1 + 2 * (1 << pow2)) * sizeof(Point
).
Returns quad count used the approximation, which may be smaller than the number requested.
conic weight determines the amount of influence conic control point has on the curve. w less than one represents an elliptical section. w greater than one represents a hyperbolic section. w equal to one represents a parabolic section.
Two quad curves are sufficient to approximate an elliptical conic with a sweep of up to 90 degrees; in this case, set pow2 to one.
pub fn is_rect(&self) -> Option<(Rect, bool, SkPathDirection)>
pub fn is_rect(&self) -> Option<(Rect, bool, SkPathDirection)>
Returns Some(Rect, bool, PathDirection)
if Path
is equivalent to Rect
when filled.
If false
: rect, is_closed
, and direction are unchanged.
If true
: rect, is_closed
, and direction are written to.
rect may be smaller than the Path
bounds. Path
bounds may include Verb::Move
points
that do not alter the area drawn by the returned rect.
Returns: Some(rect, is_closed, direction)
if Path
contains Rect
pub fn add_rect(
&mut self,
rect: impl AsRef<Rect>,
dir_start: Option<(SkPathDirection, usize)>,
) -> &mut Handle<SkPath>
pub fn add_rect( &mut self, rect: impl AsRef<Rect>, dir_start: Option<(SkPathDirection, usize)>, ) -> &mut Handle<SkPath>
Adds a new contour to the path, defined by the rect, and wound in the specified direction. The verbs added to the path will be:
Move
, Line
, Line
, Line
, Close
start specifies which corner to begin the contour: 0: upper-left corner 1: upper-right corner 2: lower-right corner 3: lower-left corner
This start point also acts as the implied beginning of the subsequent,
contour, if it does not have an explicit move_to
(). e.g.
path.add_rect(...)
// if we don’t say move_to()
here, we will use the rect’s start point
path.line_to
(…)`
pub fn add_oval(
&mut self,
oval: impl AsRef<Rect>,
dir_start: Option<(SkPathDirection, usize)>,
) -> &mut Handle<SkPath>
pub fn add_oval( &mut self, oval: impl AsRef<Rect>, dir_start: Option<(SkPathDirection, usize)>, ) -> &mut Handle<SkPath>
Adds oval to Path
, appending Verb::Move
, four Verb::Conic
, and Verb::Close
.
Oval is upright ellipse bounded by Rect
oval with radii equal to half oval width
and half oval height. Oval begins at start and continues
clockwise if dir is Direction::CW
, counterclockwise if dir is Direction::CCW
.
pub fn add_open_oval(
&mut self,
oval: impl AsRef<Rect>,
dir_start: Option<(SkPathDirection, usize)>,
) -> &mut Handle<SkPath>
pub fn add_open_oval( &mut self, oval: impl AsRef<Rect>, dir_start: Option<(SkPathDirection, usize)>, ) -> &mut Handle<SkPath>
Experimental, subject to change or removal.
Adds an “open” oval to Path
. This follows canvas2D semantics: The oval is not
a separate contour. If the path was empty, then Verb::Move
is appended. Otherwise,
Verb::Line
is appended. Four Verb::Conic
are appended. Verb::Close
is not appended.
pub fn add_circle(
&mut self,
p: impl Into<Point>,
radius: f32,
dir: impl Into<Option<SkPathDirection>>,
) -> &mut Handle<SkPath>
pub fn add_circle( &mut self, p: impl Into<Point>, radius: f32, dir: impl Into<Option<SkPathDirection>>, ) -> &mut Handle<SkPath>
Adds circle centered at (x, y) of size radius to Path
, appending Verb::Move
,
four Verb::Conic
, and Verb::Close
. Circle begins at: (x + radius, y), continuing
clockwise if dir is Direction::CW
, and counterclockwise if dir is Direction::CCW
.
Has no effect if radius is zero or negative.
pub fn add_arc(
&mut self,
oval: impl AsRef<Rect>,
start_angle: f32,
sweep_angle: f32,
) -> &mut Handle<SkPath>
pub fn add_arc( &mut self, oval: impl AsRef<Rect>, start_angle: f32, sweep_angle: f32, ) -> &mut Handle<SkPath>
Appends arc to Path
, as the start of new contour. Arc added is part of ellipse
bounded by oval, from start_angle
through sweep_angle
. Both start_angle
and
sweep_angle
are measured in degrees, where zero degrees is aligned with the
positive x-axis, and positive sweeps extends arc clockwise.
If sweep_angle
<= -360, or sweep_angle
>= 360; and start_angle
modulo 90 is nearly
zero, append oval instead of arc. Otherwise, sweep_angle
values are treated
modulo 360, and arc may or may not draw depending on numeric rounding.
oval
- bounds of ellipse containing arcstart_angle
- starting angle of arc in degreessweep_angle
- sweep, in degrees. Positive is clockwise; treated modulo 360 Returns: reference toPath
pub fn add_round_rect(
&mut self,
rect: impl AsRef<Rect>,
_: (f32, f32),
dir: impl Into<Option<SkPathDirection>>,
) -> &mut Handle<SkPath>
pub fn add_round_rect( &mut self, rect: impl AsRef<Rect>, _: (f32, f32), dir: impl Into<Option<SkPathDirection>>, ) -> &mut Handle<SkPath>
Appends RRect
to Path
, creating a new closed contour. RRect
has bounds
equal to rect; each corner is 90 degrees of an ellipse with radii (rx, ry). If
dir is Direction::CW
, RRect
starts at top-left of the lower-left corner and
winds clockwise. If dir is Direction::CCW
, RRect
starts at the bottom-left
of the upper-left corner and winds counterclockwise.
If either rx or ry is too large, rx and ry are scaled uniformly until the
corners fit. If rx or ry is less than or equal to zero, add_round_rect()
appends
Rect
rect to Path
.
After appending, Path
may be empty, or may contain: Rect
, oval, or RRect
.
pub fn add_rrect(
&mut self,
rrect: impl AsRef<RRect>,
dir_start: Option<(SkPathDirection, usize)>,
) -> &mut Handle<SkPath>
pub fn add_rrect( &mut self, rrect: impl AsRef<RRect>, dir_start: Option<(SkPathDirection, usize)>, ) -> &mut Handle<SkPath>
Adds rrect to Path
, creating a new closed contour. If dir is Direction::CW
, rrect
winds clockwise; if dir is Direction::CCW
, rrect winds counterclockwise.
start determines the first point of rrect to add.
rrect
- bounds and radii of rounded rectangledir
-PathDirection
to windRRect
start
- index of initial point ofRRect
Returns: reference toPath
pub fn add_poly(&mut self, pts: &[Point], close: bool) -> &mut Handle<SkPath>
pub fn add_poly(&mut self, pts: &[Point], close: bool) -> &mut Handle<SkPath>
Adds contour created from line array, adding pts.len() - 1
line segments.
Contour added starts at pts[0]
, then adds a line for every additional Point
in pts slice. If close is true
, appends Verb::Close
to Path
, connecting
pts[pts.len() - 1]
and pts[0]
.
If count is zero, append Verb::Move
to path.
Has no effect if ps.len() is less than one.
pub fn add_path(
&mut self,
src: &Handle<SkPath>,
d: impl Into<Point>,
mode: impl Into<Option<SkPath_AddPathMode>>,
) -> &mut Handle<SkPath>
pub fn add_path( &mut self, src: &Handle<SkPath>, d: impl Into<Point>, mode: impl Into<Option<SkPath_AddPathMode>>, ) -> &mut Handle<SkPath>
Appends src to Path
, offset by (d.x, d.y)
.
If mode is AddPathMode::Append
, src verb array, Point
array, and conic weights are
added unaltered. If mode is AddPathMode::Extend
, add line before appending
verbs, Point
, and conic weights.
src
-Path
verbs,Point
, and conic weights to addd.x
- offset added to srcPoint
array x-axis coordinatesd.y
- offset added to srcPoint
array y-axis coordinatesmode
-AddPathMode::Append
orAddPathMode::Extend
Returns: reference toPath
pub fn add_path_matrix(
&mut self,
src: &Handle<SkPath>,
matrix: &Matrix,
mode: impl Into<Option<SkPath_AddPathMode>>,
) -> &mut Handle<SkPath>
pub fn add_path_matrix( &mut self, src: &Handle<SkPath>, matrix: &Matrix, mode: impl Into<Option<SkPath_AddPathMode>>, ) -> &mut Handle<SkPath>
Appends src to Path
, transformed by matrix. Transformed curves may have different
verbs, Point
, and conic weights.
If mode is AddPathMode::Append
, src verb array, Point
array, and conic weights are
added unaltered. If mode is AddPathMode::Extend
, add line before appending
verbs, Point
, and conic weights.
src
-Path
verbs,Point
, and conic weights to addmatrix
- transform applied to srcmode
-AddPathMode::Append
orAddPathMode::Extend
Returns: reference toPath
pub fn reverse_add_path(&mut self, src: &Handle<SkPath>) -> &mut Handle<SkPath>
pub fn reverse_add_path(&mut self, src: &Handle<SkPath>) -> &mut Handle<SkPath>
pub fn with_offset(&self, d: impl Into<Point>) -> Handle<SkPath>
pub fn with_offset(&self, d: impl Into<Point>) -> Handle<SkPath>
pub fn with_transform(&self, matrix: &Matrix) -> Handle<SkPath>
pub fn with_transform(&self, matrix: &Matrix) -> Handle<SkPath>
Transforms verb array, Point
array, and weight by matrix.
transform may change verbs and increase their number.
pub fn with_transform_with_perspective_clip(
&self,
matrix: &Matrix,
perspective_clip: SkApplyPerspectiveClip,
) -> Handle<SkPath>
pub fn with_transform_with_perspective_clip( &self, matrix: &Matrix, perspective_clip: SkApplyPerspectiveClip, ) -> Handle<SkPath>
Transforms verb array, Point
array, and weight by matrix.
transform may change verbs and increase their number.
pub fn transform_with_perspective_clip(
&mut self,
matrix: &Matrix,
pc: SkApplyPerspectiveClip,
) -> &mut Handle<SkPath>
pub fn transform_with_perspective_clip( &mut self, matrix: &Matrix, pc: SkApplyPerspectiveClip, ) -> &mut Handle<SkPath>
pub fn make_transform( &mut self, m: &Matrix, pc: impl Into<Option<SkApplyPerspectiveClip>>, ) -> Handle<SkPath>
pub fn make_scale(&mut self, _: (f32, f32)) -> Handle<SkPath>
pub fn set_last_pt(&mut self, p: impl Into<Point>) -> &mut Handle<SkPath>
pub fn set_last_pt(&mut self, p: impl Into<Point>) -> &mut Handle<SkPath>
Sets the last point on the path. If Point
array is empty, append Verb::Move
to
verb array and append p to Point
array.
p
- set value of last point
pub fn segment_masks(&self) -> PathSegmentMask
pub fn segment_masks(&self) -> PathSegmentMask
Returns a mask, where each set bit corresponds to a SegmentMask
constant
if Path
contains one or more verbs of that type.
Returns zero if Path
contains no lines, or curves: quads, conics, or cubics.
segment_masks()
returns a cached result; it is very fast.
Returns: SegmentMask
bits or zero
pub fn contains(&self, p: impl Into<Point>) -> bool
pub fn contains(&self, p: impl Into<Point>) -> bool
pub fn dump_as_data(&self, dump_as_hex: bool) -> RCHandle<SkData>
pub fn dump_as_data(&self, dump_as_hex: bool) -> RCHandle<SkData>
Writes text representation of Path
to Data
.
Set dump_as_hex
true
to generate exact binary representations
of floating point numbers used in Point
array and conic weights.
dump_as_hex
-true
if scalar values are written as hexadecimal
example: https://fiddle.skia.org/c/@Path_dump
pub fn dump(&self)
pub fn dump(&self)
pub fn dump_hex(&self)
pub fn dump_hex(&self)
pub fn dump_arrays_as_data(&self, dump_as_hex: bool) -> RCHandle<SkData>
pub fn dump_arrays(&self)
pub fn serialize(&self) -> RCHandle<SkData>
pub fn serialize(&self) -> RCHandle<SkData>
Writes Path
to buffer, returning the buffer written to, wrapped in Data
.
serialize()
writes FillType
, verb array, Point
array, conic weight, and
additionally writes computed information like convexity and bounds.
serialize()
should only be used in concert with read_from_memory
().
The format used for Path
in memory is not guaranteed.
pub fn deserialize(data: &RCHandle<SkData>) -> Option<Handle<SkPath>>
pub fn generation_id(&self) -> u32
pub fn generation_id(&self) -> u32
(See Skia bug 1762.)
Returns a non-zero, globally unique value. A different value is returned
if verb array, Point
array, or conic weight changes.
Setting FillType
does not change generation identifier.
Each time the path is modified, a different generation identifier will be returned.
FillType
does affect generation identifier on Android framework.
Returns: non-zero, globally unique value
§impl Handle<SkPathBuilder>
impl Handle<SkPathBuilder>
pub fn new() -> Handle<SkPathBuilder>
pub fn new_path(path: &Handle<SkPath>) -> Handle<SkPathBuilder>
pub fn fill_type(&self) -> SkPathFillType
pub fn compute_bounds(&self) -> Rect
pub fn snapshot(&self) -> Handle<SkPath>
pub fn detach(&mut self) -> Handle<SkPath>
pub fn set_fill_type( &mut self, ft: SkPathFillType, ) -> &mut Handle<SkPathBuilder>
pub fn set_is_volatile( &mut self, is_volatile: bool, ) -> &mut Handle<SkPathBuilder>
pub fn reset(&mut self) -> &mut Handle<SkPathBuilder>
pub fn move_to(&mut self, pt: impl Into<Point>) -> &mut Handle<SkPathBuilder>
pub fn line_to(&mut self, pt: impl Into<Point>) -> &mut Handle<SkPathBuilder>
pub fn quad_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, ) -> &mut Handle<SkPathBuilder>
pub fn conic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, w: f32, ) -> &mut Handle<SkPathBuilder>
pub fn cubic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, ) -> &mut Handle<SkPathBuilder>
pub fn close(&mut self) -> &mut Handle<SkPathBuilder>
pub fn polyline_to(&mut self, points: &[Point]) -> &mut Handle<SkPathBuilder>
pub fn r_line_to(&mut self, pt: impl Into<Point>) -> &mut Handle<SkPathBuilder>
pub fn r_quad_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, ) -> &mut Handle<SkPathBuilder>
pub fn r_conic_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, w: f32, ) -> &mut Handle<SkPathBuilder>
pub fn r_cubic_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, pt3: impl Into<Point>, ) -> &mut Handle<SkPathBuilder>
pub fn arc_to( &mut self, oval: impl AsRef<Rect>, start_angle_deg: f32, sweep_angle_deg: f32, force_move_to: bool, ) -> &mut Handle<SkPathBuilder>
pub fn arc_to_tangent( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, radius: f32, ) -> &mut Handle<SkPathBuilder>
pub fn arc_to_radius( &mut self, r: impl Into<Point>, x_axis_rotate: f32, large_arc: SkPathBuilder_ArcSize, sweep: SkPathDirection, xy: impl Into<Point>, ) -> &mut Handle<SkPathBuilder>
pub fn add_arc( &mut self, oval: impl AsRef<Rect>, start_angle_deg: f32, sweep_angle_deg: f32, ) -> &mut Handle<SkPathBuilder>
pub fn add_rect( &mut self, rect: impl AsRef<Rect>, dir: impl Into<Option<SkPathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Handle<SkPathBuilder>
pub fn add_oval( &mut self, rect: impl AsRef<Rect>, dir: impl Into<Option<SkPathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Handle<SkPathBuilder>
pub fn add_rrect( &mut self, rect: impl AsRef<RRect>, dir: impl Into<Option<SkPathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Handle<SkPathBuilder>
pub fn add_circle( &mut self, center: impl Into<Point>, radius: f32, dir: impl Into<Option<SkPathDirection>>, ) -> &mut Handle<SkPathBuilder>
pub fn add_polygon( &mut self, pts: &[Point], is_closed: bool, ) -> &mut Handle<SkPathBuilder>
pub fn add_path(&mut self, path: &Handle<SkPath>) -> &mut Handle<SkPathBuilder>
pub fn inc_reserve(&mut self, extra_pt_count: usize, extra_verb_count: usize)
pub fn offset(&mut self, d: impl Into<Point>) -> &mut Handle<SkPathBuilder>
pub fn toggle_inverse_fill_type(&mut self) -> &mut Handle<SkPathBuilder>
pub fn make( _points: &[Point], _verbs: &[u8], _conic_weights: &[f32], _fill_type: SkPathFillType, _is_volatile: impl Into<Option<bool>>, ) -> !
§impl Handle<SkPathMeasure>
impl Handle<SkPathMeasure>
Warning: Even if you pass in a PathMeasure
with multiple contours, most of this struct’s functions, including length
only return the value for the first contour on the path (which is why they aren’t const
). You must exhaust PathMeasure::next_contour
.
use skia_safe::{PathMeasure, Point, Path};
use std::f64::consts::PI;
let mut path = Path::circle((0., 0.), 10.0, None);
path.add_path(&Path::circle((100., 100.), 27.0, None), Point::default(), None);
let mut measure = PathMeasure::new(&path, false, None);
let mut lengths = vec![measure.length()];
while measure.next_contour() {
lengths.push(measure.length());
}
assert_eq!(*lengths.first().unwrap() as i64, (2. * PI * 10.0) as i64);
assert_eq!(*lengths.get(1).unwrap() as i64, (2. * PI * 27.0) as i64);
eprintln!("Circle lengths: {:?}", &lengths);
pub fn new( path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> Handle<SkPathMeasure>
pub fn from_path( path: &Handle<SkPath>, force_closed: bool, res_scale: impl Into<Option<f32>>, ) -> Handle<SkPathMeasure>
pub fn set_path( &mut self, path: &Handle<SkPath>, force_closed: bool, ) -> &mut Handle<SkPathMeasure>
pub fn length(&mut self) -> f32
pub fn pos_tan(&mut self, distance: f32) -> Option<(Point, Point)>
pub fn matrix( &mut self, distance: f32, flags: impl Into<Option<MatrixFlags>>, ) -> Option<Matrix>
pub fn segment( &mut self, start_d: f32, stop_d: f32, start_with_move_to: bool, ) -> Option<Handle<SkPath>>
pub fn is_closed(&mut self) -> bool
pub fn next_contour(&mut self) -> bool
pub fn current_measure(&self) -> &Option<RCHandle<SkContourMeasure>>
§impl Handle<SkPictureRecorder>
impl Handle<SkPictureRecorder>
pub fn new() -> Handle<SkPictureRecorder>
pub fn begin_recording( &mut self, bounds: impl AsRef<Rect>, bbh_factory: Option<&mut Handle<SkBBHFactory>>, ) -> &Canvas
pub fn recording_canvas(&mut self) -> Option<&Canvas>
pub fn finish_recording_as_picture( &mut self, cull_rect: Option<&Rect>, ) -> Option<RCHandle<SkPicture>>
pub fn finish_recording_as_drawable(&mut self) -> Option<RCHandle<SkDrawable>>
§impl Handle<SkRegion>
impl Handle<SkRegion>
pub fn new() -> Handle<SkRegion>
pub fn from_rect(rect: impl AsRef<IRect>) -> Handle<SkRegion>
pub fn set(&mut self, src: &Handle<SkRegion>) -> bool
pub fn swap(&mut self, other: &mut Handle<SkRegion>)
pub fn is_empty(&self) -> bool
pub fn is_rect(&self) -> bool
pub fn is_complex(&self) -> bool
pub fn bounds(&self) -> &IRect
pub fn compute_region_complexity(&self) -> usize
pub fn get_boundary_path(&self, path: &mut Handle<SkPath>) -> bool
pub fn set_empty(&mut self) -> bool
pub fn set_rect(&mut self, rect: impl AsRef<IRect>) -> bool
pub fn set_rects(&mut self, rects: &[IRect]) -> bool
pub fn set_region(&mut self, region: &Handle<SkRegion>) -> bool
pub fn set_path( &mut self, path: &Handle<SkPath>, clip: &Handle<SkRegion>, ) -> bool
pub fn intersects_rect(&self, rect: impl AsRef<IRect>) -> bool
pub fn intersects_region(&self, other: &Handle<SkRegion>) -> bool
pub fn contains_point(&self, point: IPoint) -> bool
pub fn contains_rect(&self, rect: impl AsRef<IRect>) -> bool
pub fn contains_region(&self, other: &Handle<SkRegion>) -> bool
pub fn quick_contains(&self, r: impl AsRef<IRect>) -> bool
pub fn quick_reject_rect(&self, rect: impl AsRef<IRect>) -> bool
pub fn quick_reject_region(&self, rgn: &Handle<SkRegion>) -> bool
pub fn translate(&mut self, d: impl Into<IPoint>)
pub fn translated(&self, d: impl Into<IPoint>) -> Handle<SkRegion>
pub fn op_rect(&mut self, rect: impl AsRef<IRect>, op: SkRegion_Op) -> bool
pub fn op_region(&mut self, region: &Handle<SkRegion>, op: SkRegion_Op) -> bool
pub fn op_rect_region( &mut self, rect: impl AsRef<IRect>, region: &Handle<SkRegion>, op: SkRegion_Op, ) -> bool
pub fn op_region_rect( &mut self, region: &Handle<SkRegion>, rect: impl AsRef<IRect>, op: SkRegion_Op, ) -> bool
pub fn write_to_memory(&self, buf: &mut Vec<u8>)
pub fn read_from_memory(&mut self, buf: &[u8]) -> usize
§impl Handle<SkStrokeRec>
impl Handle<SkStrokeRec>
pub fn new(init_style: SkStrokeRec_InitStyle) -> Handle<SkStrokeRec>
pub fn new_hairline() -> Handle<SkStrokeRec>
pub fn new_fill() -> Handle<SkStrokeRec>
pub fn from_paint( paint: &Handle<SkPaint>, style: impl Into<Option<SkPaint_Style>>, res_scale: impl Into<Option<f32>>, ) -> Handle<SkStrokeRec>
pub fn style(&self) -> SkStrokeRec_Style
pub fn width(&self) -> f32
pub fn miter(&self) -> f32
pub fn cap(&self) -> SkPaint_Cap
pub fn join(&self) -> SkPaint_Join
pub fn is_hairline_style(&self) -> bool
pub fn is_fill_style(&self) -> bool
pub fn set_fill_style(&mut self) -> &mut Handle<SkStrokeRec>
pub fn set_hairline_style(&mut self) -> &mut Handle<SkStrokeRec>
pub fn set_stroke_style( &mut self, width: f32, stroke_and_fill: impl Into<Option<bool>>, ) -> &mut Handle<SkStrokeRec>
pub fn set_stroke_params( &mut self, cap: SkPaint_Cap, join: SkPaint_Join, miter_limit: f32, ) -> &mut Handle<SkStrokeRec>
pub fn res_scale(&self) -> f32
pub fn set_res_scale(&mut self, rs: f32)
pub fn need_to_apply(&self) -> bool
pub fn apply_to_path( &self, dst: &mut Handle<SkPath>, src: &Handle<SkPath>, ) -> bool
pub fn apply_to_path_inplace(&self, path: &mut Handle<SkPath>) -> bool
pub fn apply_to_paint(&self, paint: &mut Handle<SkPaint>)
pub fn inflation_radius(&self) -> f32
pub fn inflation_radius_from_paint_and_style( paint: &Handle<SkPaint>, style: SkPaint_Style, ) -> f32
pub fn inflation_radius_from_params( join: SkPaint_Join, miter_limit: f32, cap: SkPaint_Cap, stroke_width: f32, ) -> f32
pub fn has_equal_effect(&self, other: &Handle<SkStrokeRec>) -> bool
§impl Handle<SkTextBlobBuilder>
impl Handle<SkTextBlobBuilder>
pub fn new() -> Handle<SkTextBlobBuilder>
pub fn make(&mut self) -> Option<RCHandle<SkTextBlob>>
pub fn alloc_run( &mut self, font: &Handle<SkFont>, count: usize, offset: impl Into<Point>, bounds: Option<&Rect>, ) -> &mut [u16]
pub fn alloc_run_pos_h( &mut self, font: &Handle<SkFont>, count: usize, y: f32, bounds: Option<&Rect>, ) -> (&mut [u16], &mut [f32])
pub fn alloc_run_pos( &mut self, font: &Handle<SkFont>, count: usize, bounds: Option<&Rect>, ) -> (&mut [u16], &mut [Point])
pub fn alloc_run_rsxform( &mut self, font: &Handle<SkFont>, count: usize, ) -> (&mut [u16], &mut [RSXform])
pub fn alloc_run_text( &mut self, font: &Handle<SkFont>, count: usize, offset: impl Into<Point>, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [u16], &mut [u8], &mut [u32])
pub fn alloc_run_text_pos_h( &mut self, font: &Handle<SkFont>, count: usize, y: f32, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [u16], &mut [f32], &mut [u8], &mut [u32])
pub fn alloc_run_text_pos( &mut self, font: &Handle<SkFont>, count: usize, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [u16], &mut [Point], &mut [u8], &mut [u32])
pub fn alloc_run_text_rsxform( &mut self, font: &Handle<SkFont>, count: usize, text_byte_count: usize, bounds: Option<&Rect>, ) -> (&mut [u16], &mut [RSXform], &mut [u8], &mut [u32])
§impl Handle<SkVertices_Builder>
impl Handle<SkVertices_Builder>
pub fn new( mode: SkVertices_VertexMode, vertex_count: usize, index_count: usize, flags: BuilderFlags, ) -> Handle<SkVertices_Builder>
pub fn positions(&mut self) -> &mut [Point]
pub fn indices(&mut self) -> Option<&mut [u16]>
pub fn tex_coords(&mut self) -> Option<&mut [Point]>
pub fn colors(&mut self) -> Option<&mut [Color]>
pub fn is_volatile(&self) -> bool
pub fn bone_indices(&mut self) -> Option<&mut [[u32; 4]]>
pub fn bone_weights(&mut self) -> Option<&mut [[u32; 4]]>
pub fn detach(self) -> RCHandle<SkVertices>
§impl Handle<SkYUVAInfo>
impl Handle<SkYUVAInfo>
pub const MAX_PLANES: usize = 4usize
pub fn new(
dimensions: impl Into<ISize>,
config: SkYUVAInfo_PlaneConfig,
subsampling: Subsampling,
color_space: SkYUVColorSpace,
origin: impl Into<Option<EncodedOrigin>>,
siting_xy: impl Into<Option<(SkYUVAInfo_Siting, SkYUVAInfo_Siting)>>,
) -> Option<Handle<SkYUVAInfo>>
pub fn new( dimensions: impl Into<ISize>, config: SkYUVAInfo_PlaneConfig, subsampling: Subsampling, color_space: SkYUVColorSpace, origin: impl Into<Option<EncodedOrigin>>, siting_xy: impl Into<Option<(SkYUVAInfo_Siting, SkYUVAInfo_Siting)>>, ) -> Option<Handle<SkYUVAInfo>>
dimensions
should specify the size of the full resolution image (after planes have been
oriented to how the image is displayed as indicated by origin
).
pub fn plane_config(&self) -> SkYUVAInfo_PlaneConfig
pub fn subsampling(&self) -> Subsampling
pub fn plane_subsampling_factors(&self, plane_index: usize) -> (i32, i32)
pub fn dimensions(&self) -> ISize
pub fn dimensions(&self) -> ISize
Dimensions of the full resolution image (after planes have been oriented to how the image is displayed as indicated by fOrigin).
pub fn width(&self) -> i32
pub fn height(&self) -> i32
pub fn yuv_color_space(&self) -> SkYUVColorSpace
pub fn siting_xy(&self) -> (SkYUVAInfo_Siting, SkYUVAInfo_Siting)
pub fn origin(&self) -> EncodedOrigin
pub fn origin_matrix(&self) -> Matrix
pub fn has_alpha(&self) -> bool
pub fn plane_dimensions(&self) -> Vec<ISize>
pub fn plane_dimensions(&self) -> Vec<ISize>
Returns the dimensions for each plane. Dimensions are as stored in memory, before transformation to image display space as indicated by [origin(&self)].
pub fn compute_total_bytes(
&self,
row_bytes: &[usize; 4],
plane_sizes: Option<&mut [usize; 4]>,
) -> usize
pub fn compute_total_bytes( &self, row_bytes: &[usize; 4], plane_sizes: Option<&mut [usize; 4]>, ) -> usize
Given a per-plane row bytes, determine size to allocate for all planes. Optionally retrieves
the per-plane byte sizes in planeSizes if not None
. If total size overflows will return
SIZE_MAX
and set all planeSizes to SIZE_MAX
.
pub fn num_planes(&self) -> usize
pub fn num_channels_in_plane(&self, i: usize) -> Option<usize>
pub fn with_subsampling(
&self,
subsampling: Subsampling,
) -> Option<Handle<SkYUVAInfo>>
pub fn with_subsampling( &self, subsampling: Subsampling, ) -> Option<Handle<SkYUVAInfo>>
Returns a YUVAInfo that is identical to this one but with the passed Subsampling. If the
passed Subsampling is not Subsampling::S444 and this info’s PlaneConfig is not
compatible with chroma subsampling (because Y is in the same plane as UV) then the result
will be None
.
§impl Handle<SkYUVAPixmapInfo>
impl Handle<SkYUVAPixmapInfo>
pub const MAX_PLANES: usize = 4usize
pub const DATA_TYPE_CNT: usize = 3usize
pub fn new(
info: &Handle<SkYUVAInfo>,
color_types: &[ColorType],
row_bytes: Option<&[usize]>,
) -> Option<Handle<SkYUVAPixmapInfo>>
pub fn new( info: &Handle<SkYUVAInfo>, color_types: &[ColorType], row_bytes: Option<&[usize]>, ) -> Option<Handle<SkYUVAPixmapInfo>>
Initializes the YUVAPixmapInfo from a YUVAInfo with per-plane color types and row bytes. This will return None if the colorTypes aren’t compatible with the YUVAInfo or if a rowBytes entry is not valid for the plane dimensions and color type. Color type and row byte values beyond the number of planes in YUVAInfo are ignored. All ColorTypes must have the same DataType or this will return None.
If rowBytes
is None then bpp*width is assumed for each plane.
pub fn from_data_type(
info: &Handle<SkYUVAInfo>,
data_type: SkYUVAPixmapInfo_DataType,
row_bytes: Option<&[usize]>,
) -> Option<Handle<SkYUVAPixmapInfo>>
pub fn from_data_type( info: &Handle<SkYUVAInfo>, data_type: SkYUVAPixmapInfo_DataType, row_bytes: Option<&[usize]>, ) -> Option<Handle<SkYUVAPixmapInfo>>
Like above but uses yuva_pixmap_info::default_color_type_for_data_type to determine each plane’s ColorType. If
rowBytes
is None then bpp*width is assumed for each plane.
pub fn yuva_info(&self) -> &Handle<SkYUVAInfo>
pub fn yuv_color_space(&self) -> SkYUVColorSpace
pub fn num_planes(&self) -> usize
pub fn num_planes(&self) -> usize
The number of Pixmap planes.
pub fn data_type(&self) -> SkYUVAPixmapInfo_DataType
pub fn data_type(&self) -> SkYUVAPixmapInfo_DataType
The per-YUV[A]
channel data type.
pub fn row_bytes(&self, i: usize) -> Option<usize>
pub fn row_bytes(&self, i: usize) -> Option<usize>
Row bytes for the ith plane. Returns None
if i
>= Self::num_planes()
or this
YUVAPixmapInfo is invalid.
pub fn row_bytes_iter(
&self,
) -> impl Iterator<Item = usize> + Captures<&Handle<SkYUVAPixmapInfo>>
pub fn row_bytes_iter( &self, ) -> impl Iterator<Item = usize> + Captures<&Handle<SkYUVAPixmapInfo>>
Row bytes for all planes.
pub fn plane_info(&self, i: usize) -> Option<&Handle<SkImageInfo>>
pub fn plane_info(&self, i: usize) -> Option<&Handle<SkImageInfo>>
Image info for the ith plane, or None
if i
>= Self::num_planes()
pub fn plane_infos(&self) -> impl Iterator<Item = &Handle<SkImageInfo>>
pub fn plane_infos(&self) -> impl Iterator<Item = &Handle<SkImageInfo>>
An iterator of all planes’ image infos.
pub fn compute_total_bytes(&self, plane_sizes: Option<&mut [usize; 4]>) -> usize
pub fn compute_total_bytes(&self, plane_sizes: Option<&mut [usize; 4]>) -> usize
Determine size to allocate for all planes. Optionally retrieves the per-plane sizes in
planeSizes if not None. If total size overflows will return SIZE_MAX and set all
plane_sizes
to SIZE_MAX.
pub unsafe fn init_pixmaps_from_single_allocation(
&self,
memory: *mut c_void,
) -> Option<[Pixmap<'_>; 4]>
pub unsafe fn init_pixmaps_from_single_allocation( &self, memory: *mut c_void, ) -> Option<[Pixmap<'_>; 4]>
Takes an allocation that is assumed to be at least [compute_total_bytes(&self)] in size and configures the first [numPlanes(&self)] entries in pixmaps array to point into that memory. The remaining entries of pixmaps are default initialized. Returns None if this YUVAPixmapInfo not valid.
pub fn is_supported(
&self,
data_types: &Handle<SkYUVAPixmapInfo_SupportedDataTypes>,
) -> bool
pub fn is_supported( &self, data_types: &Handle<SkYUVAPixmapInfo_SupportedDataTypes>, ) -> bool
Is this valid and does it use color types allowed by the passed SupportedDataTypes?
§impl Handle<SkYUVAPixmaps>
impl Handle<SkYUVAPixmaps>
pub const MAX_PLANES: usize = 4usize
pub fn recommended_rgba_color_type(dt: SkYUVAPixmapInfo_DataType) -> ColorType
pub fn allocate(
info: &Handle<SkYUVAPixmapInfo>,
) -> Option<Handle<SkYUVAPixmaps>>
pub fn allocate( info: &Handle<SkYUVAPixmapInfo>, ) -> Option<Handle<SkYUVAPixmaps>>
Allocate space for pixmaps’ pixels in the YUVAPixmaps.
pub fn from_data(
info: &Handle<SkYUVAPixmapInfo>,
data: impl Into<RCHandle<SkData>>,
) -> Option<Handle<SkYUVAPixmaps>>
pub fn from_data( info: &Handle<SkYUVAPixmapInfo>, data: impl Into<RCHandle<SkData>>, ) -> Option<Handle<SkYUVAPixmaps>>
Use storage in Data as backing store for pixmaps’ pixels. Data is retained by the YUVAPixmaps.
pub unsafe fn from_external_memory(
info: &Handle<SkYUVAPixmapInfo>,
memory: *mut c_void,
) -> Option<Handle<SkYUVAPixmaps>>
pub unsafe fn from_external_memory( info: &Handle<SkYUVAPixmapInfo>, memory: *mut c_void, ) -> Option<Handle<SkYUVAPixmaps>>
Use passed in memory as backing store for pixmaps’ pixels. Caller must ensure memory remains allocated while pixmaps are in use. There must be at least [YUVAPixmapInfo::computeTotalBytes(&self)] allocated starting at memory.
pub unsafe fn from_external_pixmaps(
info: &Handle<SkYUVAInfo>,
pixmaps: &[Pixmap<'_>; 4],
) -> Option<Handle<SkYUVAPixmaps>>
pub unsafe fn from_external_pixmaps( info: &Handle<SkYUVAInfo>, pixmaps: &[Pixmap<'_>; 4], ) -> Option<Handle<SkYUVAPixmaps>>
Wraps existing Pixmap
s. The YUVAPixmaps will have no ownership of the Pixmaps’ pixel
memory so the caller must ensure it remains valid. Will return None if
the YUVAInfo isn’t compatible with the Pixmap array (number of planes, plane dimensions,
sufficient color channels in planes, …).
pub fn yuva_info(&self) -> &Handle<SkYUVAInfo>
pub fn data_type(&self) -> SkYUVAPixmapInfo_DataType
pub fn pixmaps_info(&self) -> Handle<SkYUVAPixmapInfo>
pub fn num_planes(&self) -> usize
pub fn num_planes(&self) -> usize
Number of pixmap planes.
§impl Handle<SkYUVAPixmapInfo_SupportedDataTypes>
impl Handle<SkYUVAPixmapInfo_SupportedDataTypes>
pub fn all() -> Handle<SkYUVAPixmapInfo_SupportedDataTypes>
pub fn all() -> Handle<SkYUVAPixmapInfo_SupportedDataTypes>
All legal combinations of PlaneConfig and DataType are supported.
pub fn supported(
&self,
pc: SkYUVAInfo_PlaneConfig,
dt: SkYUVAPixmapInfo_DataType,
) -> bool
pub fn supported( &self, pc: SkYUVAInfo_PlaneConfig, dt: SkYUVAPixmapInfo_DataType, ) -> bool
Checks whether there is a supported combination of color types for planes structured as indicated by PlaneConfig with channel data types as indicated by DataType.
pub fn enable_data_type(
&mut self,
dt: SkYUVAPixmapInfo_DataType,
num_channels: usize,
)
pub fn enable_data_type( &mut self, dt: SkYUVAPixmapInfo_DataType, num_channels: usize, )
Update to add support for pixmaps with num_channels
channels where each channel is
represented as DataType.
§impl Handle<SkPDF_AttributeList>
impl Handle<SkPDF_AttributeList>
Attributes for nodes in the PDF tree.
Each attribute must have an owner (e.g. “Layout”, “List”, “Table”, etc) and an attribute name (e.g. “BBox”, “RowSpan”, etc.) from PDF32000_2008 14.8.5, and then a value of the proper type according to the spec.
pub fn append_int( &mut self, owner: impl AsRef<str>, name: impl AsRef<str>, value: i32, ) -> &mut Handle<SkPDF_AttributeList>
pub fn append_float( &mut self, owner: impl AsRef<str>, name: impl AsRef<str>, value: f32, ) -> &mut Handle<SkPDF_AttributeList>
pub fn append_float_array( &mut self, owner: impl AsRef<str>, name: impl AsRef<str>, value: &[f32], ) -> &mut Handle<SkPDF_AttributeList>
§impl Handle<SkColorMatrix>
impl Handle<SkColorMatrix>
pub fn new( m00: f32, m01: f32, m02: f32, m03: f32, m04: f32, m10: f32, m11: f32, m12: f32, m13: f32, m14: f32, m20: f32, m21: f32, m22: f32, m23: f32, m24: f32, m30: f32, m31: f32, m32: f32, m33: f32, m34: f32, ) -> Handle<SkColorMatrix>
pub fn rgb_to_yuv(rgb: SkYUVColorSpace) -> Handle<SkColorMatrix>
pub fn yuv_to_rgb(yuv: SkYUVColorSpace) -> Handle<SkColorMatrix>
pub fn set_identity(&mut self)
pub fn set_scale( &mut self, r_scale: f32, g_scale: f32, b_scale: f32, a_scale: impl Into<Option<f32>>, )
pub fn post_translate(&mut self, dr: f32, dg: f32, db: f32, da: f32)
pub fn set_concat( &mut self, a: &Handle<SkColorMatrix>, b: &Handle<SkColorMatrix>, )
pub fn pre_concat(&mut self, mat: &Handle<SkColorMatrix>)
pub fn post_concat(&mut self, mat: &Handle<SkColorMatrix>)
pub fn set_saturation(&mut self, sat: f32)
pub fn set_row_major(&mut self, src: &[f32; 20])
pub fn get_row_major(&self, dst: &mut [f32; 20])
§impl Handle<GrBackendFormat>
impl Handle<GrBackendFormat>
pub fn new() -> Handle<GrBackendFormat>
pub fn new_gl(format: u32, target: u32) -> Handle<GrBackendFormat>
pub fn backend(&self) -> GrBackendApi
pub fn channel_mask(&self) -> u32
pub fn as_gl_format(&self) -> GrGLFormat
pub fn as_gl_format_enum(&self) -> u32
pub fn to_texture_2d(&self) -> Handle<GrBackendFormat>
pub fn is_valid(&self) -> bool
§impl Handle<GrBackendRenderTarget>
impl Handle<GrBackendRenderTarget>
pub fn new_gl( _: (i32, i32), sample_count: impl Into<Option<usize>>, stencil_bits: usize, info: FramebufferInfo, ) -> Handle<GrBackendRenderTarget>
pub fn dimensions(&self) -> ISize
pub fn width(&self) -> i32
pub fn height(&self) -> i32
pub fn sample_count(&self) -> usize
pub fn stencil_bits(&self) -> usize
pub fn backend(&self) -> GrBackendApi
pub fn is_framebuffer_only(&self) -> bool
pub fn gl_framebuffer_info(&self) -> Option<FramebufferInfo>
pub fn backend_format(&self) -> Handle<GrBackendFormat>
pub fn set_mutable_state(&mut self, state: &RCHandle<skgpu_MutableTextureState>)
pub fn is_protected(&self) -> bool
pub fn is_valid(&self) -> bool
§impl Handle<GrYUVABackendTextureInfo>
impl Handle<GrYUVABackendTextureInfo>
pub const MAX_PLANES: usize = 4usize
pub fn new(
info: &Handle<SkYUVAInfo>,
formats: &[Handle<GrBackendFormat>],
mip_mapped: skgpu_Mipmapped,
origin: GrSurfaceOrigin,
) -> Option<Handle<GrYUVABackendTextureInfo>>
pub fn new( info: &Handle<SkYUVAInfo>, formats: &[Handle<GrBackendFormat>], mip_mapped: skgpu_Mipmapped, origin: GrSurfaceOrigin, ) -> Option<Handle<GrYUVABackendTextureInfo>>
Initializes a YUVABackendTextureInfo to describe a set of textures that can store the planes indicated by the YUVAInfo. The texture dimensions are taken from the YUVAInfo’s plane dimensions. All the described textures share a common origin. The planar image this describes will be mip mapped if all the textures are individually mip mapped as indicated by Mipmapped. This will return None if the passed formats’ channels don’t agree with YUVAInfo.
pub fn yuva_info(&self) -> &Handle<SkYUVAInfo>
pub fn yuv_color_space(&self) -> SkYUVColorSpace
pub fn mipmapped(&self) -> skgpu_Mipmapped
pub fn texture_origin(&self) -> GrSurfaceOrigin
pub fn num_planes(&self) -> usize
pub fn num_planes(&self) -> usize
The number of crate::Pixmap planes.
pub fn plane_format(&self, i: usize) -> Option<&Handle<GrBackendFormat>>
pub fn plane_format(&self, i: usize) -> Option<&Handle<GrBackendFormat>>
Format of the ith plane, or None
if i >= Self::num_planes()
pub fn plane_formats(&self) -> &[Handle<GrBackendFormat>]
pub fn plane_formats(&self) -> &[Handle<GrBackendFormat>]
All plane formats.
§impl Handle<GrYUVABackendTextures>
impl Handle<GrYUVABackendTextures>
pub fn new( info: &Handle<SkYUVAInfo>, textures: &[RefHandle<GrBackendTexture>], texture_origin: GrSurfaceOrigin, ) -> Option<Handle<GrYUVABackendTextures>>
pub fn textures(&self) -> Vec<RefHandle<GrBackendTexture>>
pub fn texture(&self, i: usize) -> Option<RefHandle<GrBackendTexture>>
pub fn yuva_info(&self) -> &Handle<SkYUVAInfo>
pub fn num_planes(&self) -> usize
pub fn texture_origin(&self) -> GrSurfaceOrigin
§impl Handle<SkDynamicMemoryWStream>
impl Handle<SkDynamicMemoryWStream>
pub fn new() -> Handle<SkDynamicMemoryWStream>
pub fn from_bytes(bytes: &[u8]) -> Handle<SkDynamicMemoryWStream>
pub fn write(&mut self, bytes: &[u8]) -> bool
pub fn detach_as_data(&mut self) -> RCHandle<SkData>
pub fn detach_as_stream(&mut self) -> Stream<SkStreamAsset>
§impl Handle<skia_textlayout_FontArguments>
impl Handle<skia_textlayout_FontArguments>
pub fn clone_typeface( &self, typeface: impl Into<RCHandle<SkTypeface>>, ) -> Option<RCHandle<SkTypeface>>
§impl Handle<skia_textlayout_StrutStyle>
impl Handle<skia_textlayout_StrutStyle>
pub fn new() -> Handle<skia_textlayout_StrutStyle>
pub fn font_families(&self) -> FontFamilies<'_>
pub fn set_font_families( &mut self, families: &[impl AsRef<str>], ) -> &mut Handle<skia_textlayout_StrutStyle>
pub fn font_style(&self) -> FontStyle
pub fn set_font_style( &mut self, font_style: FontStyle, ) -> &mut Handle<skia_textlayout_StrutStyle>
pub fn font_size(&self) -> f32
pub fn set_font_size( &mut self, font_size: f32, ) -> &mut Handle<skia_textlayout_StrutStyle>
pub fn set_height( &mut self, height: f32, ) -> &mut Handle<skia_textlayout_StrutStyle>
pub fn height(&self) -> f32
pub fn set_leading( &mut self, leading: f32, ) -> &mut Handle<skia_textlayout_StrutStyle>
pub fn leading(&self) -> f32
pub fn strut_enabled(&self) -> bool
pub fn set_strut_enabled( &mut self, enabled: bool, ) -> &mut Handle<skia_textlayout_StrutStyle>
pub fn force_strut_height(&self) -> bool
pub fn set_force_strut_height( &mut self, force_height: bool, ) -> &mut Handle<skia_textlayout_StrutStyle>
pub fn height_override(&self) -> bool
pub fn set_height_override( &mut self, height_override: bool, ) -> &mut Handle<skia_textlayout_StrutStyle>
pub fn half_leading(&self) -> bool
pub fn set_half_leading( &mut self, half_leading: bool, ) -> &mut Handle<skia_textlayout_StrutStyle>
§impl Handle<skia_textlayout_TextStyle>
impl Handle<skia_textlayout_TextStyle>
pub fn new() -> Handle<skia_textlayout_TextStyle>
pub fn to_placeholder(&self) -> Handle<skia_textlayout_TextStyle>
pub fn clone_for_placeholder(&self) -> Handle<skia_textlayout_TextStyle>
pub fn equals(&self, other: &Handle<skia_textlayout_TextStyle>) -> bool
pub fn equals_by_fonts(&self, that: &Handle<skia_textlayout_TextStyle>) -> bool
pub fn match_one_attribute( &self, style_type: skia_textlayout_StyleType, other: &Handle<skia_textlayout_TextStyle>, ) -> bool
pub fn color(&self) -> Color
pub fn set_color( &mut self, color: impl Into<Color>, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn has_foreground(&self) -> bool
pub fn foreground(&self) -> Handle<SkPaint>
pub fn set_foreground_paint( &mut self, paint: &Handle<SkPaint>, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn set_foreground_color( &mut self, paint: &Handle<SkPaint>, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn clear_foreground_color( &mut self, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn has_background(&self) -> bool
pub fn background(&self) -> Handle<SkPaint>
pub fn set_background_paint( &mut self, paint: &Handle<SkPaint>, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn set_background_color( &mut self, paint: &Handle<SkPaint>, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn clear_background_color( &mut self, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn decoration(&self) -> &Decoration
pub fn decoration_type(&self) -> TextDecoration
pub fn decoration_mode(&self) -> skia_textlayout_TextDecorationMode
pub fn decoration_color(&self) -> Color
pub fn decoration_style(&self) -> skia_textlayout_TextDecorationStyle
pub fn decoration_thickness_multiplier(&self) -> f32
pub fn set_decoration(&mut self, decoration: &Decoration)
pub fn set_decoration_type(&mut self, decoration: TextDecoration)
pub fn set_decoration_mode(&mut self, mode: skia_textlayout_TextDecorationMode)
pub fn set_decoration_style( &mut self, style: skia_textlayout_TextDecorationStyle, )
pub fn set_decoration_color(&mut self, color: impl Into<Color>)
pub fn set_decoration_thickness_multiplier(&mut self, multiplier: f32)
pub fn decoration_mut(&mut self) -> &mut Decoration
pub fn font_style(&self) -> FontStyle
pub fn set_font_style( &mut self, font_style: FontStyle, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn shadows(&self) -> &[TextShadow]
pub fn add_shadow( &mut self, shadow: TextShadow, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn reset_shadows(&mut self) -> &mut Handle<skia_textlayout_TextStyle>
pub fn font_features(&self) -> &[Handle<skia_textlayout_FontFeature>]
pub fn add_font_feature(&mut self, font_feature: impl AsRef<str>, value: i32)
pub fn reset_font_features(&mut self)
pub fn font_arguments(&self) -> Option<&Handle<skia_textlayout_FontArguments>>
pub fn set_font_arguments<'fa>(
&mut self,
arguments: impl Into<Option<&'fa FontArguments<'fa, 'fa>>>,
)
pub fn set_font_arguments<'fa>( &mut self, arguments: impl Into<Option<&'fa FontArguments<'fa, 'fa>>>, )
The contents of the crate::FontArguments
will be copied into the TextStyle
.
pub fn font_size(&self) -> f32
pub fn set_font_size( &mut self, size: f32, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn font_families(&self) -> FontFamilies<'_>
pub fn set_font_families( &mut self, families: &[impl AsRef<str>], ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn baseline_shift(&self) -> f32
pub fn set_baseline_shift( &mut self, baseline_shift: f32, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn set_height( &mut self, height: f32, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn height(&self) -> f32
pub fn set_height_override( &mut self, height_override: bool, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn height_override(&self) -> bool
pub fn set_half_leading( &mut self, half_leading: bool, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn half_leading(&self) -> bool
pub fn set_letter_spacing( &mut self, letter_spacing: f32, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn letter_spacing(&self) -> f32
pub fn set_word_spacing( &mut self, word_spacing: f32, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn word_spacing(&self) -> f32
pub fn typeface(&self) -> Option<RCHandle<SkTypeface>>
pub fn set_typeface( &mut self, typeface: impl Into<Option<RCHandle<SkTypeface>>>, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn locale(&self) -> &str
pub fn set_locale( &mut self, locale: impl AsRef<str>, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn text_baseline(&self) -> skia_textlayout_TextBaseline
pub fn set_text_baseline( &mut self, baseline: skia_textlayout_TextBaseline, ) -> &mut Handle<skia_textlayout_TextStyle>
pub fn font_metrics(&self) -> FontMetrics
pub fn is_placeholder(&self) -> bool
pub fn set_placeholder(&mut self) -> &mut Handle<skia_textlayout_TextStyle>
§impl Handle<SkCustomTypefaceBuilder>
impl Handle<SkCustomTypefaceBuilder>
pub fn new() -> Handle<SkCustomTypefaceBuilder>
pub fn set_glyph<'a>( &mut self, glyph_id: u16, advance: f32, typeface_glyph: impl Into<TypefaceGlyph<'a>>, ) -> &mut Handle<SkCustomTypefaceBuilder>
pub fn set_metrics( &mut self, font_metrics: &FontMetrics, scale: impl Into<Option<f32>>, ) -> &mut Handle<SkCustomTypefaceBuilder>
pub fn set_font_style( &mut self, font_style: FontStyle, ) -> &mut Handle<SkCustomTypefaceBuilder>
pub fn detach(&mut self) -> Option<RCHandle<SkTypeface>>
pub const FACTORY_ID: FourByteTag = _
pub fn from_data( data: impl Into<RCHandle<SkData>>, font_arguments: &FontArguments<'_, '_>, ) -> Option<RCHandle<SkTypeface>>
Trait Implementations§
§impl Combine<Handle<SkRegion>, Handle<SkRegion>> for Handle<SkRegion>
impl Combine<Handle<SkRegion>, Handle<SkRegion>> for Handle<SkRegion>
fn combine( a: &Handle<SkRegion>, op: SkRegion_Op, b: &Handle<SkRegion>, ) -> Handle<SkRegion>
fn difference(a: &A, b: &B) -> Self
fn intersect(a: &A, b: &B) -> Self
fn xor(a: &A, b: &B) -> Self
fn union(a: &A, b: &B) -> Self
fn reverse_difference(a: &A, b: &B) -> Self
fn replace(a: &A, b: &B) -> Self
§impl Combine<Handle<SkRegion>, IRect> for Handle<SkRegion>
impl Combine<Handle<SkRegion>, IRect> for Handle<SkRegion>
fn combine( region: &Handle<SkRegion>, op: SkRegion_Op, rect: &IRect, ) -> Handle<SkRegion>
fn difference(a: &A, b: &B) -> Self
fn intersect(a: &A, b: &B) -> Self
fn xor(a: &A, b: &B) -> Self
fn union(a: &A, b: &B) -> Self
fn reverse_difference(a: &A, b: &B) -> Self
fn replace(a: &A, b: &B) -> Self
§impl Combine<IRect, Handle<SkRegion>> for Handle<SkRegion>
impl Combine<IRect, Handle<SkRegion>> for Handle<SkRegion>
fn combine( rect: &IRect, op: SkRegion_Op, region: &Handle<SkRegion>, ) -> Handle<SkRegion>
fn difference(a: &A, b: &B) -> Self
fn intersect(a: &A, b: &B) -> Self
fn xor(a: &A, b: &B) -> Self
fn union(a: &A, b: &B) -> Self
fn reverse_difference(a: &A, b: &B) -> Self
fn replace(a: &A, b: &B) -> Self
§impl<'a> From<&'a Handle<SkPath>> for TypefaceGlyph<'a>
impl<'a> From<&'a Handle<SkPath>> for TypefaceGlyph<'a>
§fn from(path: &'a Handle<SkPath>) -> TypefaceGlyph<'a>
fn from(path: &'a Handle<SkPath>) -> TypefaceGlyph<'a>
§impl From<FontArguments<'_, '_>> for Handle<skia_textlayout_FontArguments>
impl From<FontArguments<'_, '_>> for Handle<skia_textlayout_FontArguments>
§fn from(fa: FontArguments<'_, '_>) -> Handle<skia_textlayout_FontArguments>
fn from(fa: FontArguments<'_, '_>) -> Handle<skia_textlayout_FontArguments>
§impl Intersects<Handle<SkRegion>> for Handle<SkRegion>
impl Intersects<Handle<SkRegion>> for Handle<SkRegion>
fn intersects(&self, other: &Handle<SkRegion>) -> bool
§impl Intersects<IRect> for Handle<SkRegion>
impl Intersects<IRect> for Handle<SkRegion>
fn intersects(&self, rect: &IRect) -> bool
§impl Iterator for Handle<SkContourMeasureIter>
impl Iterator for Handle<SkContourMeasureIter>
§fn next(&mut self) -> Option<<Handle<SkContourMeasureIter> as Iterator>::Item>
fn next(&mut self) -> Option<<Handle<SkContourMeasureIter> as Iterator>::Item>
source§fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
iter_next_chunk
)N
values. Read more1.0.0 · source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
1.0.0 · source§fn count(self) -> usizewhere
Self: Sized,
fn count(self) -> usizewhere
Self: Sized,
1.0.0 · source§fn last(self) -> Option<Self::Item>where
Self: Sized,
fn last(self) -> Option<Self::Item>where
Self: Sized,
source§fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
)n
elements. Read more1.0.0 · source§fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 · source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
1.0.0 · source§fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
1.0.0 · source§fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
source§fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
)separator
between adjacent
items of the original iterator. Read moresource§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
)separator
between adjacent items of the original iterator. Read more1.0.0 · source§fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.0.0 · source§fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 · source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 · source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
1.0.0 · source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 · source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 · source§fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 · source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
elements. Read more1.0.0 · source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
elements, or fewer
if the underlying iterator ends sooner. Read more1.0.0 · source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
source§fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
iter_map_windows
)f
for each contiguous window of size N
over
self
and returns an iterator over the outputs of f
. Like slice::windows()
,
the windows during mapping overlap as well. Read more1.0.0 · source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
source§fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
)1.0.0 · source§fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
source§fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
)true
precede all those that return false
. Read more1.27.0 · source§fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
1.27.0 · source§fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 · source§fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 · source§fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
source§fn try_reduce<R>(
&mut self,
f: impl FnMut(Self::Item, Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>( &mut self, f: impl FnMut(Self::Item, Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
)1.0.0 · source§fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 · source§fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 · source§fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 · source§fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
source§fn try_find<R>(
&mut self,
f: impl FnMut(&Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>( &mut self, f: impl FnMut(&Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
)1.0.0 · source§fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.6.0 · source§fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · source§fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 · source§fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · source§fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 · source§fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 · source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
source§fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
iter_array_chunks
)N
elements of the iterator at a time. Read more1.11.0 · source§fn product<P>(self) -> P
fn product<P>(self) -> P
source§fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read more1.5.0 · source§fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of
this Iterator
with those of another. The comparison works like short-circuit
evaluation, returning a result without comparing the remaining elements.
As soon as an order can be determined, the evaluation stops and a result is returned. Read moresource§fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read moresource§fn eq_by<I, F>(self, other: I, eq: F) -> bool
fn eq_by<I, F>(self, other: I, eq: F) -> bool
iter_order_by
)1.5.0 · source§fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically
less than those of another. Read more1.5.0 · source§fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically
less or equal to those of another. Read more1.5.0 · source§fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than those of another. Read more1.5.0 · source§fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than or equal to those of another. Read more1.82.0 · source§fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 · source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
§impl PartialEq for Handle<skia_textlayout_FontFeature>
impl PartialEq for Handle<skia_textlayout_FontFeature>
§impl QuickReject<Handle<SkPath>> for Canvas
impl QuickReject<Handle<SkPath>> for Canvas
§fn quick_reject(&self, path: &Handle<SkPath>) -> bool
fn quick_reject(&self, path: &Handle<SkPath>) -> bool
Returns true
if path
, transformed by Matrix
, can be quickly determined to be
outside of clip. May return false
even though path
is outside of clip.
Use to check if an area to be drawn is clipped out, to skip subsequent draw calls.
§impl QuickReject<Handle<SkRegion>> for Handle<SkRegion>
impl QuickReject<Handle<SkRegion>> for Handle<SkRegion>
fn quick_reject(&self, other: &Handle<SkRegion>) -> bool
§impl QuickReject<IRect> for Handle<SkRegion>
impl QuickReject<IRect> for Handle<SkRegion>
fn quick_reject(&self, rect: &IRect) -> bool
§impl<N> RefWrapper<N> for Handle<N>where
N: NativeDrop,
impl<N> RefWrapper<N> for Handle<N>where
N: NativeDrop,
§impl<N> ValueWrapper<N> for Handle<N>where
N: NativeDrop,
impl<N> ValueWrapper<N> for Handle<N>where
N: NativeDrop,
impl Send for Handle<GrBackendDrawableInfo>
impl Send for Handle<GrBackendFormat>
impl Send for Handle<GrBackendRenderTarget>
impl Send for Handle<GrGLExtensions>
impl Send for Handle<GrYUVABackendTextureInfo>
impl Send for Handle<GrYUVABackendTextures>
impl Send for Handle<SkCodecs_Decoder>
impl Send for Handle<SkColorInfo>
impl Send for Handle<SkColorMatrix>
impl Send for Handle<SkContourMeasureIter>
impl Send for Handle<SkCustomTypefaceBuilder>
impl Send for Handle<SkFont>
impl Send for Handle<SkImageInfo>
impl Send for Handle<SkOpBuilder>
impl Send for Handle<SkPDF_AttributeList>
impl Send for Handle<SkPaint>
impl Send for Handle<SkPath>
impl Send for Handle<SkPathBuilder>
impl Send for Handle<SkRegion>
impl Send for Handle<SkRuntimeEffect_Child>
impl Send for Handle<SkRuntimeEffect_Uniform>
impl Send for Handle<SkString>
impl Send for Handle<SkStrings>
impl Send for Handle<SkStrokeRec>
impl Send for Handle<SkTextBlobBuilder>
impl Send for Handle<SkVertices_Builder>
impl Send for Handle<SkYUVAInfo>
impl Send for Handle<SkYUVAPixmapInfo>
impl Send for Handle<SkYUVAPixmapInfo_SupportedDataTypes>
impl Send for Handle<SkYUVAPixmaps>
impl Send for Handle<skia_textlayout_FontArguments>
impl Send for Handle<skia_textlayout_FontFeature>
impl Send for Handle<skia_textlayout_StrutStyle>
impl Send for Handle<skia_textlayout_TextStyle>
impl Sync for Handle<GrBackendDrawableInfo>
impl Sync for Handle<GrBackendFormat>
impl Sync for Handle<GrBackendRenderTarget>
impl Sync for Handle<GrGLExtensions>
impl Sync for Handle<GrYUVABackendTextureInfo>
impl Sync for Handle<GrYUVABackendTextures>
impl Sync for Handle<SkCodecs_Decoder>
impl Sync for Handle<SkColorInfo>
impl Sync for Handle<SkColorMatrix>
impl Sync for Handle<SkContourMeasureIter>
impl Sync for Handle<SkCustomTypefaceBuilder>
impl Sync for Handle<SkFont>
impl Sync for Handle<SkImageInfo>
impl Sync for Handle<SkOpBuilder>
impl Sync for Handle<SkPDF_AttributeList>
impl Sync for Handle<SkPaint>
impl Sync for Handle<SkPath>
impl Sync for Handle<SkPathBuilder>
impl Sync for Handle<SkRegion>
impl Sync for Handle<SkRuntimeEffect_Child>
impl Sync for Handle<SkRuntimeEffect_Uniform>
impl Sync for Handle<SkString>
impl Sync for Handle<SkStrings>
impl Sync for Handle<SkStrokeRec>
impl Sync for Handle<SkTextBlobBuilder>
impl Sync for Handle<SkVertices_Builder>
impl Sync for Handle<SkYUVAInfo>
impl Sync for Handle<SkYUVAPixmapInfo>
impl Sync for Handle<SkYUVAPixmapInfo_SupportedDataTypes>
impl Sync for Handle<SkYUVAPixmaps>
impl Sync for Handle<skia_textlayout_FontArguments>
impl Sync for Handle<skia_textlayout_FontFeature>
impl Sync for Handle<skia_textlayout_StrutStyle>
impl Sync for Handle<skia_textlayout_TextStyle>
Auto Trait Implementations§
impl<N> Freeze for Handle<N>where
N: Freeze,
impl<N> RefUnwindSafe for Handle<N>where
N: RefUnwindSafe,
impl<N> !Send for Handle<N>
impl<N> !Sync for Handle<N>
impl<N> Unpin for Handle<N>where
N: Unpin,
impl<N> UnwindSafe for Handle<N>where
N: UnwindSafe,
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.