0

I have an .emf file that I want to convert to a bitmap in legacy VC++ 6.0 code.

I've been looking through the WIC documentation and I'm surprised I haven't seen a way to do this.

Am I missing something?

If WIC ends up not supporting this, is there a method programattically load an .emf file into a CBitmap object?

Mr. Awesome
  • 575
  • 1
  • 6
  • 19

1 Answers1

1

There's no need for WIC. It's built into the core of Windows itself in the form of PlayEnhMetafile.

So, to get the picture into a BMP, you select your BMP into a DC, then do PlayEnhMetafile on that DC, and the result will go into the BMP.

Note that this isn't really converting a metafile into a BMP--it's rendering the metafile into the BMP. That is to say, a metafile is (usually) resolution independent. For example, it may specify a line from logical coordinate (0,0) to (100, 100). When you render that into a BMP, you get the line rasterized at a specific resolution. If you later wanted the same picture at higher resolution, the metafile could provide it, but the rendering in the BMP couldn't/can't.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111