文档章节

Delphi 与 DirectX 之 DelphiX(38): TDIB.Filter();

涂孟超
 涂孟超
发布于 2014/09/26 15:36
字数 425
阅读 10
收藏 0

本例效果图:



代码文件:
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;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

var
  dib: TDIB;

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

procedure TForm1.Button2Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Filter(dib, EdgeFilter);
  DXPaintBox1.DIB.Assign(dib);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Filter(dib, StrongOutlineFilter);
  DXPaintBox1.DIB.Assign(dib);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Filter(dib, Enhance3DFilter);
  DXPaintBox1.DIB.Assign(dib);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Filter(dib, LinearFilter);
  DXPaintBox1.DIB.Assign(dib);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Filter(dib, GranularFilter);
  DXPaintBox1.DIB.Assign(dib);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Filter(dib, SharpFilter);
  DXPaintBox1.DIB.Assign(dib);
  DXPaintBox1.Repaint;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  dib := TDIB.Create;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  dib.Free;
end;

end.

 
 
 
 
 

 

 

  

窗体文件:
object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 142
  ClientWidth = 304
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  OnDestroy = FormDestroy
  PixelsPerInch = 96
  TextHeight = 13
  object DXPaintBox1: TDXPaintBox
    Left = 8
    Top = 8
    Width = 81
    Height = 73
    AutoStretch = False
    Center = False
    KeepAspect = False
    Stretch = False
    ViewWidth = 0
    ViewHeight = 0
  end
  object Button1: TButton
    Left = 143
    Top = 8
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 143
    Top = 47
    Width = 75
    Height = 25
    Caption = 'Button2'
    TabOrder = 1
    OnClick = Button2Click
  end
  object Button3: TButton
    Left = 143
    Top = 78
    Width = 75
    Height = 25
    Caption = 'Button3'
    TabOrder = 2
    OnClick = Button3Click
  end
  object Button4: TButton
    Left = 143
    Top = 109
    Width = 75
    Height = 25
    Caption = 'Button4'
    TabOrder = 3
    OnClick = Button4Click
  end
  object Button5: TButton
    Left = 224
    Top = 47
    Width = 75
    Height = 25
    Caption = 'Button5'
    TabOrder = 4
    OnClick = Button5Click
  end
  object Button6: TButton
    Left = 224
    Top = 78
    Width = 75
    Height = 25
    Caption = 'Button6'
    TabOrder = 5
    OnClick = Button6Click
  end
  object Button7: TButton
    Left = 224
    Top = 109
    Width = 75
    Height = 25
    Caption = 'Button7'
    TabOrder = 6
    OnClick = Button7Click
  end
end

 
 
 
 
 

 

 

  

本文转载自:http://www.cnblogs.com/del/archive/2009/01/16/1377136.html

共有 人打赏支持
涂孟超
粉丝 12
博文 2011
码字总数 14107
作品 0
深圳
程序员
开源游戏框架(转至wiki)

免费和开源引擎,转载自维基 Agar - 一个高级图形应用程序框架,用于2D和3D游戏。 Allegro - 基于 C/C++ 的游戏引擎,支持图形,声音,输入,游戏时钟,浮点,压缩文件以及GUI。 Axiom 引擎 ...

Matrix4X4
2012/04/17
1K
0
漫谈 C# 在游戏领域的应用

原文出处:慕容小匹夫 0x00 前言 随着微软越来越开放,C#也变得越来越吸引人们的眼球。而在游戏行业中,C#也开始慢慢地获得了关注。这不, 网易绝代双娇手游团队已经全面使用.Net Core支持前...

慕容小匹夫
2016/06/28
0
0
典型开源3D引擎分类比较

常见的3D引擎有:Unreal、Quake、Lithtech、OGRE、Nebula、Irrlicht、Truevision3D... 其中开源免费的有:OGRE、irrlicht、fly3d、NeoEngine、revolution3d、 Nebula2、Genesis3d等。 OGRE 在...

长平狐
2013/01/06
1K
0
DirectX 将会被命名为 DirectX 12

本周早些时候我们曾报道过,微软将会在GDC大会上宣布全新版本的DirectX。现在微软已经在DirectX的博客页面确认了下一代DirectX API的正式名称,延续之前的产品代号,DirectX将会被命名为Dir...

oschina
2014/03/06
5.1K
48
DirectX 11 支持游戏已公布

在DirectX 10后,微软放出了DirectX 11 with Direct3D 11预览版,同时也公布了D11支持的游戏。DirectX 11主要面向Windows Vista和Windows 7,增加了很多新特性和开放式标准的支持。DirectX 1...

红薯
2009/03/31
902
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

[雪峰磁针石博客]python3快速入门教程1 turtle绘图-2函数

菲波那契序列: >>> # Fibonacci series:... # the sum of two elements defines the next... a, b = 0, 1>>> while b < 10:... print(b)... a, b = b, a+b...112......

python测试开发人工智能安全
今天
0
0
java环境变量配置最正确的方式

原贴:https://blog.csdn.net/qq_40007997/article/details/79784711,十分详细,亲测有效

kitty1116
今天
0
0
49.Nginx防盗链 访问控制 解析php相关 代理服务器

12.13 Nginx防盗链 12.14 Nginx访问控制 12.15 Nginx解析php相关配置(502的问题) 12.16 Nginx代理 扩展 502问题汇总 http://ask.apelearn.com/question/9109 location优先级 http://blog....

王鑫linux
今天
1
0
Nginx防盗链、访问控制、解析php相关配置、Nginx代理

一、Nginx防盗链 1. 编辑虚拟主机配置文件 vim /usr/local/nginx/conf/vhost/test.com.conf 2. 在配置文件中添加如下的内容 { expires 7d; valid_referers none blocked server_names *.tes......

芬野de博客
今天
0
0
spring EL 和资源调用

资源调用 import org.springframework.beans.factory.annotation.Value;import org.springframework.context.annotation.PropertySource;import org.springframework.core.io.Resource;......

Canaan_
今天
1
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部