首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 更多程式語言 >> Delphi

DelphiX 圖像處理:TDIB.Sharpen 銳化效果

     編輯:Delphi

效果預覽

銳化效果示意圖

功能說明

TDIB.Sharpen(Amount: Integer) 增強圖像邊緣銳度。參數 Amount 控制強度,範例使用 1 輕微銳化。

完整程式碼

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DIB, StdCtrls;

type
  TForm1 = class(TForm)
    DXPaintBox1: TDXPaintBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
const
  ImgPath = 'C:\Temp\DX.jpg';
begin
  DXPaintBox1.DIB.LoadFromFile(ImgPath);
  DXPaintBox1.Width := DXPaintBox1.DIB.Width;
  DXPaintBox1.Height := DXPaintBox1.DIB.Height;
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Sharpen(1);
  DXPaintBox1.Repaint;
end;

end.

表單定義 (DFM 節錄)

object Form1: TForm1
  ClientHeight = 142; ClientWidth = 226
  object DXPaintBox1: TDXPaintBox
    Left = 8; Top = 8; Width = 81; Height = 73
  end
  object Button1: TButton; Left = 143; Top = 78; Caption = 'Load'
  object Button2: TButton; Left = 143; Top = 109; Caption = 'Sharpen'
end
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved