Image OverLay

This is a discussion on Image OverLay within the Windows Programming forums, part of the Platform Specific Boards category; Hi UAll, I need help???I am tring to do image overlay. My image DIB 24 bit (3 layer RGB) and ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    68

    Exclamation Image OverLay

    Hi UAll,

    I need help???I am tring to do image overlay. My image DIB 24 bit (3 layer RGB) and i want to do image Overlay on top of it. I know that it is posssible but don't know how to do it. Please some one help you know how to do it. If possible give me an algorithm to do it.

    Thanks

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I'm not exactly sure what you are trying to do. So I'll offer this. BitBlt() has many raster codes for various things. You may want to try MERGEPAINT. This basically ORs the top color and bottom color. So the affect isn't exactly alpha, however, this is about the best you can do without OpenGL, DirectX, or even your own algorithms.

  3. #3
    Unregistered
    Guest

    Image Overlay

    Hi

    I am doing a web cam project, and want to do a overlay of to images. I have captured the image and is in usingned char*, so i want to do a overlay of another transperent image on it. I found a way dut am not sure how to use it. The way that i found is by using Image List, following is the process of the function in Image List

    1) Create Image List Object
    2) Load Images in the Object
    3) Set the OverLay and then Draw it on to the screen


    Thanks
    Pratik

  4. #4
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    You need to merge the chromatic values at all pixels. In RGB, there are three colours. Extract each color value separately from the pixel and merge them to build a new RGB value.

    Here's my own implementation using my own colour type defined as an array of three bytes (red, green & blue). Many other colour types encode colour as a 4 byte integer (for convenience), where three bytes are used and the other is padding.


    typedef unsigned __int8 BGRCol[3];


    Code:
    void BtCol::BGRMerge(const BGRCol orig, const BGRCol mask, int percMask, BGRCol& rslt)
    {
      // Static BGR merge (used with bitmap ScanLine)
      if (percMask <= 0)
      {
        rslt[BGR_BLUE] = orig[BGR_BLUE];
        rslt[BGR_GREEN] = orig[BGR_GREEN];
        rslt[BGR_RED] = orig[BGR_RED];
      }
      else
      if (percMask >= 100)
      {
        rslt[0BGR_BLUE] = mask[BGR_BLUE];
        rslt[BGR_GREEN] = mask[BGR_GREEN];
        rslt[BGR_RED] = mask[BGR_RED];
      }
      else
      {
        int remPerc = 100 - percMask;
    
        rslt[BGR_BLUE] = (orig[BGR_BLUE] * remPerc / 100) + (mask[BGR_BLUE] * percMask / 100);
        rslt[BGR_GREEN] = (orig[BGR_GREEN] * remPerc / 100) + (mask[BGR_GREEN] * percMask / 100);
        rslt[BGR_RED] = (orig[BGR_RED] * remPerc / 100) + (mask[BGR_RED] * percMask / 100);
      }
    Last edited by Davros; 07-14-2002 at 11:13 AM.
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 05:17 AM
  2. Replies: 1
    Last Post: 05-27-2009, 01:46 PM
  3. Replies: 4
    Last Post: 03-02-2003, 09:12 AM
  4. Image OverLay
    By simly01 in forum C Programming
    Replies: 3
    Last Post: 07-11-2002, 08:10 PM

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