PeachDrawing
PeachDrawing.Filters
GaussianBlur Class
A Gaussian blur of a premultiplied RGBA8 surface. For a standard deviation of 2 or more it uses the three successive box blurs Filter Effects 1 §feGaussianBlur specifies (which approximate the Gaussian to within a few percent and cost the same regardless of radius); below 2 it convolves with the exact kernel. Everything is integer arithmetic, so the result is identical on every CPU. Pixels outside the surface count as transparent.
public static class GaussianBlur
Inheritance System.Object → GaussianBlur
Remarks
The division by the window size is a correctly rounded IEEE single-precision division followed by truncation. It is exact here: a sum is below 2^20 (so exact in a float), and a true quotient that is not an integer is at least 1/4095 away from the nearest one, far more than the 2^-16 spacing of floats near 255, so the rounded quotient truncates to the same integer the scalar form’s integer reciprocal gives. No fused operations, no reciprocal estimates: the bytes are the scalar bytes.
| Methods | |
|---|---|
| Apply(RasterSurface, double, double) | Blurs surface in place with the given horizontal and vertical standard deviations, in pixels. |