Thread: DIB masking

  1. #1
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218

    DIB masking

    Hi;

    im reading on this book that is taking a whole chapter to explain on color masking and compression for DIBs specialy BITFIELD flag
    and it looks that decoding these DIBS requires me to come up with my own routines to comeup with handling the masks and soforth .it actually makes it to look as if half of setting up and showing a bitmap on window has to do with lots of work on masking and compression.but when i look at some codes of others for viewing bitmap there is hardly any code related to this masking procedure if any. i havent done any DIB viewer code before so can some one tell me if i need to do a lot of work on comp and masking for a simple programm or GDI functions have their own predefined routin to figure it out for me?

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    BITFIELD is only in the 16 bit dib case. It's a strange system that is pretty much pointless but they CAN turn up occasionally. It works like this...

    you get 3 two-byte masks to work with, one each for red, green and blue.

    you apply the mask to the two bytes that represent the pixel. Recognize that you should do some bit shifting to move those bits into the right place. then, you have a red, green or blue from the result of the & operation.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DDB vs. DIB (Clarification needed)
    By Kurisu33 in forum Windows Programming
    Replies: 2
    Last Post: 08-27-2006, 07:22 PM
  2. understand masking bits
    By musikluvah in forum C++ Programming
    Replies: 2
    Last Post: 02-03-2006, 11:31 PM
  3. DIB & DDB
    By samsam1 in forum Windows Programming
    Replies: 3
    Last Post: 01-19-2003, 12:33 PM
  4. Masking a surface
    By malloc(BOB) in forum Windows Programming
    Replies: 0
    Last Post: 09-05-2002, 12:49 PM
  5. How can I do the following..
    By Dual-Catfish in forum C++ Programming
    Replies: 14
    Last Post: 05-01-2002, 03:38 AM