M13.5: stroke taper/wave/multi-dashes, radial gradient highlight, variable-width mask feather, adaptive motion-blur samples
Shapes (SHP-2): Stroke Taper (pixels/percent start/end length, width, ease) and Wave (amount, pixels/cycles, wavelength, phase) rendered as a variable-width outline; Dash 2/Gap 2/Dash 3/Gap 3 (shape.dashes.add/remove, timeline +/- buttons); radial gradient Highlight Length/Angle as a focal gradient. Masks (MSK-1): mask feather points on the Mask Path (mask.featherPoint.*, Mask Feather tool add/drag), per-point signed radius and tension, rendered from the signed distance to the path; carried through vertex edits. Motion blur (LYR-10): Adaptive Sample Limit comp setting; 2D layers take one sample per pixel of shutter travel between Samples Per Frame and the limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c406b71cba
commit
bbaee1fa0f
@@ -941,13 +941,51 @@ impl<'a> Renderer<'a> {
|
||||
* Mat3::translate(vec2(-buf.offset[0], -buf.offset[1]))
|
||||
}
|
||||
|
||||
/// Motion-blur sub-samples for a layer (1 = no motion blur).
|
||||
fn mb_samples(&self, ctx: &EvalCtx, layer: &Layer) -> usize {
|
||||
if self.opts.motion_blur && ctx.comp.enable_motion_blur && layer.switches.motion_blur {
|
||||
if self.opts.draft { 4 } else { ctx.comp.motion_blur_samples.clamp(2, 64) as usize }
|
||||
} else {
|
||||
1
|
||||
/// Whether a layer is motion blurred.
|
||||
fn mb_on(&self, ctx: &EvalCtx, layer: &Layer) -> bool {
|
||||
self.opts.motion_blur && ctx.comp.enable_motion_blur && layer.switches.motion_blur
|
||||
}
|
||||
|
||||
/// Motion-blur sub-samples for a layer buffer (1 = no motion blur). As in After Effects, a 2D
|
||||
/// layer gets about one sample per output pixel its corners travel during the shutter,
|
||||
/// at least Samples Per Frame and at most the comp's Adaptive Sample Limit; a layer that
|
||||
/// does not move within the shutter is drawn once.
|
||||
fn mb_samples(&self, ctx: &EvalCtx, layer: &Layer, buf: &Buf) -> usize {
|
||||
if !self.mb_on(ctx, layer) {
|
||||
return 1;
|
||||
}
|
||||
let travel = self.shutter_travel(ctx, layer, buf);
|
||||
if travel < 1e-3 {
|
||||
return 1;
|
||||
}
|
||||
if self.opts.draft {
|
||||
return 4;
|
||||
}
|
||||
adaptive_samples(travel, ctx.comp.motion_blur_samples, ctx.comp.motion_blur_adaptive_limit)
|
||||
}
|
||||
|
||||
/// Largest distance (output pixels) a corner of the layer buffer moves during the shutter,
|
||||
/// measured along the path at a few points.
|
||||
fn shutter_travel(&self, ctx: &EvalCtx, layer: &Layer, buf: &Buf) -> f64 {
|
||||
let fd = ctx.comp.frame_duration().seconds();
|
||||
let (angle, phase) = (ctx.comp.shutter_angle / 360.0, ctx.comp.shutter_phase / 360.0);
|
||||
let (w, h) = (buf.img.width as f64, buf.img.height as f64);
|
||||
let corners = [(0.0, 0.0), (w, 0.0), (0.0, h), (w, h), (w * 0.5, h * 0.5)];
|
||||
const PROBES: usize = 8;
|
||||
let mut prev: Option<Vec<effectcraft_geom::Vec2>> = None;
|
||||
let mut travel = vec![0.0f64; corners.len()];
|
||||
for i in 0..PROBES {
|
||||
let f = phase + angle * i as f64 / (PROBES - 1) as f64;
|
||||
let m = self.buf_matrix(&ctx.at(ctx.time + Tick::from_seconds_f64(f * fd)), layer, buf);
|
||||
let pts: Vec<_> = corners.iter().map(|&(x, y)| m.apply(vec2(x, y))).collect();
|
||||
if let Some(p) = &prev {
|
||||
for (k, (a, b)) in p.iter().zip(&pts).enumerate() {
|
||||
travel[k] += (b.x - a.x).hypot(b.y - a.y);
|
||||
}
|
||||
}
|
||||
prev = Some(pts);
|
||||
}
|
||||
travel.into_iter().fold(0.0, f64::max)
|
||||
}
|
||||
|
||||
/// Canvas pixels that compositing `buf` for `layer` can change: the transformed buffer's
|
||||
@@ -957,7 +995,7 @@ impl<'a> Renderer<'a> {
|
||||
/// A quantised buffer placed pixel-exactly (integer translation, Normal, 100%) over a blank
|
||||
/// canvas leaves exactly its own (quantised) pixels: nothing to re-quantise.
|
||||
fn footprint(&self, ctx: &EvalCtx, layer: &Layer, buf: &Buf, opacity: f32, blank: bool) -> Region {
|
||||
if layer.blend_mode.is_stencil() || self.mb_samples(ctx, layer) > 1 {
|
||||
if layer.blend_mode.is_stencil() || self.mb_samples(ctx, layer, buf) > 1 {
|
||||
return Region::Full;
|
||||
}
|
||||
let m = self.buf_matrix(ctx, layer, buf);
|
||||
@@ -992,7 +1030,7 @@ impl<'a> Renderer<'a> {
|
||||
/// How a processed layer buffer lands in the output: one buffer → output matrix, or one per
|
||||
/// motion-blur sub-sample (averaged), with the layer's sampling filter and dissolve seed.
|
||||
pub fn placement(&self, ctx: &EvalCtx, layer: &Layer, buf: &Buf) -> Placement {
|
||||
let samples = self.mb_samples(ctx, layer);
|
||||
let samples = self.mb_samples(ctx, layer, buf);
|
||||
let (sampling, seed) = (self.sampling(layer), layer.id.0 as u32);
|
||||
if samples <= 1 {
|
||||
return Placement { matrices: vec![self.buf_matrix(ctx, layer, buf)], sampling, seed };
|
||||
@@ -1302,6 +1340,14 @@ pub fn blend_frames(mode: FrameBlend, a: &Image, b: &Image, w: f32) -> Image {
|
||||
}
|
||||
|
||||
/// Convenience: render one frame of a comp with no footage source.
|
||||
/// Adaptive motion-blur sample count for a layer whose corners travel `travel` output pixels
|
||||
/// during the shutter: one sample per pixel, clamped to Samples Per Frame … Adaptive Sample Limit.
|
||||
pub fn adaptive_samples(travel: f64, per_frame: u32, limit: u32) -> usize {
|
||||
let lo = per_frame.clamp(2, 64) as f64;
|
||||
let hi = (limit.clamp(16, 256) as f64).max(lo);
|
||||
travel.ceil().clamp(lo, hi) as usize
|
||||
}
|
||||
|
||||
pub fn render_frame(project: &Project, comp: ItemId, t: Tick, scale: f64) -> Image {
|
||||
Renderer::new(project, &NoFootage, RenderOpts { scale, ..Default::default() }).comp_frame(comp, t)
|
||||
}
|
||||
|
||||
@@ -54,9 +54,17 @@ fn coverage_at(ctx: &EvalCtx, layer: &Layer, g: &effectcraft_project::PropGroup,
|
||||
let path = effectcraft_path::to_kurbo(&sp);
|
||||
let (w, h) = (buf.img.width, buf.img.height);
|
||||
let m = Mat3::translate(vec2(buf.offset[0], buf.offset[1])) * Mat3::scale(vec2(buf.scale, buf.scale));
|
||||
let mut cov = effectcraft_path::fill_coverage(std::slice::from_ref(&path), &m, w, h, FillRule::NonZero);
|
||||
let exp = ctx.f(layer, g, "expansion", 0.0);
|
||||
if exp.abs() > 0.01 {
|
||||
let linear = matches!(g.kind, GroupKind::Mask { feather_falloff: FeatherFalloff::Linear, .. });
|
||||
// Variable-width feather (Mask Feather tool points): expansion and the per-point feather
|
||||
// are applied together from the signed distance to the path.
|
||||
let variable = !sp.feather.is_empty();
|
||||
let mut cov = if variable {
|
||||
effectcraft_path::feather::variable_feather_coverage(&sp, &m, w, h, exp, linear)
|
||||
} else {
|
||||
effectcraft_path::fill_coverage(std::slice::from_ref(&path), &m, w, h, FillRule::NonZero)
|
||||
};
|
||||
if exp.abs() > 0.01 && !variable {
|
||||
let ring = effectcraft_path::stroke_coverage(
|
||||
std::slice::from_ref(&path),
|
||||
&StrokeStyle { width: exp.abs() * 2.0, join: effectcraft_path::Join::Round, ..Default::default() },
|
||||
@@ -71,7 +79,6 @@ fn coverage_at(ctx: &EvalCtx, layer: &Layer, g: &effectcraft_project::PropGroup,
|
||||
let feather = ctx.v2(layer, g, "feather", [0.0; 2]);
|
||||
if feather[0] > 0.0 || feather[1] > 0.0 {
|
||||
let img = cov.to_image();
|
||||
let linear = matches!(g.kind, GroupKind::Mask { feather_falloff: FeatherFalloff::Linear, .. });
|
||||
let b = if linear {
|
||||
// One box pass: a straight ramp `feather` pixels wide across the edge.
|
||||
let r = |f: f64| ((f * buf.scale / 2.0).round() as usize).max(if f > 0.0 { 1 } else { 0 });
|
||||
|
||||
@@ -12,7 +12,7 @@ use effectcraft_color::{BlendMode, blend_pixel};
|
||||
use effectcraft_effects::Buf;
|
||||
use effectcraft_geom::{Mat3, vec2};
|
||||
use effectcraft_keyframe::{Gradient, Value};
|
||||
use effectcraft_path::{BezPath, Cap, FillRule, Join, StrokeStyle, ops};
|
||||
use effectcraft_path::{BezPath, Cap, FillRule, Join, StrokeStyle, ops, varstroke};
|
||||
use effectcraft_project::{Layer, Node, PropGroup};
|
||||
use effectcraft_raster::{Image, Mask};
|
||||
use rayon::prelude::*;
|
||||
@@ -37,6 +37,8 @@ enum Paint {
|
||||
end: [f64; 2],
|
||||
rule: FillRule,
|
||||
stroke: Option<StrokeStyle>,
|
||||
/// Radial gradients: Highlight Length (−100…100 %) and Highlight Angle (degrees).
|
||||
highlight: (f64, f64),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -102,7 +104,35 @@ fn stroke_style(ctx: &EvalCtx, layer: &Layer, g: &PropGroup) -> StrokeStyle {
|
||||
let dash = g.sub("dashes").and_then(|d| {
|
||||
let dash = ctx.f(layer, d, "dash", 0.0);
|
||||
let gap = ctx.f(layer, d, "gap", 0.0);
|
||||
(dash > 0.0).then(|| (vec![dash, if gap > 0.0 { gap } else { dash }], ctx.f(layer, d, "offset", 0.0)))
|
||||
if dash <= 0.0 {
|
||||
return None;
|
||||
}
|
||||
let mut pat = vec![dash, if gap > 0.0 { gap } else { dash }];
|
||||
// Dash 2 / Gap 2, Dash 3 / Gap 3 (added with the Dashes "+" button).
|
||||
for (dm, gm) in effectcraft_project::build::EXTRA_DASHES {
|
||||
if d.get(dm).is_none() {
|
||||
break;
|
||||
}
|
||||
let dv = ctx.f(layer, d, dm, 0.0);
|
||||
pat.push(dv);
|
||||
pat.push(if d.get(gm).is_some() { ctx.f(layer, d, gm, 0.0) } else { dv });
|
||||
}
|
||||
Some((pat, ctx.f(layer, d, "offset", 0.0)))
|
||||
});
|
||||
let taper = g.sub("taper").map(|t| varstroke::Taper {
|
||||
percent: ctx.e(layer, t, "units") == 1,
|
||||
start_len: ctx.f(layer, t, "startLength", 0.0) / if ctx.e(layer, t, "units") == 1 { 100.0 } else { 1.0 },
|
||||
end_len: ctx.f(layer, t, "endLength", 0.0) / if ctx.e(layer, t, "units") == 1 { 100.0 } else { 1.0 },
|
||||
start_width: ctx.f(layer, t, "startWidth", 100.0) / 100.0,
|
||||
end_width: ctx.f(layer, t, "endWidth", 100.0) / 100.0,
|
||||
start_ease: ctx.f(layer, t, "startEase", 0.0) / 100.0,
|
||||
end_ease: ctx.f(layer, t, "endEase", 0.0) / 100.0,
|
||||
});
|
||||
let wave = g.sub("wave").map(|w| varstroke::Wave {
|
||||
amount: ctx.f(layer, w, "amount", 0.0) / 100.0,
|
||||
cycles: (ctx.e(layer, w, "units") == 1).then(|| ctx.f(layer, w, "cycles", 10.0)),
|
||||
wavelength: ctx.f(layer, w, "wavelength", 20.0),
|
||||
phase: ctx.f(layer, w, "phase", 0.0),
|
||||
});
|
||||
StrokeStyle {
|
||||
width: ctx.f(layer, g, "width", 2.0),
|
||||
@@ -110,6 +140,8 @@ fn stroke_style(ctx: &EvalCtx, layer: &Layer, g: &PropGroup) -> StrokeStyle {
|
||||
join: [Join::Miter, Join::Round, Join::Bevel][ctx.e(layer, g, "join").min(2) as usize],
|
||||
miter: ctx.f(layer, g, "miter", 4.0),
|
||||
dash,
|
||||
taper: taper.filter(|t| t.is_active()),
|
||||
wave: wave.filter(|w| w.is_active()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +252,7 @@ fn collect(ctx: &EvalCtx, layer: &Layer, contents: &PropGroup, arena: &mut Vec<B
|
||||
end: ctx.v2(layer, g, "end", [100.0, 0.0]),
|
||||
rule: rule(ctx, layer, g),
|
||||
stroke,
|
||||
highlight: (ctx.f(layer, g, "highlightLength", 0.0), ctx.f(layer, g, "highlightAngle", 0.0)),
|
||||
},
|
||||
slots: live.clone(),
|
||||
xf: Mat3::IDENTITY,
|
||||
@@ -359,6 +392,54 @@ fn collect(ctx: &EvalCtx, layer: &Layer, contents: &PropGroup, arena: &mut Vec<B
|
||||
(draws, live)
|
||||
}
|
||||
|
||||
/// Gradient position of a point: linear along start→end, radial by distance from the start over
|
||||
/// the radius |end − start|. A radial Highlight shifts the focal point towards
|
||||
/// `highlight_length` % of the radius at `highlight_angle` from the start→end axis (a focal
|
||||
/// two-point gradient: t is measured from the focal point to the circle along the ray).
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(crate) struct GradientRamp {
|
||||
radial: bool,
|
||||
s: [f64; 2],
|
||||
d: [f64; 2],
|
||||
len2: f64,
|
||||
focal: Option<[f64; 2]>,
|
||||
}
|
||||
|
||||
impl GradientRamp {
|
||||
pub(crate) fn new(radial: bool, start: [f64; 2], end: [f64; 2], highlight: (f64, f64)) -> Self {
|
||||
let d = [end[0] - start[0], end[1] - start[1]];
|
||||
let len2 = (d[0] * d[0] + d[1] * d[1]).max(1e-9);
|
||||
let (hl, ha) = highlight;
|
||||
let focal = (radial && hl.abs() > 1e-6).then(|| {
|
||||
let r = len2.sqrt();
|
||||
let a = d[1].atan2(d[0]) + ha.to_radians();
|
||||
let dist = r * (hl / 100.0).clamp(-0.99, 0.99);
|
||||
[start[0] + dist * a.cos(), start[1] + dist * a.sin()]
|
||||
});
|
||||
GradientRamp { radial, s: start, d, len2, focal }
|
||||
}
|
||||
|
||||
pub(crate) fn t(&self, x: f64, y: f64) -> f64 {
|
||||
let (vx, vy) = (x - self.s[0], y - self.s[1]);
|
||||
if !self.radial {
|
||||
return (vx * self.d[0] + vy * self.d[1]) / self.len2;
|
||||
}
|
||||
let Some(f) = self.focal else { return ((vx * vx + vy * vy) / self.len2).sqrt() };
|
||||
// Ray from the focal point through p meets the circle (centre s, radius r) at λ.
|
||||
let (px, py) = (x - f[0], y - f[1]);
|
||||
let dist = (px * px + py * py).sqrt();
|
||||
if dist < 1e-12 {
|
||||
return 0.0;
|
||||
}
|
||||
let (ux, uy) = (px / dist, py / dist);
|
||||
let (cx, cy) = (f[0] - self.s[0], f[1] - self.s[1]);
|
||||
let b = ux * cx + uy * cy;
|
||||
let c = cx * cx + cy * cy - self.len2;
|
||||
let lambda = -b + (b * b - c).max(0.0).sqrt();
|
||||
if lambda <= 1e-12 { 1.0 } else { dist / lambda }
|
||||
}
|
||||
}
|
||||
|
||||
/// Pixel rectangle of the layer buffer (`x0, y0, width, height`).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
struct PxRect {
|
||||
@@ -486,16 +567,12 @@ pub fn render(ctx: &EvalCtx, layer: &Layer, contents: &PropGroup, s: f64) -> Buf
|
||||
for ((d, _, r), cov) in jobs[i..j].iter().zip(&covs) {
|
||||
match &d.paint {
|
||||
Paint::Fill { color, .. } | Paint::Stroke { color, .. } => paint(&mut img, *r, cov, d.opacity, d.blend, |_, _| *color),
|
||||
Paint::Gradient { g, radial, start, end, .. } => {
|
||||
Paint::Gradient { g, radial, start, end, highlight, .. } => {
|
||||
let to_local = (m * d.xf).inverse().unwrap_or(Mat3::IDENTITY);
|
||||
let (sx, sy) = (start[0], start[1]);
|
||||
let (dx, dy) = (end[0] - sx, end[1] - sy);
|
||||
let len2 = (dx * dx + dy * dy).max(1e-9);
|
||||
let ramp = GradientRamp::new(*radial, *start, *end, *highlight);
|
||||
paint(&mut img, *r, cov, d.opacity, d.blend, |x, y| {
|
||||
let p = to_local.apply(vec2(x as f64 + 0.5, y as f64 + 0.5));
|
||||
let (vx, vy) = (p.x - sx, p.y - sy);
|
||||
let t = if *radial { ((vx * vx + vy * vy) / len2).sqrt() } else { (vx * dx + vy * dy) / len2 };
|
||||
g.sample(t)
|
||||
g.sample(ramp.t(p.x, p.y))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,3 +340,87 @@ fn shape_perf_repeater_60_copies_1080p() {
|
||||
let ms = t0.elapsed().as_secs_f64() * 1000.0 / n as f64;
|
||||
println!("shape_perf: empty shape layer comp (compositor baseline): {ms:.2} ms");
|
||||
}
|
||||
|
||||
fn line_path(ids: &mut Ids, from: [f64; 2], to: [f64; 2]) -> PropGroup {
|
||||
let sp = effectcraft_keyframe::ShapePath {
|
||||
vertices: vec![from, to],
|
||||
in_tangents: vec![[0.0; 2]; 2],
|
||||
out_tangents: vec![[0.0; 2]; 2],
|
||||
closed: false,
|
||||
feather: Vec::new(),
|
||||
};
|
||||
build::shape_path(ids, sp)
|
||||
}
|
||||
|
||||
fn column_alpha(img: &Image, x: i64) -> f32 {
|
||||
(0..img.height as i64).map(|y| alpha(img, x, y)).sum()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stroke_taper_narrows_the_ends() {
|
||||
// A horizontal line from x = 20 to 180 (layer −80…80), 20 px wide, tapered over 40 px at both ends.
|
||||
let (p, cid) = shape_comp(|ids| {
|
||||
let mut st = build::shape_stroke(ids, RED, 20.0);
|
||||
set(&mut st, "taper/startLength", Value::Scalar(40.0));
|
||||
set(&mut st, "taper/endLength", Value::Scalar(40.0));
|
||||
set(&mut st, "taper/startWidth", Value::Scalar(0.0));
|
||||
set(&mut st, "taper/endWidth", Value::Scalar(50.0));
|
||||
vec![line_path(ids, [-80.0, 0.0], [80.0, 0.0]), st]
|
||||
});
|
||||
let img = frame(&p, cid);
|
||||
let near_start = column_alpha(&img, 30); // 10 px along → 25 % of 20 px
|
||||
let mid = column_alpha(&img, 100);
|
||||
let near_end = column_alpha(&img, 169); // 10 px before the end → (50 % + 50 % × 25 %) of 20 px
|
||||
assert!((near_start - 5.0).abs() < 1.0, "{near_start}");
|
||||
assert!((mid - 20.0).abs() < 0.6, "{mid}");
|
||||
assert!((near_end - 12.5).abs() < 1.0, "{near_end}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stroke_wave_and_multi_dashes() {
|
||||
let (p, cid) = shape_comp(|ids| {
|
||||
let mut st = build::shape_stroke(ids, RED, 10.0);
|
||||
set(&mut st, "wave/amount", Value::Scalar(100.0));
|
||||
set(&mut st, "wave/wavelength", Value::Scalar(40.0));
|
||||
vec![line_path(ids, [-80.0, 0.0], [80.0, 0.0]), st]
|
||||
});
|
||||
let img = frame(&p, cid);
|
||||
assert!(column_alpha(&img, 40) < 0.5, "trough (20 px along): {}", column_alpha(&img, 40));
|
||||
assert!(column_alpha(&img, 60) > 9.0, "crest (40 px along): {}", column_alpha(&img, 60));
|
||||
|
||||
// Dash 20, Gap 10, Dash 2 = 5, Gap 2 = 15: on 0–20, 30–35, 50–70…
|
||||
let (p, cid) = shape_comp(|ids| {
|
||||
let mut st = build::shape_stroke(ids, RED, 10.0);
|
||||
set(&mut st, "dashes/dash", Value::Scalar(20.0));
|
||||
set(&mut st, "dashes/gap", Value::Scalar(10.0));
|
||||
let d = st.sub_mut("dashes").unwrap();
|
||||
d.children.insert(2, ids.prop("gap2", "Gap 2", Value::Scalar(15.0)).into());
|
||||
d.children.insert(2, ids.prop("dash2", "Dash 2", Value::Scalar(5.0)).into());
|
||||
vec![line_path(ids, [-80.0, 0.0], [80.0, 0.0]), st]
|
||||
});
|
||||
let img = frame(&p, cid);
|
||||
let on = |s: i64| column_alpha(&img, 20 + s) > 9.0;
|
||||
assert!(on(10) && !on(25) && on(32) && !on(40) && on(60), "{:?}", (0..80).map(|s| on(s) as u8).collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn radial_gradient_highlight_moves_the_focal_point() {
|
||||
let build_with = |hl: f64| {
|
||||
shape_comp_sized(200, 200, move |ids| {
|
||||
let mut gf = build::shape_gradient_fill(ids, true, [0.0, 0.0], [80.0, 0.0], Gradient::default());
|
||||
set(&mut gf, "highlightLength", Value::Scalar(hl));
|
||||
set(&mut gf, "highlightAngle", Value::Scalar(90.0));
|
||||
vec![build::shape_rect(ids, [200.0, 200.0], [0.0, 0.0], 0.0), gf]
|
||||
})
|
||||
};
|
||||
let (p0, c0) = build_with(0.0);
|
||||
let (p1, c1) = build_with(50.0);
|
||||
let (a, b) = (frame(&p0, c0), frame(&p1, c1));
|
||||
// Without a highlight the centre is white; a 50 % highlight at 90° (down the +y axis, 90° from
|
||||
// the start→end axis) puts the white focus 40 px below the centre and darkens the centre.
|
||||
assert!(a.get(100, 100)[0] > 0.98);
|
||||
assert!(b.get(100, 140)[0] > 0.97, "focal point: {:?}", b.get(100, 140));
|
||||
assert!(b.get(100, 100)[0] < 0.8, "{:?}", b.get(100, 100));
|
||||
// The outer circle is unchanged: points just outside it are black in both.
|
||||
assert!(a.get(100, 182)[0] < 0.03 && b.get(100, 182)[0] < 0.03 && b.get(100, 17)[0] < 0.03);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ fn anchor_grouping_line_rotates_around_line_centre() {
|
||||
fn mask(p: &mut Project, l: &mut Layer, pts: &[[f64; 2]], closed: bool) {
|
||||
let mut next = p.next_id;
|
||||
let mut ids = Ids(&mut next);
|
||||
let sp = ShapePath { vertices: pts.to_vec(), in_tangents: vec![[0.0; 2]; pts.len()], out_tangents: vec![[0.0; 2]; pts.len()], closed };
|
||||
let sp = ShapePath { vertices: pts.to_vec(), in_tangents: vec![[0.0; 2]; pts.len()], out_tangents: vec![[0.0; 2]; pts.len()], closed, feather: Vec::new() };
|
||||
let g = build::mask(&mut ids, "Mask 1", sp, MaskMode::None, [255, 255, 0]);
|
||||
p.next_id = next;
|
||||
let masks = l.props.group_mut("masks").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user