directx 抓图(200分)

  • 主题发起人 未来107
  • 开始时间

未来107

Unregistered / Unconfirmed
GUEST, unregistred user!
求能抓directx 图像如游戏,影片画面的例子,无论是用directx sdk for delphi还是
delphix控件或其他方法都行。
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, DSFilters, DirectShow, StdCtrls, OleServer, dspack, ExtCtrls,
ComCtrls;

type
TForm1 = class(TForm)
FilterGraph: TDSFilterGraph2;
Button1: TButton;
DSVideoWindow1: TDSVideoWindow;
Image1: TImage;
FilterSampleGrabber: TFilterSampleGrabber;
OpenDialog: TOpenDialog;
StatusBar1: TStatusBar;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure Button1Click(Sender: TObject);
procedure FilterSampleGrabberBuffer(sender: TComponent;
Buffer: TBufferCB);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
FilterGraph.Disconnect;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog.Execute then
begin
FilterGraph.ClearGraph;
FilterGraph.FilterGraph2.AddFilter(FilterSampleGrabber.BaseFilter, 'Grabber');
FilterSampleGrabber.SetBMPCompatible(nil,24);
FilterGraph.FilterGraph2.RenderFile(StringToOleStr(Opendialog.FileName),nil);
FilterGraph.QueryInterfaces;
FilterGraph.MediaControl.Run;
end;
end;

procedure TForm1.FilterSampleGrabberBuffer(sender: TComponent;
Buffer: TBufferCB);
begin
FilterSampleGrabber.GetBitmap(image1.Picture.Bitmap,Buffer);
StatusBar1.SimpleText := floattostr(buffer.SampleTime);
end;

end.
 
需要用到那些控件呀?我装dspack老装不上?
 
我试了一下www.gamedev.net上的那个例子,就是用DX8.1里D3DXSaveSurfaceToFile,
并不能抓游戏,影片画面。和普通的方法没有区别。另外窗口模式下的DDraw程序好像
用普通的方法也能截取,我的那个游戏就能。
 
超级解霸的画面就无论如何都抓不下了!
 
to forgot2002,你都用了什么控件?为什么我在DsPack控件包下,编译不通过??

3Q
 
http://www.delphi-jedi.org/DelphiGraphics/directx/downloads/dxcap103.zip
http://www.delphi-jedi.org/DelphiGraphics/directx/downloads/dscap.zip
 
To gxcooo
能将www.gamedev.net上的关于使用D3DXSaveSurfaceToFile函数的例子的链接贴出来吗?
to 轻松虎
我在论坛上看到你对于ddraw抓图的许多回答,我想你一定对这方面挺有研究,你给的连接
我以前试过,但我这里有问题.
 
to 轻松虎,你的说的代码可以下载,但为什么运行出错???
 
forgot2002 给的例子好像是 播放一个视频流文件 然后在程序里面来抓图。
而实际上搂主需要的是在任何情况下 抓下当前的屏幕显示窗口。
所以好像forgot2002的不行。
 
是的,要抓去自己的画面还可以!只是不能抓其他directx程序的画面,不知道各位
还有什么更好的方法!
 
最简单的方法,PrintScreen,打开DirectX的抓屏选项,再监视剪切板

关注
 
DX的图象用普通方法都可以抓的,不能抓的实际都是overlay方式显示的图像,比如,视频
 
那么如何抓overlay显示方式的图像呢
 
时间太长,结分
 
多人接受答案了。
 
顶部