[VC++/WinAPI] DDB to DIB

This is a discussion on [VC++/WinAPI] DDB to DIB within the Windows Programming forums, part of the Platform Specific Boards category; im guessing grey is 50% transparent? then make it = (pixel in bitmap + pixel in background) / 2...

  1. #16
    Registered User
    Join Date
    Aug 2003
    Posts
    288
    im guessing grey is 50% transparent? then make it = (pixel in bitmap + pixel in background) / 2

  2. #17
    Registered User jagi's Avatar
    Join Date
    Mar 2005
    Location
    Poland
    Posts
    21
    im guessing grey is 50% transparent? then make it = (pixel in bitmap + pixel in background) / 2
    it works thanks, I was looking for it, I didn't know that is so easy Big thanks my master
    [I'm from Poland]
    [Sorry for my English, because I just learn]

  3. #18
    Registered User jagi's Avatar
    Join Date
    Mar 2005
    Location
    Poland
    Posts
    21
    I thought that it works, but it works only for mask with RGB(128,128,128).

    Example

    Bitmap RGB(185,185,185)
    Mask RGB(0,0,0)
    Background RGB(100,0,0)

    RED (185 + 100) * (0 / 256) = 285 * 0 = 0 // but should be 100
    GREEN ...
    BLUE ...

    Bitmap RGB(185,185,185)
    Mask RGB(100,100,100)
    Background (100,0,0)

    RED (185 + 0) * (100 / 256) = 185 / 0,390625 = 72 // but should be 133
    GREEN ...
    BLUE ...

    So how do it correctly ?
    [I'm from Poland]
    [Sorry for my English, because I just learn]

  4. #19
    Registered User
    Join Date
    Aug 2003
    Posts
    288
    hmm.. whats the point of a mask thats 0, 0, 0? that just means use all the data from the bitmap..

    and for the second mask, well since 128, 128, 128 = 50% because 128 / 256 = .5..

    100 / 256 = 0.390625, so use 0.390625 from the value of the pixel of bitmap and (1 - 0.390625 = 0.609375) from the value of the pixel of the background..

    like so: 0.390625 * pixel in bitmap + 0.609375 * pixel in background

    if you do the same for all other values of the mask, im sure you could figure out an algorithm so you can handle masks of all colors

  5. #20
    Registered User jagi's Avatar
    Join Date
    Mar 2005
    Location
    Poland
    Posts
    21
    yes yes it works at last thanks for help my master
    [I'm from Poland]
    [Sorry for my English, because I just learn]

Page 2 of 2 FirstFirst 12
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. DIB & DDB
    By samsam1 in forum Windows Programming
    Replies: 3
    Last Post: 01-19-2003, 11:33 AM
  3. How can I do the following..
    By Dual-Catfish in forum C++ Programming
    Replies: 14
    Last Post: 05-01-2002, 03:38 AM

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