copy bitmap over second bitmap

Posted on 2003-03-29
Medium Priority
Last Modified: 2013-11-20
I have a problem.

I want to copy a bitmap over second bitmap at the specified location and then save that bitmap as third bitmap.

if anybody knows the solution then please give sample code.

Question by:malik_mumtaz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 23

Expert Comment

by:Roshan Davis
ID: 8230974
Create two memory dc. Select two bitmaps in two memory DCs.
BilBlt one dc to another.

Using GetDIBits get tha bitmap data, and save the bitmap into a file.

Good Luck

Expert Comment

ID: 8232638
Hmmm, I'd have to guess that you want to copy one bitmap _transparently_ over another bitmap. In that case you will have to apply masking in between the blitting steps. Let me know if that is what you are after and I'll hunt down a tutorial for you.


Author Comment

ID: 8233367
yes f10yd i am looking what you have guessed. i will wait for your response.

Accepted Solution

fl0yd earned 1000 total points
ID: 8233863
This link http://www.codeproject.com/bitmap/transbitmapmask.asp describes hot to draw transparent bitmaps. Saving a bitmap to file is illustrated here: http://www.codeguru.com/bitmap/bitmap_to_file.shtml . Just copy-paste the function and call it with a HBITMAP retrieved from the CBitmap class.

CBitmap MyBmp;
// do your processing
WriteDIB( _T( "filename.bmp" ), (HBITMAP)MyBmp );

You may have to change to WriteDIB declaration using a const HANDLE, i.e.

WriteDIB( LPCTSTR zsFileName, const HANDLE hDIB )

This should get you going.


Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question