if( dwcompression == bi_bitfields )
return null;
//如果调色板为空,则用默认调色板
hpal = (hpalette) pal.getsafehandle();
if (hpal==null)
hpal = (hpalette) getstockobject(default_palette);
//获取位图信息
bitmap.getobject(sizeof(bm),(lpstr)&bm);
//初始化位图信息头
bi.bisize = sizeof(bitmapinfoheader);
bi.biwidth = bm.bmwidth;
bi.biheight = bm.bmheight;
bi.biplanes = 1;
bi.bibitcount = (unsigned short)(bm.bmplanes * bm.bmbitspixel) ;
bi.bicompression = dwcompression;
bi.bisizeimage = 0;
bi.bixpelspermeter = 0;
bi.biypelspermeter = 0;
bi.biclrused = 0;
bi.biclrimportant = 0;
//计算信息头及颜色表大小
int ncolors = 0;
if(bi.bibitcount <= 8)
{