16 BPP Mode

Help
Ricky
2003-08-29
2003-08-30
  • Ricky

    Ricky - 2003-08-29

    The current code for the dll outputs a 24 bpp for the snapshot function. I also wanted to make it show a 16 bpp form of it but I dont know how to convert the variable color (unsigned short) into the form. I already have the header all setup. I tried this:

    line[j*2+1]= color & 0xff;
    line[j*2+0]= (color >> 8) & 0xff;

    since the variable is already in 16 bits but it juss came out as the regular picture but with different colors. Can anyone help me? Thanxs!

     
    • Ricky

      Ricky - 2003-08-30

      My bad, I thought moves were in 16bpp but they are in 24bpp and the orig snapshots in are in 16bpp not 24. :P And I got the code working too.

      // 24 bpp mode

      size=512*1024*3+0x38;

      memset(header,0,0x36);
      header[0]='B';
      header[1]='M';
      header[2]=size&0xff;
      header[3]=(size>>8)&0xff;
      header[4]=(size>>16)&0xff;
      header[5]=(size>>24)&0xff;
      header[0x0a]=0x36;
      header[0x0e]=0x28;
      header[0x12]=1024%256;
      header[0x13]=1024/256;
      header[0x16]=512%256;
      header[0x17]=512/256;
      header[0x1a]=0x01;
      header[0x1c]=0x18;        // bpp mode
      header[0x26]=0x12;
      header[0x27]=0x0B;
      header[0x2A]=0x12;
      header[0x2B]=0x0B;

      #ifdef _WINDOWS
         sprintf(filename,"SNAP\\PEOPSSOFT%03d-24bpp.bmp",snapshotnr);
      #else
         sprintf(filename,"%s/peopssoft%03ld-24bpp.bmp",getenv("HOME"),snapshotnr);
      #endif

      bmpfile=fopen(filename,"wb");

      fwrite(header,0x36,1,bmpfile);
      for(i=511;i>=0;i--)
        {
         for(j=0;j<682;j++)
          {
           line[j*3+2]= ((unsigned char *) psxVuw)[i * 2048 + j * 3];
           line[j*3+1]= ((unsigned char *) psxVuw)[i * 2048 + j * 3 + 1];
           line[j*3+0]= ((unsigned char *) psxVuw)[i * 2048 + j * 3 + 2];
          }
         fwrite(line,1024*3,1,bmpfile);
        }
      fwrite(empty,0x2,1,bmpfile);
      fclose(bmpfile);

      * The above code snippet is thanks to me and Pixel's hard work ^_^ *

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks