C sharp - bitmap header

 
Vista:

bitmap header

Publicado por Ivan (1 intervención) el 11/06/2008 02:15:14
bueno esto es un trabajo ke tengo ke precentar para la facu y me kede tradicimo porke los datos ke imprimo no son los ke me dicen en la facultad ke deven ser y debe ser porke estoy usando mal alguna funcion alguno me podria ayudar?

Me parece ke el codigo se leemejor asi

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{

struct FileHeader /*BIT MAP FILE HEADER*/
{
char bsignature[2]; /*siempre es BM o 19778 en decimal*/
int bfsize; /*File size*/
short bfreserved; /*siempre ez 0*/
unsigned long bfoffset; /*Offset a los datos de la imagen*/
} bfh;

struct InfoHeader/*[BIT MAP INFO HEADER*/
{
unsigned long bisize; /*Tamaño de éste contenedor. Para nuestro caso es 40*/
unsigned long widht; /*Ancho*/
unsigned long height; /*Alto*/
short biplanes; /*planos SIEMPRE 1*/
short bitcount; /*Bits por pixels*/
unsigned long bicompression; /*Comprecion usamos 0*/
unsigned long bisizeimage; /*bitcount*width)1*height/8*/
unsigned long bixpelsmeter; /*Resolución horizontal*/
unsigned long biypelsmeter; /*Resolución vertical*/
unsigned long biclrused; /*Igual a bitcount*/
unsigned long biclrimportant; /*Numero de colores importates 0 todos importantes*/
} bih;



FILE *fp;

fp=fopen("E:TEST-IMGS1000x750 est-24bpp.bmp", "r");
/*Lectura del BitMapFilehedear*/
fread(&bfh,sizeof(bfh),1,fp);
fread(&bih,sizeof(bih),1,fp);

printf("Signature= %s ",bfh.bsignature);
printf("Size= %d ",bfh.bfsize);
printf("Reserved= %d ", bfh.bfreserved);
printf("Data Offset=%d ",bfh.bfoffset)



esto me imprime
Signature=3 */en un formato muy raro*/
Size= 244
Reserved=61
Data Offset=2

ke porsierto si cambio la imagne imprime otraves lo mismo....

igual seguro ke es algo de la funcion fread mal usado pero no encuentro ke!

desde ya muchas gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder