DirectDraw colour matching

This is a discussion on DirectDraw colour matching within the Game Programming forums, part of the General Programming Boards category; So I have this ready-made function that matches colours to the closest available colour that can be displayed. It: a) ...

  1. #1
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879

    DirectDraw colour matching

    So I have this ready-made function that matches colours to the closest available colour that can be displayed. It:

    a) gets an HDC for a DirectDraw surface

    b) saves the pixel that is at (0,0)

    c) uses SetPixel() to set it to the colour passed in the arguments

    d) goes through a bunch of other painful-looking steps to figure out what colour was used (i.e. "lock the surface", then "get DWORD", then "Mask it to bpp")

    e) sets the pixel back to the original colour.


    My question is, couldn't it just

    a) get the pixel
    b) use SetPixelV() to set it to the "closest approximation of" the passed colour
    c) GetPixel() to find the colour that was used
    d) set the pixel back to the original colour

    Wouldn't that work just as well? (anyways, what's up with the masking to bpp?)
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Not if you are trying to match a system palette.

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Ok, I'll take your word for it. Guess I'll just have to figure out how the function works.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 06-01-2009, 07:54 PM
  2. Replies: 2
    Last Post: 03-24-2006, 07:36 PM
  3. Going out of scope
    By nickname_changed in forum C++ Programming
    Replies: 9
    Last Post: 10-12-2003, 06:27 PM
  4. Replies: 3
    Last Post: 08-14-2003, 01:37 PM
  5. Colour theory... (weird title)
    By Magos in forum C++ Programming
    Replies: 5
    Last Post: 11-25-2001, 03:16 PM

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