有關於翻轉失真問題! |
缺席
|
st91038
一般會員 ![]() ![]() 發表:1 回覆:1 積分:0 註冊:2009-04-06 發送簡訊給我 |
[code cpp] 請在此區域輸入程式碼 [/code] //執行水平翻轉(使用Scanline函式) Graphics::TBitmap *TheBitmap, *TempBitmap; int Width, Height; Byte *ptr1, *ptr2; TMDIChild *Child; Child = (TMDIChild *) ActiveMDIChild; TempBitmap = new Graphics::TBitmap(); //主要目的為儲存翻轉後的結果 TheBitmap = Child->Image1->Picture->Bitmap; //將指標TheBitmap指向原始影像 TheBitmap->PixelFormat = pf8bit; TempBitmap->Assign(TheBitmap); //將原始影像之資訊先複製到目的影像中 Width = TheBitmap->Width; Height = TheBitmap->Height; for (int y=0; y< Height; y ) { ptr1 = (Byte*) TempBitmap->ScanLine[y]; ptr2 = (Byte*) TheBitmap->ScanLine[y]; for(int x=0; x< Width; x ) ptr1[x] = ptr2[Width-1-x]; } TheBitmap->Assign(TempBitmap); delete TempBitmap; 這是照課本打的水平翻轉!!!但是他一翻轉的話,照片就會失真!! 請問各位大大!要如何修改才不失真? 還是說用ScanLine就會這樣? 小弟新手,希望高手大大指導~感謝!
------
高手解答,小弟感謝。 編輯記錄
st91038 重新編輯於 2009-04-28 14:55:34, 註解 無‧
|
taishyang
站務副站長 ![]() ![]() ![]() ![]() ![]() ![]() 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
|
st91038
一般會員 ![]() ![]() 發表:1 回覆:1 積分:0 註冊:2009-04-06 發送簡訊給我 |
|
taishyang
站務副站長 ![]() ![]() ![]() ![]() ![]() ![]() 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |