procedure BmpToWmf(BmpFile, WmfFile: string);
var
MetaFile: TMetaFile;
MFCanvas: TMetaFileCanvas;
BMP: TBitmap;
begin
{Create temps}
MetaFile := TMetaFile.Create;
try
BMP := TBitmap.Create;
try
BMP.LoadFromFile(BmpFile);
{Equalizing sizes}
MetaFile.Height := BMP.Height;
MetaFile.Width := BMP.Width;
{Create a canvas for the Metafile}
MFCanvas := TMetafileCanvas.Create(MetaFile, 0);
try
{Draw the BMP into the canvas}
MFCanvas.Draw(0, 0, BMP);
{Free the Canvas}
finally
MFCanvas.Free;
end;
finally
{Free the BMP}
BMP.Free;
end;
{Save the Metafile}
MetaFile.SaveToFile(WmfFile);
finally
{Free it}
MetaFile.Free;
end;
end;
end;
Bewerten Sie diesen Tipp:
|
|
|