Skip to main content

FreeformBuilder

Struct FreeformBuilder 

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

FreeformBuilder:累积路径点。

Implementations§

Source§

impl FreeformBuilder

Source

pub fn new() -> Self

新建。

Source

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

(x, y) 处下笔(相当于 SVG M)。

Source

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

连接到 (x, y)(相当于 SVG L)。

Source

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

闭合路径(首尾相连,相当于 SVG Z)。

Source

pub fn points(&self) -> &[Point]

取所有点。

Source

pub fn build(self, name: impl Into<String>) -> Freeform

构造一个 Freeform(一个用 <a:custGeom>` 描述的 AutoShape)。

§行为
  1. 把累积的点序列化为 <a:pathLst>,首点为 <a:moveTo>,后续点为 <a:lnTo>
  2. 若调用过 Self::close,追加 <a:close/> 段;
  3. <a:path>w / h 取路径边界框尺寸(最小 x/y 到最大 x/y);
  4. spPr.xfrm 的位置默认为路径最小点,尺寸为边界框尺寸——调用方可后续 通过 set_left/set_top/set_width/set_height 覆盖。
§边界情况
  • 点数 < 2:仍会构造一个空路径,PowerPoint 会按形状的 xfrm 尺寸渲染空白区域;
  • 单点(仅 move_to):等价于空路径,几何上不可见。

Trait Implementations§

Source§

impl Clone for FreeformBuilder

Source§

fn clone(&self) -> FreeformBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FreeformBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FreeformBuilder

Source§

fn default() -> FreeformBuilder

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V