Einzelnen Beitrag anzeigen

Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#4

Re: Fullscreen SlideShow Bilder animieren

  Alt 23. Nov 2006, 19:59
Fürs überblenden hab ich mal eine Funktion geschrieben:
Delphi-Quellcode:
type
  TRGB32Array = packed array[0..MaxInt div SizeOf(TRGB32)-1] of TRGB32;
  PRGB32Array = ^TRGB32Array;

{...}

procedure BlendBitmap(X,Y: integer; const Dest,Bitmap: TBitmap; alpha: integer);
var xx,yy : integer;
    DestLine, BitLine: pRGB32Array;
begin
  bitmap.PixelFormat:=pf32Bit;
  dest.PixelFormat:=pf32Bit;

  for yy := 0 to Bitmap.Height - 1 do
    begin
      BitLine := Bitmap.ScanLine[yy];
      DestLine := Dest.Scanline[yy+y];
      for xx := 0 to Bitmap.Width - 1 do
      begin
        DestLine[xx+x].r:=round((BitLine[xx].r/100*(100-Alpha))+
          (DestLine[xx+x].r/100*Alpha));
        DestLine[xx+x].g:=round((BitLine[xx].g/100*(100-Alpha))+
          (DestLine[xx+x].g/100*Alpha));
        DestLine[xx+x].b:=round((BitLine[xx].b100*(100-Alpha))+
          (DestLine[xx+x].b/100*Alpha));
      end;
    end;
end;
X und y geben an, an welche stelle du das Bild (Bitmap) auf das Zielbitmap (dest) zeichnen möchtest. alpha ist der transparenzwert (zwischen 0 und 100)
  Mit Zitat antworten Zitat