DelphiFAQ Home Search:

Join two *.wmf files together - adding one to the end of the other

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Question:

I need to join two *.wmf files together - adding one metafile to the end of the other metafile.

Answer:

You need ot 'play back' those meta files in the order desired into the canvas of the new to be created meta file. The code below plays 'w1.wmf' and the 'w2.wmf' and saves it under 'w_merged.wmf'.

  MetaFile1 := TMetaFile.Create;
  MetaFile2 := TMetaFile.Create;
  DestMetaFile := TMetaFile.Create;
  try
    MetaFile1.LoadFromFile('w1.wmf');
    MetaFile2.LoadFromFile('w2.wmf');
    DestMetaFile.Width := Max(MetaFile1.Width, MetaFile2.Width);
    DestMetaFile.Height := MetaFile1.Height + MetaFile2.Height;
    MetaFileCanvas := TMetaFileCanvas.Create (DestMetaFile, 0);
    try
      MetaFileCanvas.Draw (0, 0, MetaFile1);
      MetaFileCanvas.Draw (0, MetaFile1.Height, MetaFile2);
    finally
      MetaFileCanvas.Free;
    end;
    DestMetaFile.SaveToFile('w_merged.wmf');
  finally
    MetaFile1.Free;
    MetaFile2.Free;
    DestMetaFile.Free;
  end;

Comments:

2006-09-08, 18:25:07
anonymous from United States  


Keywords:

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.