Results 1 to 18 of 18

Thread: AlphaBlend will not compile

Threaded View

  1. #16
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    Hi aewarnick,

    There are several functions you must use to accomplish this.

    First function you use, is to convert DDB to DIB

    pBGR MyGetDibBits(HDC hdc, HBITMAP hBmp, int nWidth, int nHeight);

    In the first call, you pass the hdc and hBmp of the source bmp and its dimension. it will return a pointer of sBGR type(pBGR).

    In the second call, you pass the hdc and hBmp of the destination bmp and its dimension. it will return a pointer of sBGR type(pBGR).

    The dimensions used in both calls must be the same.

    Next you use the AlphaBlend function.

    void MyAlphaBlend(pBGR pDest, int nWidth, int nHeight, pBGR pSrc, BYTE Alpha);

    Then you use the last function to convert the DIB to DDB,

    int MySetDibBits(HDC hdc, HBITMAP hBmp, int nWidth, int nHeight, pBGR buf);

    The hdc and hBmp parameters are the ones you will be using to bitblt.

    buf is the pDest parameter you feed to MyAlphaBlend()

    The return value is the number of scan lines copied.

    Now you can bitblt.

    Before the program ends, remember to free the 2 pBGR pointers received from the 2 MyGetDibBits()

    ======================================================
    To know more about DIB, you can read 'Windows Programmng' by Charles Petzold. To know more about GetDibBits() and SetDibBits(), you can consult msdn docs.

    Here's the attached source, remove the stdafx header if you are not using MFC.
    Attached Files Attached Files

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