gdiplus : how to mix images?

I have bitmap created like this:
pBitmap=new Bitmap(hBitmap,(HPALETTE)NULL);

How can I add small transparent image(cursor) to this bitmap ?

Thank you
LVL 2
serg111Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnGabyCommented:
You can create a Graphics object based in a Bitmap, and then paint another image into the bitmap:

http://msdn.microsoft.com/en-us/library/ms536159%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms535746%28VS.85%29.aspx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
serg111Author Commented:
Ok , but which function to use to pain transparent image on top of bitmap?
JohnGabyCommented:
Is the source image transparent (e.g. a png image)?  If so, you just load the image and when you paint it, it will honor the transparency.
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

serg111Author Commented:
I have transparent GIF image. What program I need to transform it to PNG? Microsoft Paint?

Also I recall that I've already been painting images with help of gdiplus::Graphics but old image was overwriten by new image. Or I am mistaken?

Thank you
JohnGabyCommented:
GDI+ will read  GIF files also.
serg111Author Commented:
Also I am not sure Paint will do in my case.
I want to modify Bitmap so I can save it later to file (I have code for saving Bitmap)
And Paint does paint to screen not to 2nd Bitmap?
JohnGabyCommented:
I am really not sure what you mean by "Paint'.  The function I suggested was 'DrawImage' (did you even look at the links I provided?).  In any case, the last time I tried to help you with GDI+ questions, you asked question after question, which I spent a great deal of time answering, only to have you later abandon the whole thread.  Frankly, I don't really think I can help you further.  Perhaps you need someone else who can explain things better than I can.
serg111Author Commented:
JohnGaby,

My current question is like this:
"How can I add small transparent image(cursor) to this bitmap ?"
Please check this question...

That is what I am asking about... output image to bitmap.
Not how to Paint image or DrawImage() ... ouput image to screen

Thank you
JohnGabyCommented:
I have ALREADY told you how to do that.  You create a Graphics object using the Bitmap object into which you want to paint.  Then you call the DrawImage method of that object and pass in the Bitmap object which contains your GIF file.  The result will be a Bitmap object which combines the two image.

serg111Author Commented:
>>The result will be a Bitmap object which combines the two image

Not sure what do you mean. DrawImage() accept one Bitmap object only... and does not return second Bitmap object...
Status DrawImage(          Image *image,
    const Point *destPoints,
    INT count
);

pgnatyukCommented:
1. Create new Bitmap object (new Bitmap with with, height and pixel format)
2. Create Graphics from this Bitmap (Graphics::FromImage)
3. Draw first image on it.
4. Draw second image on it.
On the image you create in 1., you have both images.

pgnatyukCommented:
http:#a26105022 was the answer.
It will be great if http:#a26117382 will be the assisted solution.

JohnGabyCommented:
I agree with pgnatyuk, we answered his question.  We cannot help it if he was unable to understand the answer.  I would be happy to split the points with pgnatyuk.
pgnatyukCommented:
Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.