數位媒體概論--第七次上課(程式碼)(at 2006.11.02)
[以下是把圖檔一打開就會把圖片割好]
----------------------------------------------------------------------------------
if(OpenPictureDialog1->Execute())
{
Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
}
Image2->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(0,0,99,99));
Image3->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(100,0,199,99));
Image4->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(199,0,299,99));
Image5->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(0,99,99,199));
Image6->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(99,99,199,199));
Image7->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(199,99,299,199));
Image8->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(0,199,99,299));
Image9->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(99,199,199,299));
Image10->Canvas->CopyRect(Rect(0,0,99,99),Image1->Canvas,Rect(199,199,299,299));
----------------------------------------------------------------------------------
已經可以用程式把圖片分割了
接著我想我需要思索的,是如何把圖片打散以及mov!
關於mov要參考上週的log
[後來發現那樣指定會有點小問題,所以做了點修正]
if(OpenPictureDialog1->Execute())
{
Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
}
TRect TileRect, OIRect1,OIRect2,OIRect3,OIRect4,OIRect5,OIRect6,OIRect7,OIRect8,OIRect9;
TileRect = Rect(0,0,99,99); //定義TileRect的範圍
OIRect1 = Rect(0,0,99,99);
OIRect2 = Rect(100,0,199,99);
OIRect3 = Rect(199,0,299,99);
OIRect4 = Rect(0,99,99,199);
OIRect5 = Rect(99,99,199,199);
OIRect6 = Rect(199,99,299,199);
OIRect7 = Rect(0,199,99,299);
OIRect8 = Rect(99,199,199,299);
OIRect9 = Rect(199,199,299,299);
Image2->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect1);
Image3->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect2);
Image4->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect3);
Image5->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect4);
Image6->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect5);
Image7->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect6);
Image8->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect7);
Image9->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect8);
Image10->Canvas->CopyRect(TileRect,Image1->Canvas,OIRect9);
0 Comments:
Post a Comment
<< Home