Problems with DIB in a resource

This is a discussion on Problems with DIB in a resource within the Windows Programming forums, part of the Platform Specific Boards category; I have an 8bit DIB as a bitmap resource. The problem is that I can't paint the bitmap properly in ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    70

    Problems with DIB in a resource

    I have an 8bit DIB as a bitmap resource.

    The problem is that I can't paint the bitmap properly in 256 color mode. When the bitmap is displayed its colors looks strange.

    I use LoadBitmap to get the handle to the bitmap and then I blit it to the screen from memory context.

    Is there any quick way to solve this problem ? How do I get the palette from the bitmap resource ?

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Have you tried

    SetStretchBltMode(hdcScreen,HALFTONE);

    the help says you should realign the pen but I never have had a problem.

    What flag are you BitBlt()ing with?

    Try SRCCOPY
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    70

    No, blitting is OK.

    Try to make a 256 color bmp file, include it in a resource script, load it by LoadBitmap, select it to the memory context and blt it to the window. If you are on 256 color display you won't get the picture with proper colors. But, on true color display all is OK.

    I think I can't use LoadBitmap, because this function creates compatible bitmap (always compatible with current display mode) with no color information linked. If I would be able to get the palette from the resource I think I can set (or 'realize') the proper colors for the picture.

    DIB and palettes is pretty new thing for me and I have no time to go through the amount of pages in the Petzold's book.

    Is anybody able to point me how to quickly manage this problem?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. resource problems
    By Dark_Phoenix in forum Windows Programming
    Replies: 2
    Last Post: 10-19-2008, 12:26 PM
  2. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  3. Resource Help
    By mikeman118 in forum Windows Programming
    Replies: 4
    Last Post: 09-03-2007, 01:33 PM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 09:52 AM
  5. Problems with resource files
    By Unregistered in forum C++ Programming
    Replies: 18
    Last Post: 08-31-2001, 08:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21