Click here to Skip to main content
16,006,510 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dock Bar Source Code (like ObjectDock) Pin
Maximilien29-May-04 10:30
Maximilien29-May-04 10:30 
QuestionHow do I test whether a scrollbar exists ? Pin
Still learning how to code29-May-04 9:53
Still learning how to code29-May-04 9:53 
AnswerRe: How do I test whether a scrollbar exists ? Pin
PJ Arends29-May-04 12:40
professionalPJ Arends29-May-04 12:40 
GeneralRe: How do I test whether a scrollbar exists ? Pin
Still learning how to code31-May-04 10:03
Still learning how to code31-May-04 10:03 
GeneralRe: How do I test whether a scrollbar exists ? Pin
PJ Arends31-May-04 11:57
professionalPJ Arends31-May-04 11:57 
GeneralRe: How do I test whether a scrollbar exists ? Pin
Still learning how to code1-Jun-04 2:43
Still learning how to code1-Jun-04 2:43 
GeneralImporting from password protected .xls (I know the password) Pin
GameFaqsPower12329-May-04 9:27
GameFaqsPower12329-May-04 9:27 
Generalcopying bitmap images in memory Pin
hr_phenom29-May-04 8:55
hr_phenom29-May-04 8:55 
hi all,

I've been experimenting with device contexts and bitmaps for abt 2 weeks now. I'm having difficulty in doing the following and would like some help/advice on it.

The project i'm trying out involves splitting up a bitmap image stored locally on the hard disk into a number of blocks...16 in a 4x4 pattern. The project then involves reading each block for its HSI (hue, sat and intensity) and plotting a histogram on that. By this i basically aim to compare images based on the resulting histogram and find matches out of a database of images.
The problem i'm having is in storing the blocks in memory. The following loads the bitmap...

bool CTemp2Dlg::LoadBitmap(CString sBitmap)
{
CBitmap bmp;
CBitmap* oldBMP;
HBITMAP hBmp;
COLORREF rgb[35][35] = {0};
CString rgbHex [35][35];
CString cTemp;


//////Load Bitmap into file.....
hBmp = (HBITMAP) LoadImage(AfxGetInstanceHandle(), sBitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
bmp.Attach(hBmp);
bmp.GetBitmap (&stBitmap);

oldBMP = m_dcMem.SelectObject(&bmp);
.........
.........
}

m_dcMem is a CDC object defined in the class header file which is initialised as....

void CTemp2Dlg::OnInitDialog()
{
CClientDC dc(this);

m_dcMem.CreateCompatibleDC (&dc);
pDC.CreateCompatibleDC (&dc);
}

....in the OnInitDialog method. Here pDC is a CDC object to which i'm trying to copy a block into. The copy takes place as follows....

void CTemp2Dlg::GetPartOfBitmap(POINT begin, POINT end)
{
bool bError;
CBitmap bitmap;


bError = pDC->BitBlt (begin.x, begin.y, end.x - begin.x, end.y - begin.y, &m_dcMem, 0, 0, SRCCOPY);

}

....where begin and end are point structs for the block dimensions. I've found out that this copy actually doesn't copy over anything. When copied to the CPaintDC dc(this) in OnPaint() nothing comes up on screen and the HSI values for this results in garbage. I can compute the HSI values when using the m_dcMem object (which is the entire picture) but not with the pDC object. Does anyone know how do i copy over a portion of a bitmap image in a CDC object to another one..??

Thanks in advance,
Hari



GeneralRe: copying bitmap images in memory Pin
PJ Arends29-May-04 12:48
professionalPJ Arends29-May-04 12:48 
GeneralVisual C++ Dll for visual basic Pin
soul.ripper29-May-04 8:25
soul.ripper29-May-04 8:25 
GeneralRe: Visual C++ Dll for visual basic Pin
Deian29-May-04 9:07
Deian29-May-04 9:07 
GeneralRe: Visual C++ Dll for visual basic Pin
soul.ripper29-May-04 14:55
soul.ripper29-May-04 14:55 
GeneralRe: Visual C++ Dll for visual basic Pin
Hesham Amin29-May-04 21:40
Hesham Amin29-May-04 21:40 
GeneralCustom Controls Pin
Steve Thresher29-May-04 6:46
Steve Thresher29-May-04 6:46 
GeneralRe: Custom Controls Pin
Joel Lucsy1-Jun-04 4:16
Joel Lucsy1-Jun-04 4:16 
Generalquestion creating dll Pin
Member 466743729-May-04 6:41
Member 466743729-May-04 6:41 
GeneralRe: question creating dll Pin
soul.ripper29-May-04 8:29
soul.ripper29-May-04 8:29 
GeneralRe: question creating dll Pin
Member 466743730-May-04 1:27
Member 466743730-May-04 1:27 
GeneralRe: question creating dll Pin
soul.ripper30-May-04 3:06
soul.ripper30-May-04 3:06 
GeneralRe: question creating dll Pin
Member 466743731-May-04 0:11
Member 466743731-May-04 0:11 
GeneralRe: question creating dll Pin
soul.ripper31-May-04 0:50
soul.ripper31-May-04 0:50 
Generaldrag & drop files onto exe file question Pin
Member 466743729-May-04 6:38
Member 466743729-May-04 6:38 
GeneralRe: drag & drop files onto exe file question Pin
Steve Thresher29-May-04 6:55
Steve Thresher29-May-04 6:55 
GeneralRe: drag & drop files onto exe file question Pin
Michael Dunn29-May-04 10:34
sitebuilderMichael Dunn29-May-04 10:34 
GeneralRe: drag & drop files onto exe file question Pin
Member 466743730-May-04 1:31
Member 466743730-May-04 1:31 

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.