博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
关于图像操作的几个函数
阅读量:4149 次
发布时间:2019-05-25

本文共 1518 字,大约阅读时间需要 5 分钟。

DelphiCode:
////不得闲图像操作函数库/{将位图颜色变深}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;

转载地址:http://irsti.baihongyu.com/

你可能感兴趣的文章
idea添加gradle模块报错The project is already registered
查看>>
在C++中如何实现模板函数的外部调用
查看>>
在C++中,关键字explicit有什么作用
查看>>
C++中异常的处理方法以及使用了哪些关键字
查看>>
如何定义和实现一个类的成员函数为回调函数
查看>>
内存分配的形式有哪些? C++
查看>>
什么是内存泄露,如何避免内存泄露 C++
查看>>
栈和堆的空间大小 C++
查看>>
什么是缓冲区溢出 C++
查看>>
sizeof C++
查看>>
使用指针有哪些好处? C++
查看>>
引用还是指针?
查看>>
checkio-non unique elements
查看>>
checkio-medium
查看>>
checkio-house password
查看>>
checkio-moore neighbourhood
查看>>
checkio-the most wanted letter
查看>>
Redis可视化工具
查看>>
1033. To Fill or Not to Fill (25)
查看>>
1034. Head of a Gang (30)
查看>>