Free open-source image editor for the browser
import { gradientCoverage } from "../blend/coverage.wgsl";
// One gradient's coverage, for a mask whose group combines in the render graph.
struct Params {
kind: u32,
first: vec2f,
second: vec2f,
feather: f32,
angle: f32,
// Photo pixels per texel, so the gradient lands where it does on the photo.
scale: vec2f,
}
@group(0) @binding(0) var<uniform> params: Params;
@fragment fn fs_main(@builtin(position) position: vec4f) -> @location(0) vec4f {
let coverage = gradientCoverage(position.xy * params.scale, params.first, params.second, params.kind, params.feather, params.angle);
return vec4f(coverage, 0.0, 0.0, 1.0);
}