function QRCodeShowImage( aImage : Timage; aSize : integer ) : boolean;
var scale : double;
begin
result := false;
try
if ( ( QRCodeBitmap.Width > 0 ) and ( QRCodeBitmap.Height > 0 ) ) then begin
aImage.Width := aSize;
aImage.Height := aSize;
Scale := aImage.Height / QRCodeBitmap.Height;
aImage.Canvas.StretchDraw( Rect( 0, 0, Trunc( Scale * QRCodeBitmap.Width ),
Trunc( Scale * QRCodeBitmap.Height ) ),
QRCodeBitmap );
result := true;
end;
except
on e:
exception do begin
FehlerOk( 'QRCodeShow Fehler : ' + e.Message );
end;
end;
end;
function QRCodeSave( aFileName : string; aSize : integer ) : boolean;
var xBitmap : Graphics.TBitmap;
scale : double;
Begin
result := false;
if fileDirOk( aFileName ) then begin
try
xBitmap := Graphics.TBitmap.Create;
try
if ( ( QRCodeBitmap.Width > 0 ) and ( QRCodeBitmap.Height > 0 ) ) then begin
xBitmap.Width := aSize;
xBitmap.Height := aSize;
Scale := xBitmap.Height / QRCodeBitmap.Height;
xBitmap.Canvas.StretchDraw( Rect( 0, 0, Trunc( Scale * QRCodeBitmap.Width ),
Trunc( Scale * QRCodeBitmap.Height ) ),
QRCodeBitmap );
xBitmap.SaveToFile( aFileName );
result := true;
end;
except
on e:
exception do begin
FehlerOk( 'QR-Code Fehler : ' + e.Message );
end;
end;
finally
xBitmap.Free;
end;
end;
end;