关于8位BMP图象的转置

 int lImageWidth,lImageHeight,lImageBitCount;

 BYTE* pImageBuff=NULL;

 pImageBuff=。。。BuffAddr();  

lImageWidth=。。。Width();

 lImageHeight= 。。。Height();  

int outWidth=lImageHeight;

 int outHeight=lImageWidth;

 lImageBitCount= 8; 

 int nLineWidth=(outWidth+3)/4*4;//凑成大于等于nColumn的最小的4 的整数倍。

 int size=iImageHeight*nLineWidth;

 BYTE* tempPixel=new BYTE[size];  

memset(tempPixel,0,size);

 BYTE* copyPixel=NULL;

 BYTE* objPixel=NULL;  

int x=0;

 int y=0;  

int tempJ=0;

 for (UINT j=0;j<outHeight;j++)

 {  

 x=j;

  tempJ=j*nLineWidth;

  for (UINT i=0;i<outWidth;i++)

  {   

// y=i;   

//copyPixel=pImageBuff+y*outHeight+x;

   //objPixel=tempPixel+tempJ+i;  

  //memcpy(objPixel,copyPixel,1);    

   *(tempPixel+tempJ+i)=*(pImageBuff+i*outHeight+j);   

  }

 }

posted on 2014-03-15 11:22  老能  阅读(256)  评论(0编辑  收藏  举报