Einzelnen Beitrag anzeigen

Medium

Registriert seit: 23. Jan 2008
3.686 Beiträge
 
Delphi 2007 Enterprise
 
#14

Re: [GR32] How to add intensity?

  Alt 23. Jan 2010, 16:27
As I already said, change the line
tmp := t*a + (1-t)*b;
to
tmp := (1-t)*a + t*b;

Another thing is, that it's not clear to me, which variable holds the original color. Color or Row? If it's Row, then change
Row.R := Lerp(Color.R, (Color.R * Row.R) div 255, APercent / 100);
to
Row.R := Lerp(Row.R, (Color.R * Row.R) div 255, APercent / 100);

And yet another thing unclear to me is, if your initial formula does create the desired effect or not. If it isn't, then my code of course cannot function! It isn't really clear what your problem was: Just the ability to apply it at different percentages, or this AND the formula.
Edit: Scrub the last part, the formula itself looks fine. The two changes above should do well if I interpret the output correctly.
"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)
  Mit Zitat antworten Zitat