...BMP in WMF konvertieren?
Autor: Simon Grossenbacher
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;
printed from
www.swissdelphicenter.ch
developers knowledge base