Convert TMetafile->TBitmap

Convert TMetafile->TBitmap

Post by Ingo Sig » Wed, 15 Dec 1999 04:00:00



I load a wmf file with TMetafile->LoadFromFile but I need a TBitmap for
other functions. Can I convert the TMetaFile object to a TBitmap???

Many thanks


 
 
 

Convert TMetafile->TBitmap

Post by Dave Curr » Wed, 15 Dec 1999 04:00:00


Ingo,
Graphics::TMetaFile * mf = new Graphics::TMetaFile();
TBitmap *bm = new TBitmap();
mf->LoadFromFile("afile.wmf");
bm->Assign(mf);
bm->SaveToFile("afile.bmp");
delete bm;
delete mf;

Good luck,
Dave

 
 
 

1. TBitmap -> TMetafile -> TBitmap

I need to be able to convrt TBitmaps into TMetafiles as well as TMetafiles
into TBitmaps.

Trying to use assign, I get an error that TBitmap can't be converted into a
TMetafile ( for get the extact wording, but that is the general meaning).  I
have an application that is supporting several graphics file formats, and I
have given the user the option of selecting what kind of grahics file the
image seen is to be stored as.  I seem to be able to handle the others using
the TBitmap as a neutral intermediate format even when the others don't like
each other particularly well (this is a function of the class libraries I am
using).  But TMetafile and TBitmap don't seem to like each other.

The documentation I have does not provide any help except that in a
TPicture, while supporting both, they are nutually exclusive and won't
convert into each other.

Any suggestions?

Thanks,

Ted

R.E. Byers

2. Fade with distance flare option

3. TMetaFile, TBitmap

4. WWW page graphic artist and illustrator

5. TMetafile/TBitmap conversion runs out of GDI-Resources

6. Looking for cool 3D rooms

7. TJPegImage, TBitmap, TIcon, TMetafile

8. TImage "Out of Resources" and Threads

9. TMetafile converting

10. convert TMetafile object to TJPEGImage

11. TMetaFile Converting ??????????

12. AVI==>pFrame=?=>TBitmap

13. Converting PM 6.0 >>> 6.5