Add line dash API
This commit is contained in:
parent
4aa943cbc6
commit
e835cea03c
6 changed files with 76 additions and 3 deletions
|
|
@ -1,6 +1,9 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use iced_native::{Point, Rectangle, Size, Vector};
|
||||
|
||||
use crate::{
|
||||
canvas::path,
|
||||
canvas::{Fill, Geometry, Path, Stroke, Text},
|
||||
triangle, Primitive,
|
||||
};
|
||||
|
|
@ -164,6 +167,12 @@ impl Frame {
|
|||
options.end_cap = stroke.line_cap.into();
|
||||
options.line_join = stroke.line_join.into();
|
||||
|
||||
let path = if stroke.line_dash.segments.is_empty() {
|
||||
Cow::Borrowed(path)
|
||||
} else {
|
||||
Cow::Owned(path::dashed(path, stroke.line_dash))
|
||||
};
|
||||
|
||||
let result = if self.transforms.current.is_identity {
|
||||
self.stroke_tessellator.tessellate_path(
|
||||
path.raw(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue