Einzelnen Beitrag anzeigen

Benutzerbild von SirThornberry
SirThornberry
(Moderator)

Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
 
Delphi 2006 Professional
 
#3

Re: Überblendung zweier Bitmaps

  Alt 13. Sep 2004, 16:50
Unter welchem Windows soll das ganze funktionieren? Bei XP geht folgendes (ab 2000 glaub ich)
Delphi-Quellcode:
procedure BlendBitmap(Dest: TBitmap; ABlendColor: TColor; ABlendIntensity: Byte = 127; GammaCorrection: Integer = 0);
var LSource: TBitmap;
    LBlendstruct: TBlendFunction;
begin
  LBlendstruct.BlendOp := AC_SRC_OVER;
  LBlendstruct.BlendFlags := 0;
  LBlendstruct.SourceConstantAlpha := ABlendIntensity;// trunc(APercentBlendColor * 255 / 100);
  LBlendstruct.AlphaFormat := 0; //AC_SRC_ALPHA;
  LSource := TBitmap.Create;
  LSource.Width := 1; LSource.Height := 1;
  LSource.Canvas.Pixels[0,0] := ABlendColor;
  AlphaBlend(Dest.canvas.handle, 0, 0, Dest.width, Dest.height, LSource.canvas.Handle, 0, 0, 1, 1, LBlendstruct);

  if GammaCorrection <> 0 then
  begin
    LSource.Canvas.Pixels[0,0] := clWhite;
    LBlendstruct.SourceConstantAlpha := GammaCorrection;
    AlphaBlend(Dest.canvas.handle, 0, 0, Dest.width, Dest.height, LSource.canvas.Handle, 0, 0, 1, 1, LBlendstruct);
  end;
  LSource.Free;
end;
Jens
Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
  Mit Zitat antworten Zitat