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

DelphiX 圖像處理:TDIB.SplitBlur 分離模糊 (多強度按鈕)

     編輯:Delphi

效果預覽

分離模糊效果示意圖

功能說明

TDIB.SplitBlur(Intensity: Integer) 產生分離色調模糊。範例提供三個按鈕:載入圖片、強度 1、強度 4,方便比較不同參數效果。

完整程式碼

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;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(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.SplitBlur(1);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  DXPaintBox1.DIB.SplitBlur(4);
  DXPaintBox1.Repaint;
end;

end.

表單定義 (DFM 節錄)

object Form1: TForm1
  ClientHeight = 142
  ClientWidth = 226
  object DXPaintBox1: TDXPaintBox
    Left = 8; Top = 8; Width = 81; Height = 73
    AutoStretch = False; Stretch = False
  end
  object Button1: TButton
    Left = 143; Top = 22; Width = 75; Height = 25
    Caption = 'Load'; OnClick = Button1Click
  end
  object Button2: TButton
    Left = 143; Top = 78; Width = 75; Height = 25
    Caption = 'Blur 1'; OnClick = Button2Click
  end
  object Button3: TButton
    Left = 143; Top = 109; Width = 75; Height = 25
    Caption = 'Blur 4'; OnClick = Button3Click
  end
end
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved