需要带调色版的位图信息读取方法,希望能得到点资料.
谢谢高手们.
[email protected]

解决方案 »

  1.   

    for(int i=0;i<tmpHeight;i++)
    {
    yd=BFH.bfOffBits+i*PerLine;
    BYTE *pbyte= new BYTE[600*PerLine+600];
    memset(pbyte,0x00,600*PerLine+600);
    int  stmp=0;
    for(int j=0;j<wNewWidth;j++)
    {
    xd=yd+j;
    fseek(fp,xd,SEEK_SET);
    fread(&counts,sizeof(BYTE),1,fp);
    BYTE bcounts=counts;
    BYTE mcounts=counts>>4;
                               int scounts=mcounts & 0x0F;

    int art;
    art=bcounts & 0x0F; RGBQUAD color;
    color=ColorTab[scounts];
    pbyte[stmp++]=color.rgbBlue;
    pbyte[stmp++]=color.rgbGreen;
    pbyte[stmp++]=color.rgbRed;
    tmp=tmp+3;
    RGBQUAD color1; 
    color1=ColorTab[art];
    pbyte[stmp++]=color1.rgbBlue;
    pbyte[stmp++]=color1.rgbGreen;
    pbyte[stmp++]=color1.rgbRed;
    tmp=tmp+3;     
    }
    file.Write(pbyte,stmp);//位图内容
    delete []pbyte;
    这个4位转为24位图象的时候有些图象正常有些就不正常,
    哪位知道原因啊
      

  2.   

    for(int i=0;i<tmpHeight;i++)
    {
    yd=BFH.bfOffBits+i*PerLine;
    BYTE *pbyte= new BYTE[600*PerLine+600];
    memset(pbyte,0x00,600*PerLine+600);
    int  stmp=0;
    for(int j=0;j<wNewWidth;j++)
    {
    xd=yd+j;
    fseek(fp,xd,SEEK_SET);
    fread(&counts,sizeof(BYTE),1,fp);
    BYTE bcounts=counts;
    BYTE mcounts=counts>>4;
                      int scounts=mcounts & 0x0F;

    int art;
    art=bcounts & 0x0F; RGBQUAD color;
    color=ColorTab[scounts];
    pbyte[stmp++]=color.rgbBlue;
    pbyte[stmp++]=color.rgbGreen;
    pbyte[stmp++]=color.rgbRed;

    RGBQUAD color1; 
    color1=ColorTab[art];
    pbyte[stmp++]=color1.rgbBlue;
    pbyte[stmp++]=color1.rgbGreen;
    pbyte[stmp++]=color1.rgbRed;
    }
    file.Write(pbyte,stmp);//位图内容
    delete []pbyte;
    }