Thread: Watermark Pictures

  1. #1
    Registered User CodeGuru's Avatar
    Join Date
    Apr 2003
    Posts
    3

    Watermark Pictures

    I need to place a Bitmap on top of a Bitmap and save it. Sort of like a watermark.
    I use C++ Borland Builder.

    Thank you!

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    We won't give you source code. If you post what you have so far, we'll help you with it.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User CodeGuru's Avatar
    Join Date
    Apr 2003
    Posts
    3
    I did not ask for source code.
    I wanted and idea, or hint.

    This is how i accomplished it:
    Code:
      Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
      try {
        pBitmap->LoadFromFile("C:\\watermark.bmp");
        pBitmap->Transparent = true;
        pBitmap->TransparentColor = clWhite;
        pBitmap->TransparentMode = tmFixed;
        Image1->Canvas->Draw(Image1->Width-205, Image1->Height-33,pBitmap );
      }
      catch (...) {
        ShowMessage("Could not load or display bitmap");
      }
      delete pBitmap;

  4. #4
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    You could use the Canvas property of TBitmap to transfer pixel values from one image to the other. However, this will run slowly.

    If you want it to be fast, use the ScanLine property, which will give you access to the underlying image memory. However, you will need cast values to an appropriate type, which will depend upon the colour depth of the image.

  5. #5
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    >Image1->Canvas->Draw(Image1->Width-205, Image1->Height-33,pBitmap )

    Yeh this works, but it doesn't give you a 'merged' watermarked effect. If you treat each pixel separately, you can achieve this. Hint: if you are delealing with 24bit colour depth images, each pixel will be 3 bytes - red, green & blue.
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Xlib/xcb and drawing pictures
    By Bill Cosby in forum Linux Programming
    Replies: 0
    Last Post: 01-25-2009, 03:45 PM
  2. Tagging Pictures
    By Tonto in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 03-17-2008, 02:44 PM
  3. reading pictures and array
    By sunoflight77 in forum C++ Programming
    Replies: 0
    Last Post: 05-09-2005, 03:16 PM
  4. Writting watermark to image.
    By aker_y3k in forum C++ Programming
    Replies: 5
    Last Post: 03-27-2004, 01:18 PM
  5. pictures
    By TravisS in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 01-06-2003, 02:31 PM