請問用pixel[i][j]的值取rgb |
尚未結案
|
ddaken
一般會員 發表:39 回覆:33 積分:19 註冊:2005-01-21 發送簡訊給我 |
請問各位大大
我想取rgb的值~我已看過有人用
r = (c & 0x000000FF);
g = ((c & 0x0000FF00) >> 8);
b = ((c & 0x00FF0000) >> 16);
來取值
可是我如果把程式改成用ScanLine來增加速度
是不是不可以這樣用?
因為我的程式所跑出來的都是紅色的~
void __fastcall TForm1::ShowRGB1Click(TObject *Sender) { Byte *ptr; Graphics::TBitmap *Bmp = new Graphics::TBitmap(); Bmp->Assign(Image1->Picture->Bitmap); Bmp->PixelFormat=pf24bit; Image2->Picture->Bitmap=Bmp; Image3->Picture->Bitmap=Bmp; Image4->Picture->Bitmap=Bmp; for(int j=0;j發表人 - ddaken 於 2005/08/15 00:07:34 |
IORIS
一般會員 發表:15 回覆:21 積分:7 註冊:2005-01-14 發送簡訊給我 |
你好!
希望下面這段程式碼能對你有幫助
Graphics::TBitmap *Bmp = new Graphics::TBitmap(); Bmp->Assign(Image1->Picture->Bitmap); Byte *ptr; int R,G,B; for (int i=0;i發表人 - ioris 於 2005/08/15 11:06:11 |
RedSnow
版主 發表:79 回覆:1322 積分:845 註冊:2003-12-15 發送簡訊給我 |
ddaken 您好: 我看您似乎是想要將 Image1 原圖分解成三色,並分別顯示於另外三個 Image 物件上,如果我猜得沒錯,那麼您可以參考一下下列的處理方式:
// 宣告三個暫存用的 Bitmap Graphics::TBitmap *Bmp2 = new Graphics::TBitmap(); Graphics::TBitmap *Bmp3 = new Graphics::TBitmap(); Graphics::TBitmap *Bmp4 = new Graphics::TBitmap(); // 先將 Image1 內容複製給三個暫存的 Bitmap Bmp2->Width = Image1->Picture->Bitmap->Width; Bmp2->Height = Image1->Picture->Bitmap->Height; Bmp2->Canvas->Draw(0, 0, Image1->Picture->Bitmap); Bmp2->PixelFormat = pf24bit; Bmp3->Width = Image1->Picture->Bitmap->Width; Bmp3->Height = Image1->Picture->Bitmap->Height; Bmp3->Canvas->Draw(0, 0, Image1->Picture->Bitmap); Bmp3->PixelFormat = pf24bit; Bmp4->Width = Image1->Picture->Bitmap->Width; Bmp4->Height = Image1->Picture->Bitmap->Height; Bmp4->Canvas->Draw(0, 0, Image1->Picture->Bitmap); Bmp4->PixelFormat = pf24bit; // TRGBTriple 是一個結構資料,使用它來處理以提高易讀性 TRGBTriple *ptr2; TRGBTriple *ptr3; TRGBTriple *ptr4; for (int line=0; line7 天天敲鍵盤 v 時時按滑鼠 8 發表人 - RedSnow 於 2005/08/15 15:29:57 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |