Registriert seit: 23. Jan 2008
3.686 Beiträge
Delphi 2007 Enterprise
|
Re: [GR32] How to add intensity?
22. Jan 2010, 14:25
I haven't really understood what you do with this particular filter, but it looks like you're looking for simple linear interpolation, where you can shift beween two values freely.
Delphi-Quellcode:
function Lerp(a, b: Byte; t: Double): Byte;
var
tmp: Double;
begin
tmp := t*a + (1-t)*b;
if tmp<0 then result := 0 else
if tmp>255 then result := 255 else
result := Round(tmp);
end;
procedure YourFilter(Percent: Integer);
begin
Row.R := Lerp(Color.R, (Color.R*Row.R) div 255, Percent/100);
//...
end;
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)
|