Results 1 to 5 of 5

Thread: [RESOLVED] [GDI+] EMF > WMF & VB6 LoadPicture

Threaded View

  1. #1

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Resolved [RESOLVED] [GDI+] EMF > WMF & VB6 LoadPicture

    Interesting effect but unwanted. After successfully converting GDI+ handle to WMF bits and saving them to file, I am getting semi-transparency when the file is loaded into a VB6 picture/property. But when displayed in GDI+, no noticeable side effects.

    The source image is a GDI+ 32bppARGB bitmap that includes only simple transparency: pixels are either 100% opaque or 100% transparent. It is converted to EMF and then to WMF using this logic. I'll use the GDI+ flat api names, but any .Net solutions would be welcomed as well.

    1. Create blank EMF using desktop DC: GdipRecordMetafileStream
    2. Get EMF graphics: GdipGetImageGraphicsContext
    3. Draw source to EMF: GdipDrawImageRectRect
    4. Convert EMF to windows EMF: GdipGetHemfFromMetafile
    5. Convert EMF bits to WMF: GdipEmfToWmfBits
    6. Write bits to file & clean up

    Attached are the source (32bppARGB bitmap) & converted EMF, WMF. Again, loaded via GDI+ all looks good, but loading WMF into VB6, I'm getting unwanted semi-transparency; not so with the EMF. I have also double & triple checked that the source alpha values are either 0 or 255 and nothing between. Saving an image with transparency produces this effect from the logic I described above.

    Any ideas how to get rid of the semi-transparency for the WMF? Maybe a different way of getting GDI+ handle with simple transparency to windows WMF format? I have tried both 32bppARGB & 8bpp bitmaps (i.e., like a transparent GIF)
    Attached Files Attached Files
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width