Thread: 32bit -> 16bit color problems

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    32

    32bit -> 16bit color problems

    Hello everyone!

    I've made a small 3dapp without using OpenGL or DX, just GDI for displaying my buffer on a bitmap wich is copied to the screen.

    I'd like to make it compatible with 16bit displays as well as 32 bit ones. Is there anyway I can perform the bitdepth reduction without creating a different sized buffer for 16 bit displays. (I know this isn't the best way to handle it but it would save me a lot of work)

    This is the code I use for copying my buffer to a windows bitmap:

    Code:
    SetBitmapBits(hBitmap,BUFFERSIZE,fBuffer.data());
    And after that I use this to display it on the screen

    Code:
    BitBlt(hdc, 0, 0, ciWindowWidth, ciWindowHeight, hdcMem, 0, 0, SRCCOPY)
    Any help would be appreciated

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    If you are using a 32bit bitmap then Windows will handle the color reduction for you.

    Read the BitBlt() documentation.

    If the color formats of the source and destination device contexts do not match, the BitBlt function converts the source color format to match the destination format.
    gg

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    32
    Strange, I tried that before I posted because it seemed logical. I'll try to make a DIBbitmap instead and se if that helps things.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. small -> big -> bigger -> bigger than bigger -> ?
    By happyclown in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 03-11-2009, 12:12 PM
  2. Dev-C++ -> Tools - > Editor -> Syntax
    By Yuri2 in forum C++ Programming
    Replies: 19
    Last Post: 07-03-2006, 07:48 AM
  3. > > > Urgent Help < < <
    By CodeCypher in forum C Programming
    Replies: 2
    Last Post: 01-31-2006, 02:06 PM
  4. 32bit 16bit compilers
    By Benzakhar in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-02-2004, 04:43 PM