Declaration ​
pascal
procedure GammaSelectiveGaussianBlur32(ASource, ADest: TBitmap32; Radius: TFloat; Delta: Integer);Parameters ​
| Parameter | Type | Description |
|---|---|---|
ASource | TBitmap32 | Source 32-bit bitmap to read pixels from. |
ADest | TBitmap32 | Destination 32-bit bitmap to receive the linear-light blurred output. |
Radius | TFloat | Spatial blur radius in pixels. |
Delta | Integer | Maximum color channel difference threshold (0..255). |
Description ​
GammaSelectiveGaussianBlur32 performs edge-preserving selective Gaussian blurring in linear light space.
Pixel channels are converted into linear light space before color thresholding and kernel weighting, preventing dark fringe artifacts along high-contrast boundaries.
Behavior Summary ​
- Linear Light Precision: Performs gamma decoding and encoding via precomputed tables constructed from the current Gamma settings (
GAMMA_VALUE,GAMMA_IS_SRGB). - Detail Preservation: Neighbor pixels within
Radiusare included in the Gaussian average only if their color intensity difference from the reference pixel does not exceedDelta. - Alpha Channel: The Alpha channel is preserved without being blurred.
Example ​
pascal
var
Src, Dst: TBitmap32;
begin
Src := TBitmap32.Create;
Dst := TBitmap32.Create;
try
Src.LoadFromFile('compressed_art.png');
// Gamma-correct selective blur to smooth artifacts without dark border halos
GammaSelectiveGaussianBlur32(Src, Dst, 5.0, 20);
Dst.SaveToFile('compressed_art_clean.png');
finally
Src.Free;
Dst.Free;
end;
end;