Add blur/sharpen tool

This commit is contained in:
Skyler Lehmkuhl
2026-03-06 11:47:10 -05:00
parent 922e8f78b6
commit e7641edd0d
6 changed files with 137 additions and 1 deletions
@@ -307,6 +307,7 @@ impl BrushEngine {
RasterBlendMode::PatternStamp => 5u32,
RasterBlendMode::DodgeBurn => 6u32,
RasterBlendMode::Sponge => 7u32,
RasterBlendMode::BlurSharpen => 8u32,
};
let push_dab = |dabs: &mut Vec<GpuDab>,
@@ -371,6 +372,8 @@ impl BrushEngine {
(cr, cg, cb, tp[0], tp[1]),
RasterBlendMode::DodgeBurn | RasterBlendMode::Sponge =>
(tp[0], 0.0, 0.0, 0.0, 0.0),
RasterBlendMode::BlurSharpen =>
(tp[0], 0.0, 0.0, tp[1], 0.0),
_ => (cr, cg, cb, 0.0, 0.0),
};
push_dab(&mut dabs, &mut bbox, ex, ey, r, o, cr2, cg2, cb2,
@@ -494,6 +497,8 @@ impl BrushEngine {
(cr, cg, cb, tp[0], tp[1]),
RasterBlendMode::DodgeBurn | RasterBlendMode::Sponge =>
(tp[0], 0.0, 0.0, 0.0, 0.0),
RasterBlendMode::BlurSharpen =>
(tp[0], 0.0, 0.0, tp[1], 0.0),
_ => (cr, cg, cb, 0.0, 0.0),
};
push_dab(&mut dabs, &mut bbox,
@@ -535,6 +540,8 @@ impl BrushEngine {
(cr, cg, cb, tp[0], tp[1]),
RasterBlendMode::DodgeBurn | RasterBlendMode::Sponge =>
(tp[0], 0.0, 0.0, 0.0, 0.0),
RasterBlendMode::BlurSharpen =>
(tp[0], 0.0, 0.0, tp[1], 0.0),
_ => (cr, cg, cb, 0.0, 0.0),
};
push_dab(&mut dabs, &mut bbox, ex, ey, r, o, cr2, cg2, cb2,
@@ -28,6 +28,8 @@ pub enum RasterBlendMode {
DodgeBurn,
/// Sponge: saturate or desaturate existing pixels
Sponge,
/// Blur / Sharpen: soften or crisp up existing pixels
BlurSharpen,
}
impl Default for RasterBlendMode {
@@ -41,7 +43,7 @@ impl RasterBlendMode {
/// use the brush color at all (clone, heal, dodge/burn, sponge).
/// Used by brush_engine.rs to decide whether color_a should be 1.0 or stroke.color[3].
pub fn uses_brush_color(self) -> bool {
!matches!(self, Self::CloneStamp | Self::Healing | Self::DodgeBurn | Self::Sponge)
!matches!(self, Self::CloneStamp | Self::Healing | Self::DodgeBurn | Self::Sponge | Self::BlurSharpen)
}
}