pub struct FlattenedPath { /* private fields */ }Expand description
已经过仿射变换并细分至目标物理像素空间的折线路径集合(可在多个图形元素间复用缓冲)。
Implementations§
Source§impl FlattenedPath
impl FlattenedPath
Sourcepub fn quad_to(&mut self, p0: (f32, f32), p1: (f32, f32), p2: (f32, f32))
pub fn quad_to(&mut self, p0: (f32, f32), p1: (f32, f32), p2: (f32, f32))
添加二次贝塞尔曲线(输入已变换至屏幕物理像素坐标),平坦度误差 $\le 0.25\text{px}$。
Sourcepub fn cubic_to(
&mut self,
p0: (f32, f32),
p1: (f32, f32),
p2: (f32, f32),
p3: (f32, f32),
)
pub fn cubic_to( &mut self, p0: (f32, f32), p1: (f32, f32), p2: (f32, f32), p3: (f32, f32), )
添加三次贝塞尔曲线(输入已变换至屏幕物理像素坐标),平坦度误差 $\le 0.25\text{px}$。
Sourcepub fn arc_to_user(
&mut self,
xf: Transform2D,
x1: f32,
y1: f32,
rx_in: f32,
ry_in: f32,
x_axis_rot_deg: f32,
large_arc: bool,
sweep: bool,
x2: f32,
y2: f32,
)
pub fn arc_to_user( &mut self, xf: Transform2D, x1: f32, y1: f32, rx_in: f32, ry_in: f32, x_axis_rot_deg: f32, large_arc: bool, sweep: bool, x2: f32, y2: f32, )
依据 W3C SVG 1.1 F.6.5/F.6.6 规范展开椭圆弧(在用户空间求中心参数化后按 xf 变换细分)。
Sourcepub fn parse_svg_path_d(&mut self, d: &str, xf: Transform2D)
pub fn parse_svg_path_d(&mut self, d: &str, xf: Transform2D)
解析完整 SVG Path d 字符串(全部 20 个命令 M/m L/l H/h V/v C/c S/s Q/q T/t A/a Z/z)并写入当前路径。
Sourcepub fn add_rect(
&mut self,
xf: Transform2D,
x: f32,
y: f32,
w: f32,
h: f32,
rx_in: f32,
ry_in: f32,
)
pub fn add_rect( &mut self, xf: Transform2D, x: f32, y: f32, w: f32, h: f32, rx_in: f32, ry_in: f32, )
展开 <rect x y width height rx ry> 形状。
Sourcepub fn add_ellipse(
&mut self,
xf: Transform2D,
cx: f32,
cy: f32,
rx: f32,
ry: f32,
)
pub fn add_ellipse( &mut self, xf: Transform2D, cx: f32, cy: f32, rx: f32, ry: f32, )
展开 <circle cx cy r> 或 <ellipse cx cy rx ry> 形状。
Sourcepub fn add_line(&mut self, xf: Transform2D, x1: f32, y1: f32, x2: f32, y2: f32)
pub fn add_line(&mut self, xf: Transform2D, x1: f32, y1: f32, x2: f32, y2: f32)
展开 <line x1 y1 x2 y2>。
Sourcepub fn add_points(&mut self, xf: Transform2D, points_str: &str, closed: bool)
pub fn add_points(&mut self, xf: Transform2D, points_str: &str, closed: bool)
展开 <polyline points="..."> 或 <polygon points="...">。
Trait Implementations§
Auto Trait Implementations§
impl Forget for FlattenedPath
impl Freeze for FlattenedPath
impl Move for FlattenedPath
impl RefUnwindSafe for FlattenedPath
impl Send for FlattenedPath
impl Sync for FlattenedPath
impl Unpin for FlattenedPath
impl UnsafeUnpin for FlattenedPath
impl UnwindSafe for FlattenedPath
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。