pub struct StrokeRec { /* private fields */ }Expand description
描边参数,描述如何将路径转为描边轮廓。 Stroke parameters - describes how to expand a path to a stroke outline.
用于 apply_to_path 将路径转换为描边后的填充路径。
Used with apply_to_path to convert a path to a stroked fill equivalent.
Implementations§
Source§impl StrokeRec
impl StrokeRec
Sourcepub fn new_hairline() -> Self
pub fn new_hairline() -> Self
创建极细线样式。Creates hairline style (1-pixel stroke).
Sourcepub fn new_stroke(width: f32, stroke_and_fill: bool) -> Self
pub fn new_stroke(width: f32, stroke_and_fill: bool) -> Self
创建描边样式。Creates stroke style with given width.
Sourcepub fn set_hairline(&mut self)
pub fn set_hairline(&mut self)
设置为极细线。Sets to hairline style.
Sourcepub fn set_stroke_style(&mut self, width: f32, stroke_and_fill: bool)
pub fn set_stroke_style(&mut self, width: f32, stroke_and_fill: bool)
设置描边宽度。Sets stroke width (width=0 may switch to fill/hairline).
Sourcepub fn set_join(&mut self, join: StrokeJoin)
pub fn set_join(&mut self, join: StrokeJoin)
设置转角连接样式。Sets line join (Miter, Round, Bevel).
Sourcepub fn set_stroke_params(
&mut self,
cap: StrokeCap,
join: StrokeJoin,
miter_limit: f32,
)
pub fn set_stroke_params( &mut self, cap: StrokeCap, join: StrokeJoin, miter_limit: f32, )
设置描边端点与转角参数。Sets cap, join, and miter limit.
Sourcepub fn join(&self) -> StrokeJoin
pub fn join(&self) -> StrokeJoin
转角连接样式。Returns line join.
Sourcepub fn miter_limit(&self) -> f32
pub fn miter_limit(&self) -> f32
Miter 限制(尖角最长延伸比)。Returns miter limit.
Sourcepub fn style(&self) -> StrokeStyle
pub fn style(&self) -> StrokeStyle
当前样式。Returns current style (hairline/fill/stroke).
Sourcepub fn inflation_radius(&self) -> f32
pub fn inflation_radius(&self) -> f32
膨胀半径(用于边界计算)。Inflation radius for bounds.
Sourcepub fn apply_to_path(&self, path: &Path) -> Option<Path>
pub fn apply_to_path(&self, path: &Path) -> Option<Path>
将描边参数应用到路径,返回描边后的填充路径。 Applies stroke to path, returning the stroked outline as a fill path.
若样式为 fill/hairline 则返回 None。 Returns None if style is fill or hairline (no expansion).