Click here to Skip to main content
15,077,931 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to copy from CBitmap to CBitmap Pin
ThatsAlok6-Jun-06 18:42
MemberThatsAlok6-Jun-06 18:42 
GeneralRe: How to copy from CBitmap to CBitmap Pin
Hamid_RT6-Jun-06 18:56
MemberHamid_RT6-Jun-06 18:56 
AnswerRe: How to copy from CBitmap to CBitmap Pin
ThatsAlok6-Jun-06 1:59
MemberThatsAlok6-Jun-06 1:59 
GeneralRe: How to copy from CBitmap to CBitmap Pin
gomez_a6-Jun-06 2:43
Membergomez_a6-Jun-06 2:43 
GeneralRe: How to copy from CBitmap to CBitmap Pin
Hamid_RT6-Jun-06 2:52
MemberHamid_RT6-Jun-06 2:52 
GeneralRe: How to copy from CBitmap to CBitmap Pin
gomez_a6-Jun-06 5:24
Membergomez_a6-Jun-06 5:24 
GeneralRe: How to copy from CBitmap to CBitmap Pin
Hamid_RT6-Jun-06 18:57
MemberHamid_RT6-Jun-06 18:57 
GeneralRe: How to copy from CBitmap to CBitmap Pin
gomez_a6-Jun-06 23:45
Membergomez_a6-Jun-06 23:45 
Suppose we have a class:

class CBitmapViewer : public CWnd
{
...

public:
CBitmap m_Bitmap; // the BMP is loaded here
CRect R; // the whole window size

public:
virtual BOOL Create(CWnd* pParentWnd, const RECT& rect, UINT nID,
DWORD dwStyle = WS_VISIBLE);
BOOL SetBitmap(UINT nIDResource);
};


I am creating the picture 1:
CRect RPicture1(10, 10, 200, 200);
mPicture1 = new CBitmapViewer();
mPicture1->Create(this, RPicture1, ID_OBRAZEK);
mPicture1->SetBitmap(IDB_BITMAP_CHILD);

I am creating the picture 2:
CRect RPicture2(10, 220, 200, 410);
mPicture2 = new CBitmapViewer();
mPicture2->Create(this, RPicture2, ID_OBRAZEK);
mPicture2->SetBitmap(IDB_BITMAP_CHILD);

There are two picture on the screen.
Now the user can mark the part of the first window.
This coorinates are placed in CRect Rf.
Now, I am cutting down a part of the picture one - using the Rf coordinates:

int mWidth = Rf.Width();
int mHeight = Rf.Height();

CBitmap bmp_part;
bmp_part.CreateBitmap(mWidth, mHeight, 1, 24, NULL);

// get the bitmap size
BITMAP bitmap_size;
bmp_part.GetObject(sizeof(BITMAP), &bitmap_size);

// get a bitmap's part from Picture1 and place them into the bmp_part
unsigned char *pData2 = new unsigned char[bitmap_size.bmHeight * bitmap_size.bmWidthBytes];
mPicture1->m_Bitmap.GetBitmapBits(bitmap_size.bmHeight * bitmap_size.bmWidthBytes, pData2);
bmp_part.SetBitmapBits(bitmap_size.bmHeight * bitmap_size.bmWidthBytes, pData2);
delete[] pData2;

/*
when I have a part of the Picture1 in the bmp_part a want to replace a Picture2 with bmp_part.
*/

For example using:
mPicture2.Assign(&bmp_part);

or I can to create the new object:

mNewBitmap = new CBitmapViewer();
mNewBitmap->Create(this, R3, ID_OBRAZEK3); // CRect R3 - where the window is placed
mNewBitmap->AssignBitmap(&bmp_part);


From this moment I want some help, becouse I don't know how to do it

Regards

GeneralRe: How to copy from CBitmap to CBitmap Pin
Hamid_RT7-Jun-06 2:03
MemberHamid_RT7-Jun-06 2:03 
GeneralRe: How to copy from CBitmap to CBitmap Pin
ThatsAlok6-Jun-06 18:13
MemberThatsAlok6-Jun-06 18:13 
QuestionShared Memory Writing Pin
velayudhan_raj6-Jun-06 1:03
Membervelayudhan_raj6-Jun-06 1:03 
AnswerRe: Shared Memory Writing Pin
Laxman Auti6-Jun-06 1:13
MemberLaxman Auti6-Jun-06 1:13 
GeneralRe: Shared Memory Writing Pin
velayudhan_raj6-Jun-06 1:15
Membervelayudhan_raj6-Jun-06 1:15 
GeneralRe: Shared Memory Writing Pin
ThatsAlok6-Jun-06 1:57
MemberThatsAlok6-Jun-06 1:57 
AnswerRe: Shared Memory Writing Pin
Viorel.6-Jun-06 1:29
MemberViorel.6-Jun-06 1:29 
AnswerRe: Shared Memory Writing Pin
Hamid_RT6-Jun-06 1:41
MemberHamid_RT6-Jun-06 1:41 
AnswerRe: Shared Memory Writing Pin
James R. Twine6-Jun-06 3:13
MemberJames R. Twine6-Jun-06 3:13 
QuestionKernal32.lib .....Error at run Pin
zahid_ash6-Jun-06 0:55
Memberzahid_ash6-Jun-06 0:55 
AnswerRe: Kernal32.lib .....Error at run Pin
_AnsHUMAN_ 6-Jun-06 1:04
Member_AnsHUMAN_ 6-Jun-06 1:04 
QuestionRe: Kernal32.lib .....Error at run Pin
David Crow6-Jun-06 3:31
MemberDavid Crow6-Jun-06 3:31 
Questioncompiler creation Pin
c076-Jun-06 0:46
Memberc076-Jun-06 0:46 
AnswerRe: compiler creation Pin
Sarath C6-Jun-06 1:01
MemberSarath C6-Jun-06 1:01 
GeneralRe: compiler creation Pin
c076-Jun-06 4:00
Memberc076-Jun-06 4:00 
QuestionMouse move event Pin
RajiRaghu6-Jun-06 0:43
MemberRajiRaghu6-Jun-06 0:43 
Questionconversion to _bstr_t - newbie Pin
antonaras6-Jun-06 0:29
Memberantonaras6-Jun-06 0:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.