Bitmap To Metafile

Submitted by:Andery Smith

Date added:06 July, 2013

Category:Delphi

Converts a bitmap into an extended meta file object.

Tags: convert bitmap

Code Snippet:

procedure BitmapToMetafile(const Bmp: Graphics.TBitmap;
const EMF: Graphics.TMetafile);
var
MetaCanvas: Graphics.TMetafileCanvas; // canvas for drawing on metafile
begin
EMF.Height := Bmp.Height;
EMF.Width := Bmp.Width;
MetaCanvas := Graphics.TMetafileCanvas.Create(EMF, 0);
try
MetaCanvas.Draw(0, 0, Bmp);
finally
MetaCanvas.Free;
end;
end;
 
 

Comments