|
-
Dec 7th, 2015, 01:09 PM
#11
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|