Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion crates/n0/src/drawlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,23 @@ impl StrokeDashPhase {
Self(value)
}

/// The local-space offset into the paired dash interval cycle.
/// The offset into the paired dash interval cycle, in the stroke's
/// declared construction space.
pub const fn value(self) -> f32 {
self.0
}
}

/// Private projection of the resolved coordinate system in which a stroke is
/// dashed and widened. The source-neutral contract owns the meaning; this enum
/// only keeps the painter from recovering it from transforms.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub enum StrokeSpace {
#[default]
Local,
Frame,
}

/// One checked alpha stage applied after each paint's intrinsic alpha has
/// materialized.
///
Expand Down Expand Up @@ -448,6 +459,7 @@ pub enum ItemKind {
geometry: ResolvedPatternGeometry,
pattern: Arc<ResolvedPattern>,
stroke: Stroke,
space: StrokeSpace,
dash_phase: StrokeDashPhase,
post_paint_opacity: PostPaintOpacity,
},
Expand Down Expand Up @@ -485,13 +497,15 @@ pub enum ItemKind {
corner_radius: RectangularCornerRadius,
corner_smoothing: CornerSmoothing,
stroke: Stroke,
space: StrokeSpace,
dash_phase: StrokeDashPhase,
post_paint_opacity: PostPaintOpacity,
},
OvalStroke {
w: f32,
h: f32,
stroke: Stroke,
space: StrokeSpace,
dash_phase: StrokeDashPhase,
post_paint_opacity: PostPaintOpacity,
},
Expand All @@ -504,6 +518,7 @@ pub enum ItemKind {
w: f32,
h: f32,
stroke: Stroke,
space: StrokeSpace,
dash_phase: StrokeDashPhase,
post_paint_opacity: PostPaintOpacity,
},
Expand All @@ -515,6 +530,7 @@ pub enum ItemKind {
paint_w: f32,
paint_h: f32,
stroke: Stroke,
space: StrokeSpace,
dash_phase: StrokeDashPhase,
post_paint_opacity: PostPaintOpacity,
},
Expand All @@ -523,6 +539,7 @@ pub enum ItemKind {
h: f32,
path: Arc<ResolvedPathArtifact>,
stroke: Stroke,
space: StrokeSpace,
dash_phase: StrokeDashPhase,
post_paint_opacity: PostPaintOpacity,
},
Expand All @@ -531,6 +548,7 @@ pub enum ItemKind {
paint_w: f32,
paint_h: f32,
stroke: Stroke,
space: StrokeSpace,
dash_phase: StrokeDashPhase,
post_paint_opacity: PostPaintOpacity,
},
Expand Down Expand Up @@ -980,6 +998,7 @@ fn emit<V: DrawValues + ?Sized>(
corner_radius: values.corner_radius(id),
corner_smoothing,
stroke,
space: StrokeSpace::Local,
dash_phase: StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
Expand All @@ -989,6 +1008,7 @@ fn emit<V: DrawValues + ?Sized>(
w: b.w,
h: b.h,
stroke,
space: StrokeSpace::Local,
dash_phase: StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
Expand All @@ -1002,6 +1022,7 @@ fn emit<V: DrawValues + ?Sized>(
paint_w: b.w,
paint_h: b.h,
stroke,
space: StrokeSpace::Local,
dash_phase: StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
Expand All @@ -1012,6 +1033,7 @@ fn emit<V: DrawValues + ?Sized>(
h: b.h,
path: Arc::clone(resolved.resolved_path_of(id)),
stroke,
space: StrokeSpace::Local,
dash_phase: StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
Expand All @@ -1023,6 +1045,7 @@ fn emit<V: DrawValues + ?Sized>(
paint_w: b.w,
paint_h: b.h,
stroke,
space: StrokeSpace::Local,
dash_phase: StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
Expand Down
4 changes: 4 additions & 0 deletions crates/n0/src/drawlist_vector_join_spike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1193,13 +1193,15 @@ fn compile_vectors(
corner_radius: corners.model(),
corner_smoothing: CornerSmoothing::default(),
stroke,
space: crate::drawlist::StrokeSpace::Local,
dash_phase: crate::drawlist::StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
EvidenceGeometry::Ellipse { w, h } => ItemKind::OvalStroke {
w: *w,
h: *h,
stroke,
space: crate::drawlist::StrokeSpace::Local,
dash_phase: crate::drawlist::StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
Expand All @@ -1212,6 +1214,7 @@ fn compile_vectors(
.expect("every candidate path was lowered once"),
),
stroke,
space: crate::drawlist::StrokeSpace::Local,
dash_phase: crate::drawlist::StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
Expand All @@ -1230,6 +1233,7 @@ fn compile_vectors(
paint_w: *paint_w,
paint_h: *paint_h,
stroke,
space: crate::drawlist::StrokeSpace::Local,
dash_phase: crate::drawlist::StrokeDashPhase::ZERO,
post_paint_opacity: PostPaintOpacity::IDENTITY,
},
Expand Down
Loading
Loading