Thema: Delphi Vignette effect

Einzelnen Beitrag anzeigen

Benutzerbild von sx2008
sx2008

Registriert seit: 16. Feb 2008
Ort: Baden-Württemberg
2.332 Beiträge
 
Delphi 2007 Professional
 
#4

AW: Vignette effect

  Alt 16. Sep 2010, 01:56
You could calculate the brightness of every Pixel with a 2-dimensional Gaussian function.
Here is some Pseudocode:
Delphi-Quellcode:
xcenter := Bitmap.Width div 2;
ycenter := Bitmap.Height div 2;
for each Pixel do
begin
  brightness_factor := mygaussian(x - xcenter, y-ycenter)* 0.5{=effect depth} + 0.3{basic brightness};
  Pixel[x,y].red := Pixel[x,y].red * brightness_factor;
  Pixel[x,y].green := Pixel[x,y].green * brightness_factor;
  Pixel[x,y].blue := Pixel[x,y].blue * brightness_factor;
end;
It it works, you could replace the mygaussian() function with other possibly better functions.
  Mit Zitat antworten Zitat