pub struct RefHandle<N: NativeDrop>(/* private fields */);Expand description
A wrapper type that represents a native type with a pointer to the native object.
Implementations§
Source§impl RefHandle<SkDrawable_GpuDrawHandler>
impl RefHandle<SkDrawable_GpuDrawHandler>
pub fn draw(&mut self, info: &BackendDrawableInfo)
Source§impl RefHandle<SkImageGenerator>
impl RefHandle<SkImageGenerator>
pub fn unique_id(&self) -> u32
pub fn encoded_data(&mut self) -> Option<Data>
pub fn info(&self) -> &ImageInfo
pub fn is_valid(&self, recorder: Option<&mut dyn Recorder>) -> bool
pub fn is_protected(self) -> bool
pub fn get_pixels( &mut self, info: &ImageInfo, pixels: &mut [u8], row_bytes: usize, ) -> bool
pub fn query_yuva_info( &self, supported_data_types: &SupportedDataTypes, ) -> Option<YUVAPixmapInfo>
pub fn is_texture_generator(&self) -> bool
pub fn from_encoded(_encoded: impl Into<Data>) -> Option<Self>
None. Use Image::deferred_from_encoded_data() or Codec::from_data()Source§impl RefHandle<SkPathBuilder>
impl RefHandle<SkPathBuilder>
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs an empty PathBuilder. By default, PathBuilder has no verbs, no Point, and
no weights. PathFillType is set to [PathFillType::Winding].
§Returns
empty PathBuilder
Sourcepub fn new_with_fill_type(fill_type: PathFillType) -> Self
pub fn new_with_fill_type(fill_type: PathFillType) -> Self
Constructs an empty PathBuilder with the given PathFillType. By default, PathBuilder has no
verbs, no Point, and no weights.
fill_type:PathFillTypeto set on thePathBuilder.
§Returns
empty PathBuilder
Sourcepub fn new_path(path: &Path) -> Self
pub fn new_path(path: &Path) -> Self
Constructs a PathBuilder that is a copy of an existing Path.
Copies the PathFillType and replays all of the verbs from the Path into the PathBuilder.
path:Pathto copy
§Returns
Sourcepub fn fill_type(&self) -> PathFillType
pub fn fill_type(&self) -> PathFillType
Sourcepub fn compute_finite_bounds(&self) -> Option<Rect>
pub fn compute_finite_bounds(&self) -> Option<Rect>
Returns minimum and maximum axes values of Point array.
Returns None if PathBuilder contains no points.
Rect returned includes all Point added to PathBuilder, including Point associated
with [PathVerb::Move] that define empty contours.
If any of the points are non-finite, returns None.
§Returns
Sourcepub fn compute_tight_bounds(&self) -> Option<Rect>
pub fn compute_tight_bounds(&self) -> Option<Rect>
Like Self::compute_finite_bounds() but returns a ‘tight’ bounds, meaning when there are curve
segments, this computes the X/Y limits of the curve itself, not the curve’s control
point(s). For a polygon, this returns the same as Self::compute_finite_bounds().
Sourcepub fn compute_bounds(&self) -> Rect
👎Deprecated since 0.91.0: Use compute_finite_bounds() instead
pub fn compute_bounds(&self) -> Rect
Sourcepub fn snapshot(&self) -> Path
pub fn snapshot(&self) -> Path
Returns a Path representing the current state of the PathBuilder. The builder is
unchanged after returning the path.
§Returns
Path representing the current state of the builder.
Sourcepub fn snapshot_and_transform<'m>(
&self,
mx: impl Into<Option<&'m Matrix>>,
) -> Path
pub fn snapshot_and_transform<'m>( &self, mx: impl Into<Option<&'m Matrix>>, ) -> Path
Returns a Path representing the current state of the PathBuilder. The builder is
unchanged after returning the path.
mx: if present, applied to the points after they are copied into the resulting path.
§Returns
Path representing the current state of the builder.
Sourcepub fn detach(&mut self) -> Path
pub fn detach(&mut self) -> Path
Returns a Path representing the current state of the PathBuilder. The builder is
reset to empty after returning the path.
§Returns
Path representing the current state of the builder.
Sourcepub fn detach_and_transform<'m>(
&mut self,
mx: impl Into<Option<&'m Matrix>>,
) -> Path
pub fn detach_and_transform<'m>( &mut self, mx: impl Into<Option<&'m Matrix>>, ) -> Path
Returns a Path representing the current state of the PathBuilder. The builder is
reset to empty after returning the path.
mx: if present, applied to the points after they are copied into the resulting path.
§Returns
Path representing the current state of the builder.
Sourcepub fn set_fill_type(&mut self, ft: PathFillType) -> &mut Self
pub fn set_fill_type(&mut self, ft: PathFillType) -> &mut Self
Sets PathFillType, the rule used to fill Path. While there is no
check that ft is legal, values outside of PathFillType are not supported.
ft:PathFillTypeto be used byPaths generated from this builder.
§Returns
reference to PathBuilder
Sourcepub fn set_is_volatile(&mut self, is_volatile: bool) -> &mut Self
pub fn set_is_volatile(&mut self, is_volatile: bool) -> &mut Self
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
Skia to attach a cache of data which speeds repeated drawing.
Mark temporary paths, discarded or modified after use, as volatile to inform Skia that the path need not be cached.
Mark animating Path volatile to improve performance.
Mark unchanging Path non-volatile to improve repeated rendering.
raster surface Path draws are affected by volatile for some shadows.
GPU surface Path draws are affected by volatile for some shadows and concave geometries.
is_volatile: true if caller will alterPathafter drawing
§Returns
reference to PathBuilder
Sourcepub fn reset(&mut self) -> &mut Self
pub fn reset(&mut self) -> &mut Self
Sets PathBuilder to its initial state.
Removes verb array, Point array, and weights, and sets PathFillType to [PathFillType::Winding].
Internal storage associated with PathBuilder is preserved.
§Returns
reference to PathBuilder
Sourcepub fn move_to(&mut self, pt: impl Into<Point>) -> &mut Self
pub fn move_to(&mut self, pt: impl Into<Point>) -> &mut Self
Specifies the beginning of contour. If the previous verb was a “move” verb, then this just replaces the point value of that move, otherwise it appends a new “move” verb to the builder using the point.
Thus, each contour can only have 1 move verb in it (the last one specified).
Sourcepub fn line_to(&mut self, pt: impl Into<Point>) -> &mut Self
pub fn line_to(&mut self, pt: impl Into<Point>) -> &mut Self
Adds line from last point to Point p. If PathBuilder is empty, or last PathVerb is
[PathVerb::Close], last point is set to (0, 0) before adding line.
line_to() first appends [PathVerb::Move] to verb array and (0, 0) to Point array, if needed.
line_to() then appends [PathVerb::Line] to verb array and Point p to Point array.
pt: endPointof added line
§Returns
reference to PathBuilder
Sourcepub fn quad_to(
&mut self,
p1: impl Into<Point>,
p2: impl Into<Point>,
) -> &mut Self
pub fn quad_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, ) -> &mut Self
Adds quad from last point towards Point p1, to Point p2.
If PathBuilder is empty, or last PathVerb is [PathVerb::Close], last point is set to (0, 0)
before adding quad.
Appends [PathVerb::Move] to verb array and (0, 0) to Point array, if needed;
then appends [PathVerb::Quad] to verb array; and Point p1, p2
to Point array.
§Returns
reference to PathBuilder
Sourcepub fn conic_to(
&mut self,
p1: impl Into<Point>,
p2: impl Into<Point>,
w: scalar,
) -> &mut Self
pub fn conic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, w: scalar, ) -> &mut Self
Adds conic from last point towards pt1, to pt2, weighted by w.
If PathBuilder is empty, or last PathVerb is [PathVerb::Close], last point is set to (0, 0)
before adding conic.
Appends [PathVerb::Move] to verb array and (0, 0) to Point array, if needed.
If w is finite and not one, appends [PathVerb::Conic] to verb array;
and pt1, pt2 to Point array; and w to conic weights.
If w is one, appends [PathVerb::Quad] to verb array, and
pt1, pt2 to Point array.
If w is not finite, appends [PathVerb::Line] twice to verb array, and
pt1, pt2 to Point array.
§Returns
reference to PathBuilder
Sourcepub fn cubic_to(
&mut self,
p1: impl Into<Point>,
p2: impl Into<Point>,
p3: impl Into<Point>,
) -> &mut Self
pub fn cubic_to( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, p3: impl Into<Point>, ) -> &mut Self
Adds cubic from last point towards Point p1, then towards Point p2, ending at
Point p3. If PathBuilder is empty, or last PathVerb is [PathVerb::Close], last point is
set to (0, 0) before adding cubic.
Appends [PathVerb::Move] to verb array and (0, 0) to Point array, if needed;
then appends [PathVerb::Cubic] to verb array; and Point p1, p2, p3
to Point array.
§Returns
reference to PathBuilder
Sourcepub fn close(&mut self) -> &mut Self
pub fn close(&mut self) -> &mut Self
Appends [PathVerb::Close] to PathBuilder. A closed contour connects the first and last Point
with line, forming a continuous loop. Open and closed contour draw the same
with crate::PaintStyle::Fill. With crate::PaintStyle::Stroke, open contour draws
crate::PaintCap at contour start and end; closed contour draws
crate::PaintJoin at contour start and end.
close() has no effect if PathBuilder is empty or last PathVerb is [PathVerb::Close].
§Returns
reference to PathBuilder
Sourcepub fn polyline_to(&mut self, points: &[Point]) -> &mut Self
pub fn polyline_to(&mut self, points: &[Point]) -> &mut Self
Sourcepub fn r_move_to(&mut self, pt: impl Into<Point>) -> &mut Self
pub fn r_move_to(&mut self, pt: impl Into<Point>) -> &mut Self
Adds beginning of contour relative to last point.
If PathBuilder is empty, starts contour at (dx, dy).
Otherwise, start contour at last point offset by (dx, dy).
Function name stands for “relative move to”.
pt: vector offset from last point to contour start
§Returns
reference to PathBuilder
Sourcepub fn r_line_to(&mut self, pt: impl Into<Point>) -> &mut Self
pub fn r_line_to(&mut self, pt: impl Into<Point>) -> &mut Self
Adds line from last point to vector given by pt. If PathBuilder is empty, or last
PathVerb is [PathVerb::Close], last point is set to (0, 0) before adding line.
Appends [PathVerb::Move] to verb array and (0, 0) to Point array, if needed;
then appends [PathVerb::Line] to verb array and line end to Point array.
Line end is last point plus vector given by pt.
Function name stands for “relative line to”.
pt: vector offset from last point to line end
§Returns
reference to PathBuilder
Sourcepub fn r_quad_to(
&mut self,
pt1: impl Into<Point>,
pt2: impl Into<Point>,
) -> &mut Self
pub fn r_quad_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, ) -> &mut Self
Adds quad from last point towards vector pt1, to vector pt2.
If PathBuilder is empty, or last PathVerb
is [PathVerb::Close], last point is set to (0, 0) before adding quad.
Appends [PathVerb::Move] to verb array and (0, 0) to Point array,
if needed; then appends [PathVerb::Quad] to verb array; and appends quad
control and quad end to Point array.
Quad control is last point plus vector pt1.
Quad end is last point plus vector pt2.
Function name stands for “relative quad to”.
pt1: offset vector from last point to quad controlpt2: offset vector from last point to quad end
§Returns
reference to PathBuilder
Sourcepub fn r_conic_to(
&mut self,
pt1: impl Into<Point>,
pt2: impl Into<Point>,
w: scalar,
) -> &mut Self
pub fn r_conic_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, w: scalar, ) -> &mut Self
Adds conic from last point towards vector p1, to vector p2,
weighted by w. If PathBuilder is empty, or last PathVerb
is [PathVerb::Close], last point is set to (0, 0) before adding conic.
Appends [PathVerb::Move] to verb array and (0, 0) to Point array,
if needed.
If w is finite and not one, next appends [PathVerb::Conic] to verb array,
and w is recorded as conic weight; otherwise, if w is one, appends
[PathVerb::Quad] to verb array; or if w is not finite, appends [PathVerb::Line]
twice to verb array.
In all cases appends Point control and end to Point array.
control is last point plus vector p1.
end is last point plus vector p2.
Function name stands for “relative conic to”.
pt1: offset vector from last point to conic controlpt2: offset vector from last point to conic endw: weight of added conic
§Returns
reference to PathBuilder
Sourcepub fn r_cubic_to(
&mut self,
pt1: impl Into<Point>,
pt2: impl Into<Point>,
pt3: impl Into<Point>,
) -> &mut Self
pub fn r_cubic_to( &mut self, pt1: impl Into<Point>, pt2: impl Into<Point>, pt3: impl Into<Point>, ) -> &mut Self
Adds cubic from last point towards vector pt1, then towards
vector pt2, to vector pt3.
If PathBuilder is empty, or last PathVerb
is [PathVerb::Close], last point is set to (0, 0) before adding cubic.
Appends [PathVerb::Move] to verb array and (0, 0) to Point array,
if needed; then appends [PathVerb::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”.
pt1: offset vector from last point to first cubic controlpt2: offset vector from last point to second cubic controlpt3: offset vector from last point to cubic end
§Returns
reference to PathBuilder
Sourcepub fn r_arc_to(
&mut self,
r: impl Into<Vector>,
x_axis_rotate: scalar,
large_arc: ArcSize,
sweep: PathDirection,
dxdy: impl Into<Vector>,
) -> &mut Self
pub fn r_arc_to( &mut self, r: impl Into<Vector>, x_axis_rotate: scalar, large_arc: ArcSize, sweep: PathDirection, dxdy: impl Into<Vector>, ) -> &mut Self
Appends arc to PathBuilder, relative to last Path Point. Arc is implemented by one or
more conic, weighted to describe part of oval with radii (rx, ry) rotated by
x_axis_rotate degrees. Arc curves from last PathBuilder Point to relative end Point:
(dx, dy), choosing one of four possible routes: clockwise or
counterclockwise, and smaller or larger. If PathBuilder 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
[PathDirection::CW] cast to int is zero.
r: radii on axes 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 arcdxdy: offset end of arc from lastPathpoint
§Returns
reference to PathBuilder
Sourcepub fn arc_to(
&mut self,
oval: impl AsRef<Rect>,
start_angle_deg: scalar,
sweep_angle_deg: scalar,
force_move_to: bool,
) -> &mut Self
pub fn arc_to( &mut self, oval: impl AsRef<Rect>, start_angle_deg: scalar, sweep_angle_deg: scalar, force_move_to: bool, ) -> &mut Self
Appends arc to the builder. 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 the builder’s last point to initial arc point if force_move_to
is false and the builder 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_deg: starting angle of arc in degreessweep_angle_deg: sweep, in degrees. Positive is clockwise; treated modulo 360force_move_to: true to start a new contour with arc
§Returns
reference to the builder
Sourcepub fn arc_to_tangent(
&mut self,
p1: impl Into<Point>,
p2: impl Into<Point>,
radius: scalar,
) -> &mut Self
pub fn arc_to_tangent( &mut self, p1: impl Into<Point>, p2: impl Into<Point>, radius: scalar, ) -> &mut Self
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 p1, and tangent from p1 to p2. 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 p1 to p2 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 p1.
arc_to() appends at most one line and one conic.
arc_to() implements the functionality of PostScript arct and HTML Canvas arcTo.
p1:Pointcommon to pair of tangentsp2: end of second tangentradius: distance from arc to circle center
§Returns
reference to PathBuilder
Sourcepub fn arc_to_radius(
&mut self,
r: impl Into<Point>,
x_axis_rotate: scalar,
large_arc: ArcSize,
sweep: PathDirection,
xy: impl Into<Point>,
) -> &mut Self
pub fn arc_to_radius( &mut self, r: impl Into<Point>, x_axis_rotate: scalar, large_arc: ArcSize, sweep: PathDirection, xy: impl Into<Point>, ) -> &mut Self
Appends arc to Path. Arc is implemented by one or more conic weighted to describe
part of oval with radii (r.fX, r.fY) rotated by x_axis_rotate degrees. Arc curves
from last Path Point to (xy.fX, xy.fY), choosing one of four possible routes:
clockwise or counterclockwise,
and smaller or larger.
Arc sweep is always less than 360 degrees. arc_to_radius() appends line to xy if either
radii are zero, or if last Path Point equals (xy.fX, xy.fY). arc_to_radius() scales radii r to
fit last Path Point and xy if both are greater than zero but too small to describe
an arc.
arc_to_radius() appends up to four conic curves.
arc_to_radius() 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
[PathDirection::CW] cast to int is zero.
r: radii on axes 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 arcxy: end of arc
§Returns
reference to PathBuilder
Sourcepub fn add_arc(
&mut self,
oval: impl AsRef<Rect>,
start_angle_deg: scalar,
sweep_angle_deg: scalar,
) -> &mut Self
pub fn add_arc( &mut self, oval: impl AsRef<Rect>, start_angle_deg: scalar, sweep_angle_deg: scalar, ) -> &mut Self
Appends arc to the builder, 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_deg: starting angle of arc in degreessweep_angle_deg: sweep, in degrees. Positive is clockwise; treated modulo 360
§Returns
reference to this builder
pub fn add_line( &mut self, a: impl Into<Point>, b: impl Into<Point>, ) -> &mut Self
Sourcepub fn add_rect(
&mut self,
rect: impl AsRef<Rect>,
dir: impl Into<Option<PathDirection>>,
start_index: impl Into<Option<usize>>,
) -> &mut Self
pub fn add_rect( &mut self, rect: impl AsRef<Rect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self
Adds a new contour to the PathBuilder, defined by the rect, and wound in the
specified direction. The verbs added to the path will be:
[PathVerb::Move], [PathVerb::Line], [PathVerb::Line], [PathVerb::Line], [PathVerb::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(...)rect:Rectto add as a closed contourdir:PathDirectionto orient the new contourstart_index: initial corner ofRectto add
§Returns
reference to PathBuilder
Sourcepub fn add_oval(
&mut self,
rect: impl AsRef<Rect>,
dir: impl Into<Option<PathDirection>>,
start_index: impl Into<Option<usize>>,
) -> &mut Self
pub fn add_oval( &mut self, rect: impl AsRef<Rect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self
Adds oval to PathBuilder, appending [PathVerb::Move], four [PathVerb::Conic], and [PathVerb::Close].
Oval is upright ellipse bounded by Rect oval with radii equal to half oval width
and half oval height. Oval begins at (oval.right, oval.center_y()) and continues
clockwise if dir is [PathDirection::CW], counterclockwise if dir is [PathDirection::CCW].
rect: bounds of ellipse addeddir:PathDirectionto wind ellipsestart_index: index of initial point of ellipse
§Returns
reference to PathBuilder
Sourcepub fn add_rrect(
&mut self,
rect: impl AsRef<RRect>,
dir: impl Into<Option<PathDirection>>,
start_index: impl Into<Option<usize>>,
) -> &mut Self
pub fn add_rrect( &mut self, rect: impl AsRef<RRect>, dir: impl Into<Option<PathDirection>>, start_index: impl Into<Option<usize>>, ) -> &mut Self
Appends RRect to PathBuilder, creating a new closed contour. If dir is [PathDirection::CW],
RRect winds clockwise. If dir is [PathDirection::CCW], RRect winds counterclockwise.
After appending, PathBuilder may be empty, or may contain: Rect, oval, or RRect.
rect:RRectto adddir:PathDirectionto windRRectstart_index: index of initial point ofRRect
§Returns
reference to PathBuilder
Sourcepub fn add_circle(
&mut self,
center: impl Into<Point>,
radius: scalar,
dir: impl Into<Option<PathDirection>>,
) -> &mut Self
pub fn add_circle( &mut self, center: impl Into<Point>, radius: scalar, dir: impl Into<Option<PathDirection>>, ) -> &mut Self
Adds circle centered at (x, y) of size radius to PathBuilder, appending [PathVerb::Move],
four [PathVerb::Conic], and [PathVerb::Close]. Circle begins at: (x + radius, y), continuing
clockwise if dir is [PathDirection::CW], and counterclockwise if dir is [PathDirection::CCW].
Has no effect if radius is zero or negative.
center: center of circleradius: distance from center to edgedir:PathDirectionto wind circle
§Returns
reference to PathBuilder
Sourcepub fn add_polygon(&mut self, pts: &[Point], close: bool) -> &mut Self
pub fn add_polygon(&mut self, pts: &[Point], close: bool) -> &mut Self
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 array. If close is true, appends [PathVerb::Close] to Path, connecting
pts[count - 1] and pts[0].
pts: array of line sharing end and startPointclose: true to add line connecting contour end and start
§Returns
reference to PathBuilder
Sourcepub fn add_path(&mut self, path: &Path) -> &mut Self
pub fn add_path(&mut self, path: &Path) -> &mut Self
Appends src to PathBuilder, offset by (dx, dy).
If mode is path::AddPathMode::Append, src verb array, Point array, and conic weights are
added unaltered. If mode is path::AddPathMode::Extend, add line before appending
verbs, Point, and conic weights.
§Returns
reference to PathBuilder
Sourcepub fn add_path_with_transform(
&mut self,
src: &Path,
matrix: &Matrix,
mode: impl Into<Option<AddPathMode>>,
)
pub fn add_path_with_transform( &mut self, src: &Path, matrix: &Matrix, mode: impl Into<Option<AddPathMode>>, )
Appends src to PathBuilder, transformed by matrix. Transformed curves may have different
verbs, Point, and conic weights.
If mode is path::AddPathMode::Append, src verb array, Point array, and conic weights are
added unaltered. If mode is path::AddPathMode::Extend, add line before appending
verbs, Point, and conic weights.
src:Pathverbs,Point, and conic weights to addmatrix: transform applied to srcmode:path::AddPathMode::Appendorpath::AddPathMode::Extend
Sourcepub fn inc_reserve(
&mut self,
extra_pt_count: usize,
extra_verb_count: usize,
extra_conic_count: usize,
)
pub fn inc_reserve( &mut self, extra_pt_count: usize, extra_verb_count: usize, extra_conic_count: usize, )
Grows PathBuilder verb array and Point array to contain additional space.
May improve performance and use less memory by
reducing the number and size of allocations when creating PathBuilder.
extra_pt_count: number of additionalPointto allocateextra_verb_count: number of additional verbsextra_conic_count: number of additional conic weights
Sourcepub fn offset(&mut self, d: impl Into<Vector>) -> &mut Self
pub fn offset(&mut self, d: impl Into<Vector>) -> &mut Self
Offsets Point array by (dx, dy).
d: offset added toPointarray coordinates
§Returns
reference to PathBuilder
Sourcepub fn transform(&mut self, matrix: &Matrix) -> &mut Self
pub fn transform(&mut self, matrix: &Matrix) -> &mut Self
Transforms verb array, Point array, and weight by matrix.
transform may change verbs and increase their number.
§Returns
reference to PathBuilder
Sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
Returns true if the builder is empty, or all of its points are finite.
Sourcepub fn toggle_inverse_fill_type(&mut self) -> &mut Self
pub fn toggle_inverse_fill_type(&mut self) -> &mut Self
Replaces PathFillType with its inverse. The inverse of PathFillType describes the area
unmodified by the original PathFillType.
§Returns
reference to PathBuilder
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns if Path is empty.
Empty PathBuilder may have PathFillType but has no Point, PathVerb, or conic weight.
PathBuilder::new() constructs empty PathBuilder; reset() and rewind() make Path empty.
§Returns
true if the path contains no PathVerb array
Sourcepub fn get_last_pt(&self) -> Option<Point>
pub fn get_last_pt(&self) -> Option<Point>
Sourcepub fn set_point(&mut self, index: usize, p: impl Into<Point>)
pub fn set_point(&mut self, index: usize, p: impl Into<Point>)
Change the point at the specified index (see count_points()).
If index is out of range, the call does nothing.
index: which point to replacep: the new point value
Sourcepub fn set_last_pt(&mut self, p: impl Into<Point>)
pub fn set_last_pt(&mut self, p: impl Into<Point>)
Sourcepub fn count_points(&self) -> usize
pub fn count_points(&self) -> usize
Returns the number of points in PathBuilder.
Point count is initially zero.
§Returns
PathBuilder Point array length
Sourcepub fn is_inverse_fill_type(&self) -> bool
pub fn is_inverse_fill_type(&self) -> bool
Returns if PathFillType describes area outside Path geometry. The inverse fill area
extends indefinitely.
§Returns
true if PathFillType is [PathFillType::InverseWinding] or [PathFillType::InverseEvenOdd]
pub fn points(&self) -> &[Point]
pub fn verbs(&self) -> &[PathVerb] ⓘ
pub fn conic_weights(&self) -> &[scalar] ⓘ
Source§impl RefHandle<SkPathBuilder>
impl RefHandle<SkPathBuilder>
Sourcepub fn dump_to_string(&self, format: DumpFormat) -> String
pub fn dump_to_string(&self, format: DumpFormat) -> String
Source§impl RefHandle<GrBackendTexture>
impl RefHandle<GrBackendTexture>
pub unsafe fn new_gl( (width, height): (i32, i32), mipmapped: Mipmapped, gl_info: TextureInfo, ) -> Self
pub unsafe fn new_gl_with_label( (width, height): (i32, i32), mipmapped: Mipmapped, gl_info: TextureInfo, label: impl AsRef<str>, ) -> Self
pub unsafe fn new_vulkan( (width, height): (i32, i32), vk_info: &ImageInfo, ) -> Self
pub unsafe fn new_vulkan_with_label( (width, height): (i32, i32), vk_info: &ImageInfo, label: impl AsRef<str>, ) -> Self
pub unsafe fn new_metal( (width, height): (i32, i32), mipmapped: Mipmapped, mtl_info: &TextureInfo, ) -> Self
pub unsafe fn new_metal_with_label( (width, height): (i32, i32), mipmapped: Mipmapped, mtl_info: &TextureInfo, label: impl AsRef<str>, ) -> Self
pub fn dimensions(&self) -> ISize
pub fn width(&self) -> i32
pub fn height(&self) -> i32
pub fn label(&self) -> &str
pub fn mipmapped(&self) -> Mipmapped
pub fn has_mip_maps(&self) -> bool
pub fn has_mipmaps(&self) -> bool
pub fn backend(&self) -> BackendAPI
pub fn gl_texture_info(&self) -> Option<TextureInfo>
pub fn gl_texture_parameters_modified(&mut self)
pub fn vulkan_image_info(&self) -> Option<ImageInfo>
pub fn set_vulkan_image_layout(&mut self, layout: ImageLayout) -> &mut Self
pub fn metal_texture_info(&self) -> Option<TextureInfo>
pub fn backend_format(&self) -> BackendFormat
pub fn set_mutable_state(&mut self, state: &MutableTextureState)
pub fn is_protected(&self) -> bool
pub fn is_valid(&self) -> bool
pub fn is_same_texture(&mut self, texture: &BackendTexture) -> bool
Source§impl RefHandle<skia_textlayout_Paragraph>
impl RefHandle<skia_textlayout_Paragraph>
pub fn max_width(&self) -> scalar
pub fn height(&self) -> scalar
pub fn min_intrinsic_width(&self) -> scalar
pub fn max_intrinsic_width(&self) -> scalar
pub fn alphabetic_baseline(&self) -> scalar
pub fn ideographic_baseline(&self) -> scalar
pub fn longest_line(&self) -> scalar
pub fn did_exceed_max_lines(&self) -> bool
pub fn layout(&mut self, width: scalar)
pub fn paint(&self, canvas: &Canvas, p: impl Into<Point>)
Sourcepub fn get_rects_for_range(
&self,
range: Range<usize>,
rect_height_style: RectHeightStyle,
rect_width_style: RectWidthStyle,
) -> Vec<TextBox>
pub fn get_rects_for_range( &self, range: Range<usize>, rect_height_style: RectHeightStyle, rect_width_style: RectWidthStyle, ) -> Vec<TextBox>
Returns a vector of bounding boxes that enclose all text between start and end glyph indexes, including start and excluding end
pub fn get_rects_for_placeholders(&self) -> Vec<TextBox>
Sourcepub fn get_glyph_position_at_coordinate(
&self,
p: impl Into<Point>,
) -> PositionWithAffinity
pub fn get_glyph_position_at_coordinate( &self, p: impl Into<Point>, ) -> PositionWithAffinity
Returns the index of the glyph that corresponds to the provided coordinate, with the top left corner as the origin, and +y direction as down
Sourcepub fn get_word_boundary(&self, offset: u32) -> Range<usize> ⓘ
pub fn get_word_boundary(&self, offset: u32) -> Range<usize> ⓘ
Finds the first and last glyphs that define a word containing the glyph at index offset
pub fn get_line_metrics(&self) -> Vec<LineMetrics<'_>>
pub fn line_number(&self) -> usize
pub fn mark_dirty(&mut self)
Sourcepub fn unresolved_glyphs(&mut self) -> Option<usize>
pub fn unresolved_glyphs(&mut self) -> Option<usize>
This function will return the number of unresolved glyphs or
None if not applicable (has not been shaped yet - valid case)
pub fn unresolved_codepoints(&mut self) -> Vec<Unichar> ⓘ
pub fn visit<'a, F>(&mut self, visitor: F)
pub fn extended_visit<'a, F>(&mut self, visitor: F)
Sourcepub fn get_path_at(&mut self, line_number: usize) -> (usize, Path)
pub fn get_path_at(&mut self, line_number: usize) -> (usize, Path)
Returns path for a given line
line_number- a line numberdest- a resulting path
Returns: a number glyphs that could not be converted to path
Sourcepub fn get_path(text_blob: &mut TextBlob) -> Path
pub fn get_path(text_blob: &mut TextBlob) -> Path
Returns path for a text blob
text_blob- a text blob
Returns: a path
Sourcepub fn contains_emoji(&mut self, text_blob: &mut TextBlob) -> bool
pub fn contains_emoji(&mut self, text_blob: &mut TextBlob) -> bool
Checks if a given text blob contains glyph with emoji
text_blob- a text blob
Returns: true if there is such a glyph
Sourcepub fn contains_color_font_or_bitmap(
&mut self,
text_blob: &mut TextBlob,
) -> bool
pub fn contains_color_font_or_bitmap( &mut self, text_blob: &mut TextBlob, ) -> bool
Checks if a given text blob contains colored font or bitmap
text_blob- a text blob
Returns: true if there is such a glyph
Sourcepub fn get_line_number_at(&self, code_unit_index: TextIndex) -> Option<usize>
pub fn get_line_number_at(&self, code_unit_index: TextIndex) -> Option<usize>
Finds the line number of the line that contains the given UTF-8 index.
index- a UTF-8 TextIndex into the paragraph
Returns: the line number the glyph that corresponds to the
given code_unit_index is in, or -1 if the code_unit_index
is out of bounds, or when the glyph is truncated or
ellipsized away.
Sourcepub fn get_line_number_at_utf16_offset(
&self,
code_unit_index: TextIndex,
) -> Option<usize>
pub fn get_line_number_at_utf16_offset( &self, code_unit_index: TextIndex, ) -> Option<usize>
Finds the line number of the line that contains the given UTF-16 index.
index- a UTF-16 offset into the paragraph
Returns: the line number the glyph that corresponds to the
given code_unit_index is in, or -1 if the code_unit_index
is out of bounds, or when the glyph is truncated or
ellipsized away.
Sourcepub fn get_line_metrics_at(&self, line_number: usize) -> Option<LineMetrics<'_>>
pub fn get_line_metrics_at(&self, line_number: usize) -> Option<LineMetrics<'_>>
Returns line metrics info for the line
line_number- a line numberline_metrics- an address to return the info (in case of null just skipped)
Returns: true if the line is found; false if not
Sourcepub fn get_actual_text_range(
&self,
line_number: usize,
include_spaces: bool,
) -> TextRange
pub fn get_actual_text_range( &self, line_number: usize, include_spaces: bool, ) -> TextRange
Returns the visible text on the line (excluding a possible ellipsis)
line_number- a line numberinclude_spaces- indicates if the whitespaces should be included
Returns: the range of the text that is shown in the line
Sourcepub fn get_glyph_cluster_at(
&self,
code_unit_index: TextIndex,
) -> Option<GlyphClusterInfo>
pub fn get_glyph_cluster_at( &self, code_unit_index: TextIndex, ) -> Option<GlyphClusterInfo>
Finds a glyph cluster for text index
code_unit_index- a text indexglyph_info- a glyph cluster info filled if not null
Returns: true if glyph cluster was found; false if not
Sourcepub fn get_closest_glyph_cluster_at(
&self,
d: impl Into<Point>,
) -> Option<GlyphClusterInfo>
pub fn get_closest_glyph_cluster_at( &self, d: impl Into<Point>, ) -> Option<GlyphClusterInfo>
Finds the closest glyph cluster for a visual text position
dx- x coordinatedy- y coordinateglyph_info- a glyph cluster info filled if not null
Returns: true if glyph cluster was found; false if not
(which usually means the paragraph is empty)
Sourcepub fn get_glyph_info_at_utf16_offset(
&mut self,
code_unit_index: usize,
) -> Option<GlyphInfo>
pub fn get_glyph_info_at_utf16_offset( &mut self, code_unit_index: usize, ) -> Option<GlyphInfo>
Retrieves the information associated with the glyph located at the given
code_unit_index.
code_unit_index- a UTF-16 offset into the paragraphglyph_info- an optional GlyphInfo struct to hold the information associated with the glyph found at the given index
Returns: false only if the offset is out of bounds
Sourcepub fn get_closest_utf16_glyph_info_at(
&mut self,
d: impl Into<Point>,
) -> Option<GlyphInfo>
pub fn get_closest_utf16_glyph_info_at( &mut self, d: impl Into<Point>, ) -> Option<GlyphInfo>
Finds the information associated with the closest glyph to the given paragraph coordinates.
d- x/y coordinateglyph_info- an optional GlyphInfo struct to hold the information associated with the glyph found. The text indices and text ranges are described using UTF-16 offsets
Returns: true if a grapheme cluster was found; false if not
(which usually means the paragraph is empty)
Sourcepub fn get_font_at(&self, code_unit_index: TextIndex) -> Font
pub fn get_font_at(&self, code_unit_index: TextIndex) -> Font
Returns the font that is used to shape the text at the position
code_unit_index- text index
Returns: font info or an empty font info if the text is not found
Sourcepub fn get_font_at_utf16_offset(&mut self, code_unit_index: usize) -> Font
pub fn get_font_at_utf16_offset(&mut self, code_unit_index: usize) -> Font
Returns the font used to shape the text at the given UTF-16 offset.
code_unit_index- a UTF-16 offset in the paragraph
Returns: font info or an empty font info if the text is not found