給你個範例
1:
int h = bmp->Height/2;
int w = bmp->Width/2;
Graphics::TBitmap *bmp1 = new Graphics::TBitmap();
bmp1->Width = w;
bmp1->Height = h;
bmp1->PixelFormat = pf24bit;
for (int i=0;i memcpy(bmp1->ScanLine[i],bmp->ScanLine[i],w*3);
Image1->Picture->Bitmap->Assign(bmp1);
delete bmp1;
2:
int h = bmp->Height/2;
int w = bmp->Width/2;
BYTE *p;
Graphics::TBitmap *bmp1 = new Graphics::TBitmap();
bmp1->Width = w;
bmp1->Height = h;
bmp1->PixelFormat = pf24bit;
for (int i=0;i {
p = (BYTE *)bmp->ScanLine[i];
memcpy((BYTE *)bmp1->ScanLine[i],p w * 3,w*3);
}
Image1->Picture->Bitmap->Assign(bmp1);
delete bmp1;
3:
int h = bmp->Height/2;
int w = bmp->Width/2;
Graphics::TBitmap *bmp1 = new Graphics::TBitmap();
bmp1->Width = w;
bmp1->Height = h;
bmp1->PixelFormat = pf24bit;
for (int i=h;i memcpy(bmp1->ScanLine[i - h],bmp->ScanLine[i],w*3);
Image1->Picture->Bitmap->Assign(bmp1);
delete bmp1;
4:
int h = bmp->Height/2;
int w = bmp->Width/2;
BYTE *p;
Graphics::TBitmap *bmp1 = new Graphics::TBitmap();
bmp1->Width = w;
bmp1->Height = h;
bmp1->PixelFormat = pf24bit;
for (int i=h;i {
p = (BYTE *)bmp->ScanLine[i];
memcpy((BYTE *)bmp1->ScanLine[i - h],p w * 3,w*3);
}
Image1->Picture->Bitmap->Assign(bmp1);
delete bmp1;
自已看一下座標該怎麼去設定吧!
===================引 用 文 章===================
然後要把影像檔分成四塊
1 2
3 4
向上面這種格式
並且要讀出每個區塊左上級右下角的座標