ARGB32 相关操作

void ARGB32Rotate(BYTE *des,BYTE *src,int width,int height) 
{ 
	if((!des)||(!src)) 
	{ 
		return; 
	}
	int linesize = width*4;
	for (int index=0; index < height; index++)
		memcpy(&des[((height-1) - index)*linesize],&src[index*linesize], linesize);
} 
//ARGB32 To RGB24
void RGB32To24(BYTE *des,BYTE *src,int width,int height)
{
	int Size=(width*height);
	for (DWORD index=0; index<Size; index++)
	{
		unsigned char r = *(src++);
		unsigned char g = *(src++);
		unsigned char b = *(src++);
		src++;    //跳过颜色空间alpha分量,实现转换
		*(des++) = r;
		*(des++) = g;
		*(des++) = b;   //赋值
	}
}

你可能感兴趣的:(ARGB32 相关操作)