引用 | 编辑
rei
2006-04-22 20:30 |
楼主
▼ |
||
x0
const int RED = 2;const int GREEN = 1; const int BLUE = 0; void toGray(TImage *image) { Byte * ptr; int r, g, b, gray, index; image->Picture->Bitmap->PixelFormat = pf24bit; // for full-color image for (int row=0; row<image->Picture->Height; .. 访客只能看到部份内容,免费 加入会员 x0
|
引用 | 编辑
cmovies
2006-04-22 23:13 |
1楼
▲ ▼ |
ptr = (Byte*) image->Picture->Bitmap->ScanLine[row];
-> 取得那个 Row 的影像资料内容的位址 影像资料存放的格式由 image->Picture->Bitmap->PixelFormat = pf24bit 来决定 pf24bit 就是影像资料有R G B 三个 Bytes (共24bits) index+"xxx"跟ScanLine -> 就是指向这个 Row 中的第 Index 点的哪个颜色 R G B 一般要做影像处理都会直接对影像资料作运算后再存回去 ScanLine 就能提供影像资料内容的位址供程式加以运算处理 const int RED = 2; const int GREEN = 1; const int BLUE = 0; -> 这就是影像资料的颜色存放的顺序 Copy from Borland online help: Provides indexed access to each line of pixels. property ScanLine[Row: Integer]: Pointer; Description ScanLine is used only with DIBs (Device Independent Bitmaps) for image editing tools that do low-level pixel work. x1 |
引用 | 编辑
rei
2006-04-23 10:10 |
2楼
▲ ▼ |
下面是引用cmovies于2006-04-22 23:13发表的 : 不好意思~ 想再请问一下~ 如果不做存回去的动作~在下的程式码应该怎么改? ////////////////////////////////////////////////////////////// ptr[index + BLUE ] = (Byte)gray; ptr[index + GREEN ] = (Byte)gray; ptr[index + RED ] = (Byte)gray; index += 3; ////////////////////////////////////////////////////////////// ptr = (Byte*) image->Picture->Bitmap->ScanLine[row]; ////////////////////////////////////////////////////////////// x0 |