Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1512

AlphaBlend and Per Pixel Alpha Help needed

$
0
0
Hi,

Im currently using the Alphablend API for full image alphablending from a source DC to a dest DC, and am aware that you can set its parameter to do per pixel also.

A ton of questions;

1. Is the blending done based on the source alpha only, or does it take into consideration the dest alpha channel and average it out with the result dest alpha being replaced?

2. Premultiplied Alpha for the RGB values are required I read, so does this mean I need to convert a typical RGB with alpha channel image (such as a non premultiplied PNG) prior to getting the effect I need and if im running in 32bpp, does my DC store the image as a premultiplied RGB?

3. I've noticed hardware acceleration applies to the Alphablend API on Windows 7/8, however, I seem to only get this when I work with a source/dest DC that belongs to a form, if I create an offscreen DC through the API, I seem to loose hardware acceleration. I presume this is because hardware acceleration is tied to the WDDM, and any DC's not considered a program window aren't kept in video memory. Is there anyway I can circumvent this, to force a API created DC to be treated like a form's DC and remain hardware accelerated.

4. Hardware acceleration does not apply to GDI+, only GDI API. From what I read the BitBlt, StretchBlt, TransparentBlt and AlphaBlend functions are hw accelerated. TrueType fonts are supposed to be hardware accelerated as well I hear, so I guess api like TextOut is as well. I presume calls to SetPixel(v)/GetPixel result in a surface lock/unlock per call similar to if one was working with a surface in directdraw and thus should be avoided?

Cheers!

Tim

Viewing all articles
Browse latest Browse all 1512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>