You could try something similar to this... ImageDrawBackground is not required:
function GetAllFiles(AMask: string; AStringList: TStringList): integer;
var
iSearch: TSearchRec;
iDirectory: string;
iCount: integer;
iFileAttrs: integer;
begin
iCount := 0;
iDirectory := ExtractFilePath(AMask);
iFileAttrs := $23 - faHidden;
{ Find all files }
if FindFirst(AMask, iFileAttrs, iSearch) = 0 then
begin
repeat
{ add the files to the stringlist }
AStringList.Add(iDirectory + iSearch.name);
Inc(iCount);
until FindNext(iSearch) <> 0;
end;
{ Subdirectories }
if FindFirst(ADirectory + '*.*', faDirectory, iSearch) = 0 then
begin
repeat
if ((iSearch.Attr and faDirectory) = faDirectory) and (iSearch.name[1] <> '.') then
GetAllFiles(iDirectory + iSearch.name + '\' + ExtractFileName(AMask), AStringList);
until FindNext(iSearch) <> 0;
FindClose(iSearch);
end;
Result := iCount;
end;
procedure TForm1.MakeTile;
var
iBaseWidth: Integer;
iFilename: string;
iColumns: Integer;
x: Integer;
iFolder: string;
i: Integer;
iRows: Integer;
iHeight: Integer;
iWidth: Integer;
iFileCount: Integer;
iBaseHeight: Integer;
iFilesList: TStringList;
y: Integer;
iPadding: integer;
begin
Screen.Cursor := crHourGlass;
try
iFilesList := TStringList.Create;
try
i := -1;
iFolder := IncludeTrailingPathDelimiter(ShellTreeView1.Path);
iFileCount := GetAllFiles(iFolder + '*.*', iFilesList);
StatusBar1.Panels[3].Text := 'Files: ' + IntToStr(iFileCount);
iPadding := StrToIntDef(Padding1.Text, 6);
iColumns := StrToIntDef(Columns1.Text, 6);
iRows := StrToIntDef(Rows1.Text, 12);
iWidth := StrToIntDef(Height1.Text, 200);
iHeight := StrToIntDef(Width1.Text, 200);
iBaseWidth := (iColumns * iWidth) + (iPadding * iColumns);
iBaseHeight := (iRows * iHeight) + (iPadding * iRows);
ImageEnVect1.Clear;
ImageEnVect1.Proc.ImageResize(iBaseWidth, iBaseHeight);
for x := 0 to iColumns - 1 do
for y := 0 to iRows - 1 do
begin
inc(i);
if i < iFilesList.Count - 1 then
begin
iFilename := iFilesList[i];
if FileExists(iFilename) then
begin
with TIEBitmap.Create do
begin
try
Read(iFilename);
Resample(iWidth+ iPadding, iHeight+ iPadding);
RenderToTIEBitmapEx(ImageEnVect1.IEBitmap, (X * (iWidth + iPadding)) , (Y *
(iHeight + iPadding)) , iWidth,
iHeight, 0, 0, Width, Height, 255, rfNone);
finally
Free;
end;
end;
end;
end;
end;
ImageEnVect1.Update;
finally
iFilesList.Free;
end;
finally
Screen.Cursor := crDefault;
end;
end;
The drawing is very fast!
342.22 KB
William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html