Results 1 to 40 of 59

Thread: [vb6] Class to make Image Controls Support PNG, TIF, GIF Animation

Threaded View

  1. #11

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

    Re: [vb6] Class to make Image Controls Support PNG, TIF, GIF Animation

    Yes, you can load an image via GDI+ and render it to a 32bpp DIB to use AlphaBlend to render that to a DC. Couple things:

    1) If using GDI+ to load the image and using stdPicture to just cache the image, not sure of the benefits? Why not just use GDI+ to render, you would have the option of rendering at different scales using different interpolation/quality. Once the DIB is created, AlphaBlend's scaling is just as bad as VB. In the class I wrote (post #1), AlphaBlend is used in the assembly thunk. To use GDI+ for scaling would require re-writing that thunk.

    2) You really do not need a loop to transfer the LockBits to DIB. One call is all that's needed
    MemCopy ByVal pDst, ByVal BMSrc.scan0, Rct.Height * Rct.Width * 4

    Caution: LockBits can't be used with metafiles. Crash will result. So, maybe a more generic approach is to render the GDI+ image to the 32bpp DIB instead of transferring the bits. Just a thought.

    Edited & FYI: GDI+ rendering to a DIB where all bits are set to zero is identical to creating a premultiplied bitmap.
    Last edited by LaVolpe; Dec 7th, 2015 at 04:05 PM.
    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