YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
Download Free Trial
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
ActiveX COM Products
Technical Support

Links

Get Ready to Unleash the Power of UCanCode .NET


UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"


VC++ Codes: bitmap, bmWidth, bmHeight, biBitCount

 
 

Code Snippet

Collapse Copy Code
// the blending of the bitmap is quite simple
// (in the OnPaint() method or the WM_PAINT message handler: 
BITMAP bm;
GetObject(background, sizeof(BITMAP), &bm);
AlphaBlend(hdcMemWork, 0,0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, 
           bm.bmWidth, bm.bmHeight, blendFkt)
SelectObject(hdcMem, hbmOld);

// The tricky thing is to pre multiply the alpha channel
// values after loading the 32 bit bitmaps
if(bmInfo.bmiHeader.biBitCount == 32 )
// Alpha Channel
{
    // pre-multiply rgb channels with alpha channel
    for (int y=0; y<bmInfo.bmiHeader.biHeight; ++y)
    {
        BYTE *pPixel= (BYTE *) lpDIBBits + bmInfo.bmiHeader.biWidth * 4 * y;
        for (int x=0; x<bmInfo.bmiHeader.biWidth ; ++x)
        {
            pPixel[0]= pPixel[0]*pPixel[3]/255;
            pPixel[1]= pPixel[1]*pPixel[3]/255;
            pPixel[2]= pPixel[2]*pPixel[3]/255;
            pPixel+= 4;
        }
    }
}

 

 

Copyright ?1998-2009 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net