本文整理自网络,侵删。
TypepRGBTripleArray = ^TRGBTripleArray;TRGBTripleArray = array [0 .. 65535] of TRGBTriple;Ttemplate=recordend;
procedure TForm1.Button5Click(Sender: TObject);var Gray,x,y:Integer; p:pRGBTripleArray; BM:TBitmap;begin BM:=TBitmap.Create; BM.Assign(Image1.Picture.Graphic); Image1.Picture.Assign(BM); BM.free;
for y:=1 to Image1.Picture.Height -1 do begin p:=Image1.Picture.Bitmap.ScanLine[Y]; for x:=1 to Image1.Picture.Width-1 do begin //采用YUV与RGB颜色空间变换的公式,即Y=0.3R+0.59G+0.11B Gray:=Round(p[x].rgbtRed*0.3+p[x].rgbtGreen*0.59+p[x].rgbtBlue*0.11); p[x].rgbtRed :=Byte(Gray); p[x].rgbtGreen:=Byte(Gray); p[X].rgbtBlue :=Byte(Gray); end; end; Image1.Invalidate;
end;
相关阅读 >>
Delphi 随便找个网站获取格林威治时间, 并转换到北京时间
Delphi xe 如何实现("再按一次退出") 然后退出程序
Delphi 跨平台的,在fmx中读取icon文件的每一帧到bitmap
Delphi 2010下使用sqlitesimpleDelphi连接sqlite数据库及中文乱码问题的解决
更多相关阅读请进入《Delphi》频道 >>