var
MF: tMetaFile;
i,j : integer;
MyRect : TRect;
// AMC,
BMC : tMetaFileCanvas;
begin
MF:= tMetaFile.create;
with MF do begin
mmWidth:=10000;
mmHeight:=12000;
with TMetaFileCanvas.CreateWithComment(MF,0,'Misc-Test','Text') do free;
with TMetaFileCanvas.Create(MF,0) do try
Draw(0,0,MF);
for j:=1 to 100 do
pixels[random(MF.width),random(MF.Height)]:=clBlue;
MoveTo(0,0);
LineTo(MF.Width,MF.Height);
finally
free;
end;
MetaMain.Image1.width:=MF.width; // show it somewhere
MetaMain.Image1.height:=MF.height; // in an defined image
MetaMain.Image1.Canvas.Draw(0,0,MF);
MetaMain.Image1.Refresh;
MyRect:=Rect(0,0,MF.width,MF.height); // is Draw the problem
// or performs StretchDrw better ??
for i:=1 to 50 do // here the identity test for the
begin // Metafile size starts
BMC:=TMetaFileCanvas.Create(MF,0);
with BMC do try
Draw(0,0,MF);
// StretchDraw(MyRect,MF); // does the same problem
MoveTo(0,0);LineTo(MF.width,MF.Height);
finally
free;
end;
MetaMain.Image1.width:=MF.width; // show it again
MetaMain.Image1.height:=MF.height; // and wonder !!!
MetaMain.Image1.Canvas.Draw(0,0,MF);
MetaMain.Image1.Refresh;
end;
end;
MF.SaveToFile('TT.wmf');
MF.Free;
|