線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1017
推到 Plurk!
推到 Facebook!

存圖問題??

尚未結案
dardar923
一般會員


發表:1
回覆:0
積分:0
註冊:2005-03-14

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-03-14 02:17:47 IP:61.216.xxx.xxx 未訂閱
void __fastcall TForm1::Button3Click(TObject *Sender)//灰階 {  Image2->Enabled=true;   Image2->Width=Image1->Width;  Image2->Height=Image1->Height;  for(int w=0;wWidth;w ) {for(int h=0;hHeight;h ) { int r = GetRValue(Image1->Canvas->Pixels[w][h]); int g = GetGValue(Image1->Canvas->Pixels[w][h]); int b = GetBValue(Image1->Canvas->Pixels[w][h]); int gray = (r g b)/3; Image2->Canvas->Pixels[w][h] = (TColor)RGB(gray,gray,gray); } } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button4Click(TObject *Sender)//縮小 { int mul; mul=StrToInt(Edit1->Text); Image2->Enabled=true; Image2->Width = (Image1->Width)/mul; Image2->Height = (Image1->Height)/mul; if(mul>0) { for(int w=0;wWidth;w =mul) { for(int h=0;hHeight;h =mul) { int r = GetRValue(Image1->Canvas->Pixels[w][h]); int g = GetGValue(Image1->Canvas->Pixels[w][h]); int b = GetBValue(Image1->Canvas->Pixels[w][h]); Image2->Canvas->Pixels[w/mul][h/mul] = (TColor)RGB(r,g,b); } } } else ShowMessage("不要亂打!!"); } 為什麼我先縮小在灰階圖片大小會怪怪ㄉ~~ 而先灰階在縮小就不會~~ 但是在存修改過的圖片ㄉ時候~~ 存出來的東西會有重疊 (先灰階->縮小->存檔)----跑出重疊圖片~~ 1.如何只存最後一次動作的圖片?? 2.先縮小->在灰階------圖片變怪怪的?? 兩個問題
juneo
高階會員


發表:103
回覆:190
積分:118
註冊:2004-05-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-03-14 09:56:22 IP:211.75.xxx.xxx 未訂閱
因為輸出輸入都是同張圖片 建議改為 輸入圖片->處理(緩衝圖區)->輸出圖片 作法: 1.宣告全區圖形變數 Graphics::TBitmap *Brig_Bmp = new Graphics::TBitmap(); 2.Image2 圖檔放到 Brig_Bmp 中 再做灰階 或 放大縮小 3.將處理好的圖片放到Image2 顯示 先縮小在灰階因為圖檔大小已經改變所以會怪怪的 試試上面方法看看, 將圖檔儲存 Image2->Picture->SaveToFile("檔名") 數學 程式 經驗=不懂^^
系統時間:2024-05-02 8:34:45
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!