J'ai cherche un peu de mon cote et j'ai eu pour info ceci
Pour enregistrer une image 12 bit de gris il faut:
BITMAPINFOHEADER
biSize : sizeof (BITMAPINFOHEADER)
biWidth and biHeight : image dimension in pixels
biPlanes : 1
biBitCount : 16
biCompression : 0x8559
biSizeImage : the number of bytes in the image data (typically width * height * 2)
biXPelsPerMeter and biYPelsPerMeter : specifies the horizontal and vertical resolution, in pixels per meter, of the target device for the image.
biClrUsed : the number of significant bits in the image. Typically 12 for high definition scanners.
biClrImportant : 0
Color Table
No color table entries
Pixel Data
Each pixel sample is encoded in a WORD (2 bytes), and is therefore unsigned.
Samples are laid by rows from the upper left pixel to the bottom right pixel. No 32 bits padding is performed at the end of each row.
de mon cote j'ai coé ceci
int SnapToDisk12 (char* CheminBmp)
{
FILE* pFile;
WORD* m_pData = NULL;
int width; //la taille d' une ligne en octets
if (X && Y) //pour ne pas travailler avec des longueur et largeur non initialisees
{
width = WIDTHBYTES(X * 12); // DWORD Align
if ((pFile = fopen(CheminBmp,"wb")) == NULL) //on ouvre le fichier en ecriture
return ERROR_OPEN;
C'est ici que je bloque,
Pour info/
BmpHead = BITMAPFILEHEADER
BmpInf = BITMAPINFO
Il me faudrait DONC :
if ((fwrite (BmpHead, ?, ?, pFile)) != ?)//on ecrit l' entete du fichier Img
return ERROR_WRITE;
if ((fwrite (BmpInf, ?, ?, pFile)) != ?) //on ecrit l' entete du bitmap sans table de couleur
return ERROR_WRITE;
m_pData = new WORD[width * Y]; //tableau d' octets qui contiendra l' image
PS_IMG_GetRawData (0, m_pData);
fwrite (m_pData, 1, width * Y, pFile);
if ((fclose (pFile)) == EOF)
return ERROR_CLOSE;
delete [] m_pData;
m_pData = NULL;
}
return 0; //pour indiquer que le traitement est termine sans erreur
}