W
wanggongqin
Unregistered / Unconfirmed
GUEST, unregistred user!
我是想实现抓取屏幕变化的部分传送到网络的另一端,实现快速远程控制的目的。
其中这个技术是比较关键的部分。
即先比较两个图片不同的部分,然后提取这些不同的部分,
再将这些不同的部分无闪烁的覆盖到前一个图片的相同位置。
下面是我的测试代码,就差覆盖不同部分的代码了,怎么实现?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ExtDlgs, jpeg;
type
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Panel2: TPanel;
Label2: TLabel;
Label3: TLabel;
Image1: TImage;
Image2: TImage;
Button1: TButton;
Button2: TButton;
Button3: TButton;
opdImage: TOpenPictureDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if opdImage.Execute then
Image1.Picture.LoadFromFile(opdImage.FileName);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if opdImage.Execute then
Image2.Picture.LoadFromFile(opdImage.FileName);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
//怎么实现提取 Image2 中与 Image1 中不同的部分并无闪烁的覆盖到 Image1 中相同的位置。
end;
end.
----------------------------------------------------------------------------------------
object Label1: TLabel
Left = 8
Top = 40
Width = 36
Height = 14
Caption = '图片一'
end
object Label2: TLabel
Left = 344
Top = 40
Width = 36
Height = 14
Caption = '图片二'
end
object Label3: TLabel
Left = 8
Top = 12
Width = 286
Height = 14
Caption = '将图片二中与图片一中不同的部分反映到图片一中'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
end
object Panel2: TPanel
Left = 344
Top = 64
Width = 321
Height = 257
BevelOuter = bvLowered
TabOrder = 1
object Image2: TImage
Left = 1
Top = 1
Width = 319
Height = 255
Align = alClient
Stretch = True
end
end
object Button1: TButton
Left = 8
Top = 336
Width = 75
Height = 25
Caption = '载入(&Z)...'
TabOrder = 2
OnClick = Button1Click
end
object Button2: TButton
Left = 344
Top = 336
Width = 75
Height = 25
Caption = '载入(&R)...'
TabOrder = 3
OnClick = Button2Click
end
object Button3: TButton
Left = 8
Top = 376
Width = 89
Height = 25
Caption = '载入不同(&B)'
TabOrder = 4
OnClick = Button3Click
end
object Panel1: TPanel
Left = 8
Top = 64
Width = 321
Height = 257
BevelOuter = bvLowered
TabOrder = 0
object Image1: TImage
Left = 1
Top = 1
Width = 319
Height = 255
Hint = '可托动'#13#10'双击正常大小'
Align = alClient
ParentShowHint = False
ShowHint = True
Stretch = True
end
end
object opdImage: TOpenPictureDialog
Left = 112
Top = 200
end
//将以上窗体资源文本复制并在一个空白窗体上粘贴即可。
-------------------------------------------------------------------------------------
其中这个技术是比较关键的部分。
即先比较两个图片不同的部分,然后提取这些不同的部分,
再将这些不同的部分无闪烁的覆盖到前一个图片的相同位置。
下面是我的测试代码,就差覆盖不同部分的代码了,怎么实现?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ExtDlgs, jpeg;
type
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Panel2: TPanel;
Label2: TLabel;
Label3: TLabel;
Image1: TImage;
Image2: TImage;
Button1: TButton;
Button2: TButton;
Button3: TButton;
opdImage: TOpenPictureDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if opdImage.Execute then
Image1.Picture.LoadFromFile(opdImage.FileName);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if opdImage.Execute then
Image2.Picture.LoadFromFile(opdImage.FileName);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
//怎么实现提取 Image2 中与 Image1 中不同的部分并无闪烁的覆盖到 Image1 中相同的位置。
end;
end.
----------------------------------------------------------------------------------------
object Label1: TLabel
Left = 8
Top = 40
Width = 36
Height = 14
Caption = '图片一'
end
object Label2: TLabel
Left = 344
Top = 40
Width = 36
Height = 14
Caption = '图片二'
end
object Label3: TLabel
Left = 8
Top = 12
Width = 286
Height = 14
Caption = '将图片二中与图片一中不同的部分反映到图片一中'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
end
object Panel2: TPanel
Left = 344
Top = 64
Width = 321
Height = 257
BevelOuter = bvLowered
TabOrder = 1
object Image2: TImage
Left = 1
Top = 1
Width = 319
Height = 255
Align = alClient
Stretch = True
end
end
object Button1: TButton
Left = 8
Top = 336
Width = 75
Height = 25
Caption = '载入(&Z)...'
TabOrder = 2
OnClick = Button1Click
end
object Button2: TButton
Left = 344
Top = 336
Width = 75
Height = 25
Caption = '载入(&R)...'
TabOrder = 3
OnClick = Button2Click
end
object Button3: TButton
Left = 8
Top = 376
Width = 89
Height = 25
Caption = '载入不同(&B)'
TabOrder = 4
OnClick = Button3Click
end
object Panel1: TPanel
Left = 8
Top = 64
Width = 321
Height = 257
BevelOuter = bvLowered
TabOrder = 0
object Image1: TImage
Left = 1
Top = 1
Width = 319
Height = 255
Hint = '可托动'#13#10'双击正常大小'
Align = alClient
ParentShowHint = False
ShowHint = True
Stretch = True
end
end
object opdImage: TOpenPictureDialog
Left = 112
Top = 200
end
//将以上窗体资源文本复制并在一个空白窗体上粘贴即可。
-------------------------------------------------------------------------------------