Click here to Skip to main content
15,915,324 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: O.O All my knowledge about asynchronous sockets and message pumps broken.. help.. Pin
Kuniva4-May-04 8:11
Kuniva4-May-04 8:11 
GeneralRe: O.O All my knowledge about asynchronous sockets and message pumps broken.. help.. Pin
Mike Dimmick4-May-04 12:11
Mike Dimmick4-May-04 12:11 
GeneralCFile size in bytes Pin
Jamie Kenyon4-May-04 2:02
Jamie Kenyon4-May-04 2:02 
GeneralRe: CFile size in bytes Pin
David Crow4-May-04 2:16
David Crow4-May-04 2:16 
GeneralRe: CFile size in bytes Pin
andyxia4-May-04 2:33
andyxia4-May-04 2:33 
GeneralRe: CFile size in bytes Pin
Alexander M.,4-May-04 3:18
Alexander M.,4-May-04 3:18 
GeneralRe: CFile size in bytes Pin
Jamie Kenyon4-May-04 4:50
Jamie Kenyon4-May-04 4:50 
QuestionSetDIBitsToDevice causes image to flip, why? Pin
uus994-May-04 2:02
uus994-May-04 2:02 
I have a grayscale image of 100x100px, where the top half is gray (pixel value=128) and the bottom half is black (value=0); however when i plot it to screen, it comes flipped. Why is that? Can anyone help? Here is the source; The result on screen is black followed by gray, which is not what i want. Why is it flipped?

void CPopUpDlg::OnButton1()
{
BITMAPINFO *m_pBmiImage;
CDC *pDC;
BYTE *m_pImg;
pDC =this->GetDC();
DWORD bitmapInfoSize;
int i;
int Width=100;
int Height=100;

//image of 8bit , 100x100pixels
int m_iSize = Width * Height;
m_pImg = new BYTE[m_iSize];

// Bitmap info structure for the image
bitmapInfoSize = sizeof(BITMAPINFO) + 255*sizeof(RGBQUAD);
m_pBmiImage = (BITMAPINFO*)new BYTE[bitmapInfoSize];
m_pBmiImage->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_pBmiImage->bmiHeader.biPlanes = 1;
m_pBmiImage->bmiHeader.biBitCount = 8;
m_pBmiImage->bmiHeader.biCompression = BI_RGB;
m_pBmiImage->bmiHeader.biSizeImage = 0;
m_pBmiImage->bmiHeader.biXPelsPerMeter = 0;
m_pBmiImage->bmiHeader.biYPelsPerMeter = 0;
m_pBmiImage->bmiHeader.biClrUsed = 0;
m_pBmiImage->bmiHeader.biClrImportant = 0;
m_pBmiImage->bmiHeader.biWidth = Width;
m_pBmiImage->bmiHeader.biHeight = Height;

//Set the color table as just grays.
for (i = 0 ; i < 256 ; i++) {
m_pBmiImage->bmiColors[i].rgbBlue = (BYTE)i;
m_pBmiImage->bmiColors[i].rgbGreen = (BYTE)i;
m_pBmiImage->bmiColors[i].rgbRed = (BYTE)i;
m_pBmiImage->bmiColors[i].rgbReserved = 0;
}


//first half of the image is gray
for(i=0;i<100*50;i++) m_pImg[i]=128;

//second half of the image is black
for(i=100*50;i<100*100;i++) m_pImg[i]=0;

//Plot to screen
SetDIBitsToDevice(pDC->m_hDC,
100,
100,
Width,
Height,
0,
0,
0,
Height,
m_pImg,
m_pBmiImage,
DIB_RGB_COLORS);

delete[] m_pImg;
delete m_pBmiImage;
}
AnswerRe: SetDIBitsToDevice causes image to flip, why? Pin
Monty24-May-04 2:15
Monty24-May-04 2:15 
GeneralRe: SetDIBitsToDevice causes image to flip, why? Pin
uus994-May-04 2:27
uus994-May-04 2:27 
GeneralC2440: 'static_cast' Error Pin
sweep1234-May-04 1:51
sweep1234-May-04 1:51 
GeneralRe: C2440: 'static_cast' Error Pin
Mike Dimmick4-May-04 5:17
Mike Dimmick4-May-04 5:17 
GeneralRe: C2440: 'static_cast' Error Pin
sweep1234-May-04 5:56
sweep1234-May-04 5:56 
GeneralFile drag/drop problem, waiting for your help! Pin
andyxia4-May-04 1:21
andyxia4-May-04 1:21 
GeneralHook in dll Pin
yingkou4-May-04 0:31
yingkou4-May-04 0:31 
GeneralRe: Hook in dll Pin
Monty24-May-04 1:44
Monty24-May-04 1:44 
GeneralObj to Source file Pin
Gurou4-May-04 0:29
Gurou4-May-04 0:29 
GeneralRe: Obj to Source file Pin
toxcct4-May-04 0:46
toxcct4-May-04 0:46 
GeneralRe: Obj to Source file Pin
Gurou4-May-04 1:24
Gurou4-May-04 1:24 
GeneralRe: Obj to Source file Pin
toxcct4-May-04 1:27
toxcct4-May-04 1:27 
GeneralSyntax error: identifier 'x' when 2 headers include each other Pin
Ylis4-May-04 0:27
Ylis4-May-04 0:27 
GeneralRe: Syntax error: identifier 'x' when 2 headers include each other Pin
toxcct4-May-04 0:39
toxcct4-May-04 0:39 
GeneralRe: Syntax error: identifier 'x' when 2 headers include each other Pin
Ylis4-May-04 0:54
Ylis4-May-04 0:54 
GeneralRe: Syntax error: identifier 'x' when 2 headers include each other Pin
Jens Doose4-May-04 0:39
Jens Doose4-May-04 0:39 
QuestionHooking a COM port ? Pin
Brian van der Beek4-May-04 0:12
Brian van der Beek4-May-04 0:12 

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.