1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| function calcul_pix(px,py:integer; image: TLazIntfImage, par:real):TFPcolor;
var vert, hor : integer;
norme : real;
begin
vert:= contourvert.calcul_pix(px,py,image).Red - $7fff;
hor:= contourhor.calcul_pix(px,py,image).Red - $7fff;
norme:= abs(vert) + abs(hor);
// On calcule la norme
norme:= par*norme;
// On l'amplifie pour ne pas avoir une image trop sombre
if norme < 0 then norme:=0;
if norme > $7fff then norme:=$7fff;
// pour que norme soit compris dans l'interval voulu
calcul_pix:=FPcolor(round(norme),round(norme),round(norme));
end; |
Partager