|
Converting EMF to SWF (vector based EMF to SWF conversion)
SWF Scout library provides an extended support for Windows Metafiles (WMF) and Enhanced Windows Metafiles (EMF). Metafiles can be loaded and converted into a sprite for further use in generated flash movie. And what is more SWF Scout provides .HDC property that can be used as device context (DC) handle parameter in WinGDI/GDI+ functions. For rendering complex EMF (for example, EMF from virtual printers) or complex drawings with complex gradients etc there are properties HDC_HighQuality and HDC_HighQuality_UseBuffer and HDC_AutoEmbeddedFonts (enable it to automatically embed fonts from used in EMF). Use of these properties slow downs EMF2SWF conversion process but you can get almost 99% equal result. This properties require additional "EMF2SWF HighQuality License" To place all vector objects drawn on HDC using .HDC property as sprite into flash (SWF) movie .PlaceFromHDC() method should be used. This method creates and places the new sprite from objects that were drawn on HDC. In this sample you learn how to convert EMF metafile into SWF flash movie using SWF Scout library. To load the metafile we will use .PlayMetaFileToHDC() method that takes the filename of EMF file and plays it to DC of SWF Scout flash library. Then we will place the metafile to the flash movie as sprite using .PlaceFromHDC() method Our sample EMF metafile was generated by virtual EMF printer from HTML document. You can download it here: PrintedHTML.emf (30 KB) Here is VB Source code of Metafile.vbs script that takes PrintedHTML.emf metafile and converts into SWF flash movie: "SWFScout_emf_to_swf.SWF" W = 640 Movie.BeginMovie 0,0,W,H,1,12,6 Movie.HDC_HighQuality = true
' use of this property requires additional EMF2SWF License in registered
version Movie.PlayMetaFileToHDC
"PrintedHTML.emf", 0,0,0.25,0.25 Movie.ShowFrame 1 Movie.EndMovie Movie.SaveToFile "SWFScout_emf_to_swf.swf" download ZIP with all required files and VB script: swfscout_emf_to_swf.zip Generated flash movie (SWFScout_emf_to_swf.swf) below:
|
|
|
Copyright © ByteScout, 2003-2010. Privacy Statement
Microsoft®, Windows®, Windows 2000®, Windows Server®, Windows Vista®, Internet Explorer®, .NET Framework®, ActiveX®, Visual Basic®, Visual C#®, ASP®, ASP.NET®, Excel®, PowerPoint®, are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Adobe®, Flash® and Acrobat® are registered trademarks of Adobe Systems, Incorporated. Mozilla®, Firefox® and the Mozilla and Firefox Logos are registered trademarks of the Mozilla Foundation. Other product names or brandnames used herein are for identification purposes only and might be trademarks or registered trademarks of their respective companies. We disclaim any and all rights to those marks. |
|