Advertisement
Guest User

convertToBmp

a guest
May 14th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. for(i=0; i<IMG_SIZE; i++){  //En cada pasada estoy leyendo 4 pixeles.
  2.     fread((int *)&buff,1,1,input);  //Leo un byte
  3.     printf("buff vale: %x - ",buff);
  4.     const char *byteChar = (char *)malloc(9);
  5.     byteChar = bytetobin(buff);
  6.        
  7.     int j;
  8.     for (j=0; j<8; j+=2){
  9.         switch (byteChar[j]){
  10.             case '0':
  11.                 if(byteChar[j+1] == '0')
  12.                     putColor(output,grises->white);
  13.                 else
  14.                     putColor(output,grises->lightGrey);
  15.                 break;         
  16.             case '1':
  17.                 if(byteChar[j+1] == '0')
  18.                     putColor(output,grises->darkGrey);
  19.                 else{
  20.                     putColor(output,grises->black);
  21.                 break;             
  22.         }
  23.     }
  24.     printf("posición %d\n",ftell(input));
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement