[bcb][求助]有關bitmap格式圖片翻轉的問題..請大大們為我幫個忙.. |
尚未結案
|
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
最近我在寫一個可以將bmp的圖檔水平翻轉的程式
在執行.exe時卻出現了下面的問題
而當我在bcb下compiler時是ok的沒有什麼問題
但在compiler之後要進行view下的flip/rotate卻會出現
請問一下這是什麼問題呢
我又錯在那呢...
我的project檔案放在這個地方
http://61.60.224.22/mywebhd/get_file.aspx?name=00007142%5cpract.rar 希望大大們能為我解答
謝謝 發表人 - dickyaaa 於 2005/11/30 20:40:10
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
dickyaaa, 你的檔案無法下載喔! http://61.60.224.22/mywebhd/get_file.aspx?name=00007142\pract.rar
The first step toward proving things for yourself is to understand how others have done it before!
------
The first step toward proving things for yourself is to understand how others have done it before! |
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
不好意思..
我重新上傳了
請大大試看看吧
http://home.tinp.net.tw/mypage/00007142/pract.rar 麻煩大大了
謝謝
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
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); ←這兩行這應該擺在for-loop外面吧!! // delete TempBitmap; } TheBitmap->Assign(TempBitmap); delete TempBitmap;The first step toward proving things for yourself is to understand how others have done it before!
------
The first step toward proving things for yourself is to understand how others have done it before! |
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
|
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
我是從BCB上面拉一個Label元件到Form1裡面,接著在下列Callback function 中插入紅色標記的部分
void __fastcall TForm1::fliprotate1Click(TObject *Sender) Width=TheBitmap->Width; Height=TheBitmap->Height; Label1->Caption = IntToStr(Height) + "*" + IntToStr(Width); // Caption 是Label1中的一個屬性,可以讓使用者看到不同文字內容 // IntToStr()是將整數轉成字串 // + 是做字串相加The first step toward proving things for yourself is to understand how others have done it before!
------
The first step toward proving things for yourself is to understand how others have done it before! |
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
Hi, dickyaaa: 咦!你的程式不是可以依照下拉選單選擇不同倍率縮放,來給定影像大小嗎?, 為什麼會不曉得影像大小? 還是我誤解你的意思? 我想關鍵在下拉選單的Callback function,試著從那裡去下手吧!! 如果還是不行,你把你修改的部分貼上來,我再幫你check... <>
<>
>
>
------
The first step toward proving things for yourself is to understand how others have done it before! |
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
void __fastcall TForm1::ComboBox1Change(TObject *Sender) { .....省略.... Image1->Height=Image1->Picture->Bitmap->Height/S; Label1->Caption = IntToStr(Image1->Picture->Bitmap->Height/S) "*" IntToStr(Image1->Picture->Bitmap->Width/S); }再試試看吧! <> <> > >
------
The first step toward proving things for yourself is to understand how others have done it before! |
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
|
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
大大我試了一下
結果卻出現在那行卻出現了
[C Error] Unit1.cpp(108): E2015 Ambiguity between '_fastcall Sysutils::IntToStr(__int64)' and '_fastcall Sysutils::IntToStr(int)'
[C Error] Unit1.cpp(108): E2015 Ambiguity between '_fastcall Sysutils::IntToStr(__int64)' 這二個錯誤
這是為何呢
麻煩大大幫我解答一下
謝謝
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
原本是要回應你說的我不是指圖片的大小, 其實縮小時那時pixel*pixel就是當時圖片的大小啦! 索性直接貼上Image1->Picture->Bitmap->Width/S,沒有確認結果。 你可以用方法1:強迫轉型成AnsiString或是直接抓當時的影像大小來轉成字串,即下面方法2。
【方法1】 Label1->Caption = (AnsiString)(Image1->Picture->Bitmap->Width/S) + "*" + (AnsiString)(Image1->Picture->Bitmap->Height/S); 或是 【方法2】 Label1->Caption = IntToStr(Image1->Width) + "*" + IntToStr(Image1->Height);再試試看囉 <> <> > >
------
The first step toward proving things for yourself is to understand how others have done it before! |
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
------
The first step toward proving things for yourself is to understand how others have done it before! |
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
大大..下面是我新用好的程式
也就是和上次那個差不多
只是有修改一下下
想請問一下..為何我在旋轉時..圖片會失真呢
是我那裡出了問題嗎
麻煩一下大大
http://home.tinp.net.tw/mypage/00007142/new.rar 另外
void __fastcall TForm1::Button1Click(TObject *Sender) { Graphics::TBitmap *bmp24bitColor=new Graphics::TBitmap; Graphics::TBitmap *bmp8bitGray=new Graphics::TBitmap; bmp24bitColor->LoadFromFile("C:\\24bit.bmp"); bmp8bitGray->Width=bmp24bitColor->Width; bmp8bitGray->Height=bmp24bitColor->Height; for(int i=0; i在紅色的地方看不太懂那是什麼意思 可以麻煩大大為我解答一下嗎 而錄色的地方若依我的程式的話..要如何去修改 問題好像蠻多的 麻煩一下大大為我解答一下 此外還想問一下 有沒有什麼書是關於c builder用在影像處理上的嗎 大大不知是不知道嗎 麻煩大大了 謝謝 |
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
Hello, dickyaaa 關於旋轉你可以參考這2篇,相信可以解決你大部分的問題。
【圖形翻轉範例】http://delphi.ktop.com.tw/topic.php?topic_id=38783
【影像處理VI】 http://delphi.ktop.com.tw/topic.php?topic_id=40159 說到學習影像處理搭配使用c++ builder工具, 我個人建議你先把K.top影音多媒體的精華文章先瀏覽過一次, 然後試著改善別人發表的作品,那麼使用BCB來處理影像的技巧應該就會很純熟。 另外其他你問的問題,基本上都可以在站上或help手冊找的到答案,我簡略回答:
(1)Graphics::TBitmap *bmp24bitColor=new Graphics::TBitmap;→在c++ builder工具中,將滑鼠停留在想查詢的關鍵字如TBitmap, 按一下"F1"按鍵,就可查詢到TBitmap的相關訊息 < class="code"> (2) bmp8bitGray->Width=bmp24bitColor->Width; bmp8bitGray->Height=bmp24bitColor->Height; →規劃相同的影像大小,相當於規劃一樣大的記憶體空間。 (3) BYTE R=GetRValue(Color); BYTE G=GetGValue(Color); BYTE B=GetBValue(Color);同問題(1),查關鍵字GetRValue, GetGValue, GetBValue (4) Application->ProcessMessages();→用K.top搜尋引擎找找吧< > 最後,個人衷心建議一些小問題要自己多花點時間找資料, 在>學著找資料進而自己解決問題>也是很重要的, 與你共勉之< > 發表人 -
------
The first step toward proving things for yourself is to understand how others have done it before! |
dickyaaa
一般會員 發表:8 回覆:11 積分:3 註冊:2005-09-30 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |