Combine bitmaps

tibi
10-09-2000, 02:54 PM
Hi!

I would like to combine 2 bitmaps to a result bitmap, somehow like this:
Where the pixels of the first bitmap are not white, they appear on the result bitmap, and where the pixels of the first bitmap are white, the pixels of the second bitmap appear on the result bitmap. (Just like a transparent gif on a bitmap.)
I've tried to do this with the PictureBox's PaintPicture method, but it hadn't worked. Can someone help me about this? Please write.

TB

amram71
10-11-2000, 05:27 PM
I don't completely understand what you want to do, but I can teel you that you can use the Point Function of PictureBox to get the pixel color of a certain coord...

For example
Pic1.Point(1,1) would retrieve the color of the first pixel

tibi
10-13-2000, 05:43 AM
Hello,

Thank you for your answer.

All I want to do is combine 2 bitmaps. The result of this combination is also a bitmap. The combination must be fast, that is why I couldn't use the pixel to pixel combination. I need a simple and a fast combine process, that works like this:
If the pixel of the first bitmap are not white, then this pixel appears on the result bitmap at the same position, and if the pixel of the first bitmap are white, then the pixel of the second bitmap at the same position appears on the result bitmap.
I think you will undersand this, but if you don't I'll write again.

Thanks,
TB

adebuigny
10-13-2000, 12:25 PM
Hmmm. Pretty much any combination of that type would have to be a pixel by pixel comparison. I can see no way of getting around the speed problem. Any tool that could do this for you would have to do the pixel by pixel comparison anyway.

Good luck.

BillSoo
10-13-2000, 12:28 PM
I found some code on planet source code by Simon Price that may help. He wrote a rotating cube in VB and he does not use the pixel functions.

Basically, he takes a bitmap, redirects an array to point to the bitmap, and manipulates the array to cause changes in the bitmap. It seems pretty tricky and I don't fully understand all of his code but maybe it's a start...

Check psc anyways, there are other examples that may help.

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

BillSoo
10-13-2000, 01:21 PM
I decided to see how well I understood the algorithm mentioned above. I just wrote the attached code...it should do what you want. The only difference is that I used BLACK for the "transparent" colour instead of WHITE.

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum