Config.~pas
上传用户:mjqmds
上传日期:2022-05-05
资源大小:2827k
文件大小:5k
源码类别:

DirextX编程

开发平台:

Delphi

  1. unit Config;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, TFlatEditUnit, TFlatSpinEditUnit, LMDCustomControl,
  6.   LMDCustomPanel, LMDCustomTrackBar, LMDTrackBar, TFlatSpeedButtonUnit,
  7.   TFlatButtonUnit;
  8. type
  9.   TForm1 = class(TForm)
  10.     FlatSpinEditInteger1: TFlatSpinEditInteger;
  11.     LMDTrackBar2: TLMDTrackBar;
  12.     LMDTrackBar1: TLMDTrackBar;
  13.     LMDTrackBar3: TLMDTrackBar;
  14.     LMDTrackBar4: TLMDTrackBar;
  15.     LMDTrackBar5: TLMDTrackBar;
  16.     Label1: TLabel;
  17.     Label2: TLabel;
  18.     Label3: TLabel;
  19.     Label4: TLabel;
  20.     Label5: TLabel;
  21.     Label6: TLabel;
  22.     FlatSpeedButton1: TFlatSpeedButton;
  23.     FlatSpeedButton2: TFlatSpeedButton;
  24.     FlatSpeedButton3: TFlatSpeedButton;
  25.     FlatSpeedButton4: TFlatSpeedButton;
  26.     FlatSpeedButton5: TFlatSpeedButton;
  27.     FlatButton1: TFlatButton;
  28.     FlatButton2: TFlatButton;
  29.     procedure LMDTrackBar5Track(Sender: TObject; ScrollCode: TScrollCode;
  30.       var ScrollPos: Integer);
  31.     procedure LMDTrackBar4Track(Sender: TObject; ScrollCode: TScrollCode;
  32.       var ScrollPos: Integer);
  33.     procedure FormShow(Sender: TObject);
  34.     procedure FlatSpeedButton1Click(Sender: TObject);
  35.     procedure FlatSpeedButton2Click(Sender: TObject);
  36.     procedure FlatSpeedButton3Click(Sender: TObject);
  37.     procedure FlatSpeedButton4Click(Sender: TObject);
  38.     procedure FlatSpeedButton5Click(Sender: TObject);
  39.     procedure FlatButton1Click(Sender: TObject);
  40.     procedure FlatButton2Click(Sender: TObject);
  41.   private
  42.     procedure SetAmp;
  43.     { Private declarations }
  44.   public
  45.     { Public declarations }
  46.   end;
  47. var
  48.   Form1: TForm1;
  49. implementation
  50. uses WHPlaySDK;
  51. {$R *.dfm}
  52. procedure TForm1.LMDTrackBar5Track(Sender: TObject;
  53.   ScrollCode: TScrollCode; var ScrollPos: Integer);
  54. begin
  55.     dllSetAlpha(FlatSpinEditInteger1.Value,ScrollPos/1000);
  56. end;
  57. procedure TForm1.SetAmp;
  58. Var
  59.     Amp:TVMR9ProcAmpControl;
  60. begin
  61.     Amp.dwSize:=sizeof(Amp);
  62.     Amp.dwFlags:=ProcAmpControl9_Brightness or
  63.         ProcAmpControl9_Contrast or ProcAmpControl9_Hue or ProcAmpControl9_Saturation;
  64.     Amp.Brightness:=LMDTrackBar2.Position-100;
  65.     Amp.Contrast:=LMDTrackBar4.Position/1000;
  66.     Amp.Hue:=LMDTrackBar3.Position-180;
  67.     Amp.Saturation:=LMDTrackBar1.Position/1000;
  68.     dllSetAmpControl(FlatSpinEditInteger1.Value,@Amp);
  69. end;
  70. procedure TForm1.LMDTrackBar4Track(Sender: TObject;
  71.   ScrollCode: TScrollCode; var ScrollPos: Integer);
  72. begin
  73.     SetAmp;
  74. end;
  75. procedure TForm1.FormShow(Sender: TObject);
  76. Var
  77.     a:Single;
  78.     Amp:TVMR9ProcAmpControl;
  79. begin
  80.     FillChar(Amp,sizeof(Amp),0);
  81.     Amp.dwFlags:=ProcAmpControl9_Brightness or
  82.         ProcAmpControl9_Contrast or ProcAmpControl9_Hue or ProcAmpControl9_Saturation;
  83.     Amp.dwSize:=sizeof(Amp);
  84.     if dllGetAmpControl(FlatSpinEditInteger1.Value,@Amp)=1 then
  85.     begin
  86.         LMDTrackBar2.Position:=Round(Amp.Brightness+100);
  87.         LMDTrackBar4.Position:=Round(Amp.Contrast*1000);
  88.         LMDTrackBar3.Position:=Round(Amp.Hue+180);
  89.         LMDTrackBar1.Position:=Round(Amp.Saturation*1000);
  90.     end
  91.     else
  92.     begin
  93.         LMDTrackBar2.Position:=0;
  94.         LMDTrackBar4.Position:=0;
  95.         LMDTrackBar3.Position:=0;
  96.         LMDTrackBar1.Position:=0;
  97.         LMDTrackBar1.Enabled:=false;
  98.         LMDTrackBar2.Enabled:=false;
  99.         LMDTrackBar3.Enabled:=false;
  100.         LMDTrackBar4.Enabled:=false;
  101.     end;
  102.     if dllGetAlpha(FlatSpinEditInteger1.Value,a)=1 then
  103.         LMDTrackBar5.Position:=Round(a*1000)
  104.     else
  105.     begin
  106.         LMDTrackBar5.Enabled:=false;
  107.     end;
  108. end;
  109. procedure TForm1.FlatSpeedButton1Click(Sender: TObject);
  110. begin
  111.     LMDTrackBar4.Position:=LMDTrackBar4.MaxValue DIV 2;
  112.     SetAMP;
  113. end;
  114. procedure TForm1.FlatSpeedButton2Click(Sender: TObject);
  115. begin
  116.     LMDTrackBar3.Position:=LMDTrackBar3.MaxValue DIV 2;
  117.     SetAMP;
  118. end;
  119. procedure TForm1.FlatSpeedButton3Click(Sender: TObject);
  120. begin
  121.     LMDTrackBar1.Position:=LMDTrackBar1.MaxValue DIV 2;
  122.     SetAMP;
  123. end;
  124. procedure TForm1.FlatSpeedButton4Click(Sender: TObject);
  125. begin
  126.     LMDTrackBar2.Position:=LMDTrackBar2.MaxValue DIV 2;
  127.     SetAMP;
  128. end;
  129. procedure TForm1.FlatSpeedButton5Click(Sender: TObject);
  130. begin
  131.     LMDTrackBar5.Position:=LMDTrackBar5.MaxValue;
  132.     dllSetAlpha(FlatSpinEditInteger1.Value,LMDTrackBar5.Position/1000);
  133. end;
  134. procedure TForm1.FlatButton1Click(Sender: TObject);
  135. begin
  136.     FlatSpeedButton1.Click;
  137.     FlatSpeedButton2.Click;
  138.     FlatSpeedButton3.Click;
  139.     FlatSpeedButton4.Click;
  140.     FlatSpeedButton5.Click;
  141. end;
  142. procedure TForm1.FlatButton2Click(Sender: TObject);
  143. Var
  144.     Val1,Val2:LongInt;
  145. begin
  146.     DllConfig('SHOWVIDEOPROPERTY',Val1,Val2);
  147. end;
  148. end.