Registriert seit: 31. Mai 2009
1.198 Beiträge
Turbo Delphi für Win32
|
AW: Max. Bildfarben auf 256 verringern möglich?
12. Mär 2011, 14:57
So...
Delphi-Quellcode:
type
TBitmapArray = Array of TBitmap;
function LoadBitmaps(const Filenames: TStringList): TBitmapArray;
var
i, j: Integer;
begin
if Filenames.Count = 0 then
Exit;
j := 0;
SetLength( Result, Filenames.Count );
for i := 0 to High( Result ) do
if FileExists( Filenames[i] ) then
try
Result[j] := TBitmap.Create;
Result[j].LoadFromFile( Filenames[i] );
inc( j );
except
if Assigned( Result[j] ) then
Result[j].Free;
end;
SetLength( Result, j );
end;
procedure ConvertBmpsTo8Bit(const Bitmaps: TBitmapArray);
var
i: Integer;
begin
for i := 0 to High( Bitmaps ) do
Bitmaps[i].PixelFormat := pf8Bit;
end;
procedure SaveBitmaps(const Filenames: TStringList; const Bitmaps: TBitmapArray);
var
i: Integer;
begin
if (Filenames.Count = 0) or (Filenames.Count <> Length( Bitmaps )) then
Exit;
for i := 0 to High( Bitmaps ) do
Bitmaps[i].SaveToFile( Filenames[i] );
end;
procedure FreeBitmapArray(var Bitmaps: TBitmapArray);
var
i: Integer;
begin
for i := 0 to High( Bitmaps ) do
try
if Assigned( Bitmaps[i] ) then
Bitmaps[i].Free;
finally
end;
SetLength( Bitmaps, 0 );
end;
das Erkennen beginnt, wenn der Erkennende vom zu Erkennenden Abstand nimmt
MfG
|
|
Zitat
|