I think the following function is faster and easier to understand
than the gaussian function:
Delphi-Quellcode:
function CalcVignetteBrightness(X, Y: Single): Single;
var
distance : Single;
inner_radius, outer_radius : Single;
begin
inner_radius := 50;
outer_radius := 150;
// calculate the distance from the origin (center of the image)
distance := SQRT(SQR(x) + SQR(Y));
if distance <= inner_radius then
result := 1.0 // Brightness 100%
else if distance <= outer_radius then
// decreasing Brightness from 100% downto 0%
result := (distance - inner_radius) / (outer_radius - inner_radius)
else
result := 0.0; // it's dark outside the outer_radius
end;