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!
Printable View
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!
We won't give you source code. If you post what you have so far, we'll help you with it.
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;
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.
>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.