Skip to main content

PathBuilder

Struct PathBuilder 

Source
pub struct PathBuilder { /* private fields */ }
Expand description

可增量构建路径;完成后用 Self::snapshotSelf::detach 得到 Path。 Incremental path construction; finish with Self::snapshot or Self::detach into a Path.

Implementations§

Source§

impl PathBuilder

Source

pub fn new() -> Self

创建空构建器。Creates an empty builder.

Source

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

清空内容(与 SkPathBuilder::reset 一致)。Clears the builder.

Source

pub fn fill_type(&self) -> PathFillType

当前填充规则。Fill rule used when producing a path.

Source

pub fn set_fill_type(&mut self, ft: PathFillType) -> &mut Self

设置填充规则。Sets fill rule for the built path.

Source

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

在普通 / 反色填充之间切换。Toggles inverse fill (same as SkPathBuilder).

Source

pub fn snapshot(&self) -> Path

生成路径副本,构建器保持不变。Builds a copy; builder is unchanged.

Source

pub fn detach(&mut self) -> Path

取出路径并将构建器重置为空。Takes the path and resets the builder to empty.

Source

pub fn move_to(&mut self, x: f32, y: f32) -> &mut Self

移动到 (x, y)。Moves to (x, y).

Source

pub fn line_to(&mut self, x: f32, y: f32) -> &mut Self

直线到 (x, y)。Line to (x, y).

Source

pub fn quad_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32) -> &mut Self

二次贝塞尔。Quadratic bezier.

Source

pub fn cubic_to( &mut self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, ) -> &mut Self

三次贝塞尔。Cubic bezier.

Source

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

闭合当前轮廓。Closes the current contour.

Source

pub fn add_rect( &mut self, rect: &Rect, dir: Direction, start: RectCorner, ) -> &mut Self

添加矩形。Adds a rectangle contour.

Source

pub fn add_oval(&mut self, rect: &Rect, dir: Direction) -> &mut Self

添加椭圆。Adds an oval.

Source

pub fn add_circle( &mut self, cx: f32, cy: f32, radius: f32, dir: Direction, ) -> &mut Self

添加圆。Adds a circle.

Source

pub fn add_round_rect( &mut self, rect: &Rect, rx: f32, ry: f32, dir: Direction, ) -> &mut Self

添加圆角矩形(统一 rx/ry)。Adds round rect.

Source

pub fn add_rrect(&mut self, rrect: &RRect, dir: Direction) -> &mut Self

添加 RRect。Adds RRect.

Source

pub fn add_rrect_with_start( &mut self, rrect: &RRect, dir: Direction, start: RectCorner, ) -> &mut Self

添加 RRect 并指定起始角。Adds RRect with start corner.

Source

pub fn add_path(&mut self, path: &Path) -> &mut Self

追加已有路径的几何。Appends another path’s geometry.

Trait Implementations§

Source§

impl Default for PathBuilder

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.