Group local mask shapes into editable components.
A local adjustment is now a list of shapes composited in order (add, subtract, intersect) instead of a single shape, so dodging and burning can be built from several brushes, gradients and auto masks without spending layer channels. Existing edits migrate on load: the flat layer fields become components[0], keeping geometry, invert, feather and the layer's blend mode unchanged. The panel gains a shape list with active-shape editing, and the render gate now asserts a subtract shape clears the group while an intersect keeps it.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { blendCoverage } from './masks';
|
||||
|
||||
/** Coverage values are 0–1 inside the baker, which this keeps readable. */
|
||||
describe('mask group compositing', () => {
|
||||
it('starts a group with the first shape whatever its mode says', () => {
|
||||
expect(blendCoverage(0, 0.6, 'subtract', true)).toBe(0.6);
|
||||
expect(blendCoverage(0, 0.6, 'intersect', true)).toBe(0.6);
|
||||
});
|
||||
|
||||
it('unions added shapes instead of stacking them', () => {
|
||||
expect(blendCoverage(0.4, 0.7, 'add', false)).toBe(0.7);
|
||||
expect(blendCoverage(0.7, 0.4, 'add', false)).toBe(0.7);
|
||||
});
|
||||
|
||||
it('subtracts coverage from the group', () => {
|
||||
expect(blendCoverage(1, 0.25, 'subtract', false)).toBeCloseTo(0.75, 6);
|
||||
expect(blendCoverage(1, 1, 'subtract', false)).toBe(0);
|
||||
});
|
||||
|
||||
it('keeps only the overlap for an intersect shape', () => {
|
||||
expect(blendCoverage(0.8, 0.5, 'intersect', false)).toBeCloseTo(0.4, 6);
|
||||
expect(blendCoverage(0.8, 0, 'intersect', false)).toBe(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user