关于图像操作的几个函数
2009-02-04 13:54
471 查看
////////////////////////////////////////// //不得闲图像操作函数库 ///////////////////////////////////////// {将位图颜色变深} procedure Dark24Bitmap(var B : TBitmap;N : integer); var i,j : integer; pB : PByteArray; Count: Integer; begin i := Integer(B.PixelFormat); if i < 4 then i := 4 else if i = 4 then inc(i); Count := (i - 3) * B.Width - 1; for i:=0 to B.Height-1 do begin pb:=B.ScanLine[i]; for j:=0 to Count do if pb[j]then pb[j]:=0 else dec(pb[j],n); end; end; {将位图颜色变浅} procedure Light24Bitmap(var B : TBitmap;N : integer); var i,j : integer; pB : PByteArray; Count: Integer; begin i := Integer(B.PixelFormat); if i < 4 then i := 4 else if i = 4 then inc(i); Count := (i - 3) * B.Width - 1; for i:=0 to B.Height-1 do begin pb:=B.ScanLine[i]; for j:=0 to Count do begin if pb[j]>(255-n) then pb[j]:=255 else inc(pb[j],n); end; end; end; {比较两个位图是否相同} function IsBmpSame(bmp1,bmp2: TBitmap): Boolean; var i,j: Integer; ScanLine1,ScanLine2: PByteArray; Count: Integer; begin Result := (bmp1.Height = bmp2.Height) and (bmp1.Width = bmp2.Width) and (bmp1.PixelFormat = bmp2.PixelFormat); if Result then begin i := Integer(bmp1.PixelFormat); if i < 4 then i := 4 else if i = 4 then inc(i); Count := (i - 3) * bmp1.Width - 1; for i:=0 to bmp1.Height-1 do begin ScanLine1 := bmp1.ScanLine[i]; ScanLine2 := bmp2.ScanLine[i]; for j := 0 to Count do if ScanLine1[j] <> ScanLine2[j] then begin Result := False; Exit; end; end; end; end; |
相关文章推荐
- 关于图像合成所引申的几个函数
- 关于图像合成所引申的几个函数
- oracle中关于数字操作的几个函数
- 关于几个字符串操作的函数
- 关于图像合成所引申的几个函数
- 几个相似的关于操作内存的函数---开始大量使用.
- 关于字符串和文件操作的几个函数
- 关于C语言中字符串操作的几个函数的总结
- php关于文件内容的几个操作函数总结
- 关于图像到16进制相互转换的几个函数
- 关于操作IP地址的函数
- MFC几个关于字符串处理的全局函数
- 收集了几个关于J2ME图片缩放的函数
- OpenCV图像处理篇之阈值操作函数
- 关于动态存储分配函数的调用,在已经过排序的数组中查找及删除内容的操作,余数的分析,删除字符数组中的空格,对链表的逆置,在源字符串中查找子字符串的个数,函数指针以及函数的调用,循环赋值带来的问题以及插入
- 关于单链表函数操作中return head的意义
- PHP获取和操作配置文件php.ini的几个函数介绍
- 关于matlab的SVM工具箱的几个函数
- PHP获取和操作配置文件php.ini的几个函数
- jena中关于本体操作的几个代码。(自己看的笔记)