📄 rouhua.txt
字号:
rocedure TFormPageEdit.Button1Click(Sender: TObject); //图片钝化
var
bmp:TBitMap;
a: pbytearray;
Center: TPoint;
begin
bmp:=TBitMap.create;
bmp.Assign(ImagePageEdit.Picture.Graphic);
AntiAlias(Bmp); //Antialias:反锯齿显示图片,起到钝化效果
ImagePageEdit.Picture.Assign(Bmp);
Bmp.free;
end;
procedure TFormPageEdit.Button4Click(Sender: TObject); //图片锐化函数
var
bmp1, bmp2: Tbitmap;
p1, p2, p3, p4: pbytearray;
i, j: integer;
starttime: cardinal;
begin
Button4.Enabled := False;
self.DoubleBuffered := true;
bmp1 := Tbitmap.Create;
bmp2 := Tbitmap.Create;
bmp1.Assign(ImagePageEdit.Picture.Bitmap);
bmp1.PixelFormat := pf24bit;
bmp1.Width := ImagePageEdit.Picture.Graphic.Width;
bmp1.Height := ImagePageEdit.Picture.Graphic.Height;
bmp2.Assign(ImagePageEdit.Picture.Bitmap);
bmp2.PixelFormat := pf24bit;
starttime := GetTickCount;
for j := 1 to bmp1.Height - 2 do
begin
p1 := bmp1.ScanLine[j];
p2 := bmp2.ScanLine[j - 1];
p3 := bmp2.ScanLine[j];
p4 := bmp2.ScanLine[j + 1];
for i := 1 to bmp1.Width - 2 do
begin
p1[3 * i + 2] := min(255, max(0, ((-p2[3 * (i - 1) + 2] - p2[3 * i
+ 2] -
p2[3 * (i + 1) + 2] - p3[3 * (i - 1) + 2] + 16 * p3[3 * i +
2]
- p3[3 *
(i
+ 1) + 2] - p4[3 * (i - 1) + 2] - p4[3 * i + 2] - p4[3 * (i
+ 1) + 2])
div
8)));
p1[3 * i + 1] := min(255, max(0, ((-p2[3 * (i - 1) + 1] - p2[3 * i
+ 1] -
p2[3 * (i + 1) + 1] - p3[3 * (i - 1) + 1] + 16 * p3[3 * i +
1]
- p3[3 *
(i
+ 1) + 1] - p4[3 * (i - 1) + 1] - p4[3 * i + 1] - p4[3 * (i
+ 1) + 1])
div
8)));
p1[3 * i] := min(255, max(0, ((-p2[3 * (i - 1)] - p2[3 * i] - p2[3
* (i +
1)] - p3[3 * (i - 1)] + 16 * p3[3 * i] - p3[3 * (i + 1)] -
p4[3 * (i -
1)]
- p4[3 * i] - p4[3 * (i + 1)]) div 8)));
end;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -