unit fullscreen;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, JPEG;
type
TForm2 =
class(TForm)
Button1: TButton;
Button2: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
trgb32 =
record r,g,b,a: byte;
end;
var
Form2: TForm2;
implementation
uses
main;
var
PicCount: Integer;
x: integer;
oldpic, newpic: TBitmap;
type
TRGB32Array =
packed array[0..MaxInt
div SizeOf(TRGB32)-1]
of TRGB32;
PRGB32Array = ^TRGB32Array;
{$R *.dfm}
procedure tform1timertimer(sender: tobject);
var buffer: TBitmap;
begin
inc(x);
buffer := TBitmap.create;
buffer.assign(oldpic);
blendbitmap(0, 0, buffer, newpic);
canvas.draw(0,0,buffer);
// Zu faul für bitblt XD
buffer.free;
// edit^^ das sollte schon sein
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
if PicCount >= Form1.Memo1.Lines.Count-1
then
PicCount := 0
else
Inc(PicCount);
Image1.Picture.LoadFromFile(Form1.Edit1.Text + Form1.Memo1.Lines[PicCount]);
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
Form2.Close;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
PicCount := 0;
//Fullscreen erstellen
self.Width := Screen.Width;
self.Height := Screen.Height;
//Bild zentrieren
Image1.Left:= (Screen.Width - Image1.Width)
div 2;
end;
procedure TForm2.FormShow(Sender: TObject);
var
PicWidth: integer;
PicHeight: Integer;
begin
if (Form1.Memo1.Lines[0]) = '
'
then
ShowMessage('
Kein Bild vorhanden.')
else
begin
PicWidth := Image1.Picture.Bitmap.Width;
PicHeight := Image1.Picture.Bitmap.Height;
Image1.Picture.LoadFromFile(Form1.Edit1.Text + Form1.Memo1.Lines[PicCount]);
end;
end;
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;
end.