Hi!
My problem looks quite strange baecause when I save to bmp file my picture is saved upside down..I need to save it in rigth order but I don't know how. Below my code which I use to save the picture:
//////////////////////////////////////////////////////////////
HANDLE hf = CreateFile("C:\\!!BMP\\SKRP.bmp", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, NULL, NULL );
if( hf == INVALID_HANDLE_VALUE )
{
return ;
}
BITMAPFILEHEADER bfh;
memset( &bfh, 0, sizeof( bfh ) );
bfh.bfType = 'MB';
bfh.bfSize = sizeof( bfh ) + dwSize + sizeof( BITMAPINFOHEADER );
bfh.bfOffBits = sizeof( BITMAPINFOHEADER ) + sizeof( BITMAPFILEHEADER );
DWORD Written = 0;
WriteFile( hf, &bfh, sizeof( bfh ), &Written, NULL );
///
// Write the bitmap format
//
BITMAPINFOHEADER bih;
memset( &bih, 0, sizeof( bih ) );
bih.biSize = sizeof( bih );
bih.biWidth = 320;
bih.biHeight = 240 ;
bih.biPlanes = 0;
bih.biBitCount = 24;
bih.biCompression = BI_RGB;
bih.biClrImportant = 0;
bih.biClrUsed = 0;
Written = 0;
WriteFile( hf, &bih, sizeof( bih ), &Written, NULL );
// Write the bitmap bits
//
Written = 0;
WriteFile( hf, pImage, dwSize, &Written, NULL );
CloseHandle( hf );
//////////////////////////////////////////////////////////
Thats all. If anybody knows what I'm doing wrong please reply on my question.
Best regards
Bartec
My problem looks quite strange baecause when I save to bmp file my picture is saved upside down..I need to save it in rigth order but I don't know how. Below my code which I use to save the picture:
//////////////////////////////////////////////////////////////
HANDLE hf = CreateFile("C:\\!!BMP\\SKRP.bmp", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, NULL, NULL );
if( hf == INVALID_HANDLE_VALUE )
{
return ;
}
BITMAPFILEHEADER bfh;
memset( &bfh, 0, sizeof( bfh ) );
bfh.bfType = 'MB';
bfh.bfSize = sizeof( bfh ) + dwSize + sizeof( BITMAPINFOHEADER );
bfh.bfOffBits = sizeof( BITMAPINFOHEADER ) + sizeof( BITMAPFILEHEADER );
DWORD Written = 0;
WriteFile( hf, &bfh, sizeof( bfh ), &Written, NULL );
///
// Write the bitmap format
//
BITMAPINFOHEADER bih;
memset( &bih, 0, sizeof( bih ) );
bih.biSize = sizeof( bih );
bih.biWidth = 320;
bih.biHeight = 240 ;
bih.biPlanes = 0;
bih.biBitCount = 24;
bih.biCompression = BI_RGB;
bih.biClrImportant = 0;
bih.biClrUsed = 0;
Written = 0;
WriteFile( hf, &bih, sizeof( bih ), &Written, NULL );
// Write the bitmap bits
//
Written = 0;
WriteFile( hf, pImage, dwSize, &Written, NULL );
CloseHandle( hf );
//////////////////////////////////////////////////////////
Thats all. If anybody knows what I'm doing wrong please reply on my question.
Best regards
Bartec