13,825
社区成员
发帖
与我相关
我的任务
分享
pBitmap2->Height = pBitmap1->Width;
for(int y = 0; y<pBitmap1->Width; y++) { // 从左到右扫描bitmap1的每一列
ptr2 = (Byte*)(pBitmap2->ScanLine[y]);// ptr2指向了bitmap2的第y行
for(int x=0; x<pBitmap1->Height; x++) { // 对于bitmap1中的每一列,按行扫描
ptr1 = (Byte*)(pBitmap1->ScanLine[x]);// ptr1指向bitmap1中的第x行
ptr2[x] = ptr1[y]; // 把bitmap1中第x行第y列的值传递给bitmap2中的第y行第x列
}
}
for ( int i=0; i<pBitmap2->Height; i++ )
for ( int j=0; j<pBitmap2->Width; j++ )
pBitmap2->ScanLine[i][j] = pBitmap1->ScanLine[j][i];
for ( int i=0; i<pBitmap2->Height; i++ ) {
byte *ptr2 = (Byte*)pBitmap2->ScanLine[i];
for ( int j=0; j<pBitmap2->Width; j++ )
ptr2[j] = pBitmap1->ScanLine[j][i];
}
for ( int i=0; i<pBitmap2->Height; i++ ) {
byte *ptr2 = (Byte*)pBitmap2->ScanLine[i];
for ( int j=0; j<pBitmap2->Width; j++ ) {
byte *ptr1 = (Byte*)pBitmap1->ScanLine[j];
ptr2[j] = ptr1[i];
}
}