Thema: Delphi Better sepia wanted

Einzelnen Beitrag anzeigen

Blup

Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.439 Beiträge
 
Delphi 10.4 Sydney
 
#2

Re: Better sepia wanted

  Alt 28. Jan 2010, 10:46
try it out
Delphi-Quellcode:
type
  TBGR = packed record
    B, G, R: Byte;
  end;

procedure RenderColor(ABitmap: TBitmap; NewHue, NewSaturation: Word);
var
  Hue, Luminance, Saturation: Word;
  p: ^TBGR;
  c: TColor;
  x, y: Integer;
begin
  // NewHue := 36;
  // NewSaturation := 64;

  with ABitmap do
  begin
    PixelFormat := pf24Bit;
    for y := 0 to Height - 1 do
    begin
      p := ScanLine[y];
      for x := 0 to Width - 1 do
      begin
        c := RGB(p^.R, p^.G, p^.B);
        ColorRGBToHLS(c, Hue, Luminance, Saturation);
        c := ColorHLSToRGB(NewHue, Luminance, NewSaturation);
        p^.B := GetBValue(c);
        p^.G := GetGValue(c);
        p^.R := GetRValue(c);
        Inc(p);
      end;
    end;
  end;
end;
  Mit Zitat antworten Zitat