unit1.pas

来自「为Delphi2005做了改动 DSPack 2.3.3 (Sep 2004).」· PAS 代码 · 共 72 行

PAS
72
字号
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DSPack, DSUtil, DirectShow9, ComCtrls;

type
  TFormVMRMixer = class(TForm)
    FilterGraph: TFilterGraph;
    VideoWindow: TVideoWindow;
    btRender: TButton;
    Alpha: TTrackBar;
    OpenDialog: TOpenDialog;
    CoordX: TTrackBar;
    CoordY: TTrackBar;
    Label1: TLabel;
    procedure btRenderClick(Sender: TObject);
    procedure AlphaChange(Sender: TObject);
    procedure CoordChange(Sender: TObject);
  private
    { D閏larations priv閑s }
  public
    { D閏larations publiques }
  end;

var
  FormVMRMixer: TFormVMRMixer;
  ARect: TVMR9NORMALIZEDRECT;

implementation

{$R *.dfm}

procedure TFormVMRMixer.btRenderClick(Sender: TObject);
begin
  if OpenDialog.Execute then
  begin
    FilterGraph.ClearGraph;
    ARect.left   := 0;
    ARect.top    := 0;
    ARect.right  := CoordX.Position / 100;
    ARect.bottom := CoordY.Position / 100;
    with (VideoWindow as IVMRMixerControl9) do
    begin
      SetOutputRect(1,@ARect);
      SetAlpha(1,Alpha.Position/100);
      SetZOrder(1,0)
    end;
    FilterGraph.RenderFile(OpenDialog.FileName);
    FilterGraph.RenderFile(ExtractFilePath(Application.ExeName) + '\penguin.gif');
    FilterGraph.Play;
  end;
end;

procedure TFormVMRMixer.AlphaChange(Sender: TObject);
begin
  (VideoWindow as IVMRMixerControl9).SetAlpha(1,Alpha.Position/100);
end;

procedure TFormVMRMixer.CoordChange(Sender: TObject);
begin
  ARect.left   := 0;
  ARect.top    := 0;
  ARect.right  := CoordX.Position / 100;
  ARect.bottom := CoordY.Position / 100;
  (VideoWindow as IVMRMixerControl9).SetOutputRect(1,@ARect)
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?