Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Vich

Bitblt problem

This topic is 5561 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm having problems with an image blit. The picture is loaded well, but it is only displayed in 16 colors instead of 24bit colors. These are parts of the code: defined variables:
  HBITMAP hbmLogo;
BITMAP bm;  
window callback:
    
    case WM_CREATE:
        hbmLogo = (HBITMAP)LoadImage(0, "Data\\textures\\system\\logo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
        if(!hbmLogo)
        {
            MessageBox(hwnd, "Loading of image failed.", "Error", MB_OK | MB_ICONEXCLAMATION);
            return -1;
        }
        GetObject(hbmLogo, sizeof(bm), &bm);
        break;
    case WM_PAINT:
        if(hbmLogo)
        {
            PAINTSTRUCT ps;
            HDC hdcWindow;
            hdcWindow = BeginPaint(hwnd, &ps);
            // draw logo

               HDC hdcMemory;
               hdcMemory = CreateCompatibleDC(hdcWindow);
               SelectObject(hdcMemory, hbmLogo);
               BitBlt(hdcWindow, 0, 0, bm.bmWidth, bm.bmHeight, hdcMemory, 0, 0, SRCPAINT);
               DeleteDC(hdcMemory);
            EndPaint(hwnd, &ps);
        }
        break;    
[edited by - Vich on April 30, 2003 7:50:31 AM]

Share this post


Link to post
Share on other sites
Advertisement
I removed the blitting code and solved the problem by doing this:
It whas worth the full hour of searching on alltheweb.com :|

     logobackground.lbStyle = BS_PATTERN;
logobackground.lbHatch = (long)LoadImage(hInstance,"Data\\textures\\system\\loadlogo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
LoadWndClass.hbrBackground = CreateBrushIndirect(&logobackground);

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!