1 BGRA转BGR
 2 void BgraToBgr(BYTE *bgraData,int *bgraSize)
 3 {
 4     for(int i=0,j=0; j<*bgraSize; i+=3,j+=4)
 5     {
 6         *(bgraData+i) = *(bgraData+j);
 7         *(bgraData+i+1) = *(bgraData+j+1);
 8         *(bgraData+i+2) = *(bgraData+j+2);
 9     }
10     *bgraSize = *bgraSize/4*3;
11 }
12  
13 BGR转BGRA
14 void BgrToBgra(BYTE **bgrData,int *bgrSize)
15 {
16     int bgraSize = *bgrSize/3*4;
17     BYTE *bgraData = new BYTE[bgraSize];
18     for(int i=0, j=0; j < bgraSize; i+=3, j+=4)
19     {
20         *(bgraData+j) = *(*bgrData+i);
21         *(bgraData+j+1) = *(*bgrData+i+1);
22         *(bgraData+j+2) = *(*bgrData+i+2);
23         *(bgraData+j+3) = 0;
24     }
25     free(*bgrData);
26     *bgrData = bgraData;
27     *bgrSize = bgraSize;
28 }