///|
/// Unsharp masking: the standard photographic sharpen. A blurred copy is
/// subtracted from the original to isolate high-frequency detail, which is
/// then added back scaled by `amount`. Because it reuses the separable
/// Gaussian, the blur radius controls the scale of the detail enhanced.
///|
/// Sharpens via `out = original + amount * (original - gaussian(radius))`.
/// `radius` selects the detail scale (>= 1; 0 makes the mask empty and thus
/// returns a copy); `amount` scales the enhancement (`amount <= 0` returns a
/// copy). Per-channel result is clamped to `[0, 255]`; alpha is preserved.
pub fn Image::unsharp_mask(
self : Image,
radius : Int,
amount : Double,
) -> Image {
if radius <= 0 || amount <= 0.0 {
return self.copy()
}
let blurred = self.gaussian(radius)
let out = Image::new(self.width, self.height)
let n = self.pixel_count()
for p in 0..