プロパティの範囲と既定値の取得

Namespace: FVIL.DS
Assembly: FVILforms (in FVILforms.dll) Version: 3.1.0.0 (3.1.0.9)

Syntax

C#
public virtual void GetRange(
	ref int min,
	ref int max,
	ref int step,
	ref int def,
	ref int flag
)
Visual Basic
Public Overridable Sub GetRange ( 
	ByRef min As Integer,
	ByRef max As Integer,
	ByRef step As Integer,
	ByRef def As Integer,
	ByRef flag As Integer
)

Parameters

min
Type: System..::..Int32%
プロパティの最小値
max
Type: System..::..Int32%
プロパティの最大値
step
Type: System..::..Int32%
プロパティのステップサイズ
def
Type: System..::..Int32%
プロパティの既定値
flag
Type: System..::..Int32%
プロパティの自動制御(0x01)/手動制御(0x02)を示す値

Remarks

Property に指定されているプロパティの範囲と既定値の取得を行います。

Graph に指定されたフィルタグラフが IAMVideoProcAmp インターフェースを実装するソースフィルタを保有している必要があります。 無効な場合は例外(NullReferencedException)が発行されます。

Examples

ソースコード:
C# Copy imageCopy
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using fvalgcli;
using System.Windows.Forms;
using FVIL.DS;

namespace User.SampleCode
{
    public partial class DS
    {
        /// <summary>
        /// ビデオ信号品質調整クラス.
        /// </summary>
        [FvPluginExecute]
        public void VideoProcAmp_GetRange()
        {
            try
            {
                // 1) インスタンスの生成.
                FVIL.DS.CFviGrabber controller = new FVIL.DS.CFviGrabber();

                // 2) グラフの生成.
                //    この例では 0 番目のカメラに接続していますが、接続方法は任意です.
                controller.Create(0, 0);

                // 3) 画像取り込み用バッファの設定.
                controller.ImageType = FVIL.ImageType.RGB24;
                for (int index = 0; index < 3; index++)
                    controller.Images.Add(new FVIL.Data.CFviImage());
                controller.Validate();

                // 4) ビデオ信号品質の調整.
                if (!FVIL.DS.CFviVideoProcAmp.IsSupported(controller))
                    Console.WriteLine("このフィルタグラフは IAMVideoProcAmp インターフェースをサポートしていません。");
                else
                {
                    // ここでは、明るさの範囲と既定値を取得する例を示します.

                    FVIL.DS.CFviVideoProcAmp cc =
                        new CFviVideoProcAmp(controller, VideoProcAmpProperty.Brightness);

                    int min = 0, max = 0, step = 0, def = 0, flag = 0;

                    // 取得.
                    cc.GetRange(ref min, ref max, ref step, ref def, ref flag);

                    Console.WriteLine("{0}", cc.Property.ToString());
                    Console.WriteLine("Min    : {0}", min);
                    Console.WriteLine("Max    : {0}", max);
                    Console.WriteLine("Step   : {0}", step);
                    Console.WriteLine("Default: {0}", def);
                    Console.WriteLine("Value  : {0}", cc.Value);
                    Console.WriteLine("Flag   : {0}", flag);
                }
            }
            catch (FVIL.DS.CFviExceptionDS ex)
            {
                Console.WriteLine("Message:{0}", ex.Message );
                Console.WriteLine("DSMessage:{0}", CFviExceptionDS.GetDirectShowMessage(ex.ComError));
            }
            catch (FVIL.CFviException ex)
            {
                Console.WriteLine("--Function = {0} ErrorCode = {1}", ex.Function, ex.ErrorCode);
                Console.WriteLine("--Message:{0}", ex.Message);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("--Message:{0}", ex.Message);
            }
        }
    }
}


Visual Basic Copy imageCopy
Imports System.Collections.Generic
Imports System.Text
Imports System.Drawing
Imports fvalgcli
Imports System.Windows.Forms
Imports FVIL.DS

Namespace SampleCode
    Public Partial Class DS
        ''' <summary>
        ''' ビデオ信号品質調整クラス.
        ''' </summary>
        <FvPluginExecute> _
        Public Sub VideoProcAmp_GetRange()
            Try
                ' 1) インスタンスの生成.
                Dim controller As New FVIL.DS.CFviGrabber()

                ' 2) グラフの生成.
                '    この例では 0 番目のカメラに接続していますが、接続方法は任意です.
                controller.Create(0, 0)

                ' 3) 画像取り込み用バッファの設定.
                controller.ImageType = FVIL.ImageType.RGB24
                For index As Integer = 0 To 2
                    controller.Images.Add(New FVIL.Data.CFviImage())
                Next
                controller.Validate()

                ' 4) ビデオ信号品質の調整.
                If Not FVIL.DS.CFviVideoProcAmp.IsSupported(controller) Then
                    Console.WriteLine("このフィルタグラフは IAMVideoProcAmp インターフェースをサポートしていません。")
                Else
                    ' ここでは、明るさの範囲と既定値を取得する例を示します.

                    Dim cc As FVIL.DS.CFviVideoProcAmp = New CFviVideoProcAmp(controller, VideoProcAmpProperty.Brightness)

                    Dim min As Integer = 0, max As Integer = 0, [step] As Integer = 0, def As Integer = 0, flag As Integer = 0

                    ' 取得.
                    cc.GetRange(min, max, [step], def, flag)

                    Console.WriteLine("{0}", cc.[Property].ToString())
                    Console.WriteLine("Min    : {0}", min)
                    Console.WriteLine("Max    : {0}", max)
                    Console.WriteLine("Step   : {0}", [step])
                    Console.WriteLine("Default: {0}", def)
                    Console.WriteLine("Value  : {0}", cc.Value)
                    Console.WriteLine("Flag   : {0}", flag)
                End If
            Catch ex As FVIL.DS.CFviExceptionDS
                Console.WriteLine("Message:{0}", ex.Message)
                Console.WriteLine("DSMessage:{0}", CFviExceptionDS.GetDirectShowMessage(ex.ComError))
            Catch ex As FVIL.CFviException
                Console.WriteLine("--Function = {0} ErrorCode = {1}", ex.[Function], ex.ErrorCode)
                Console.WriteLine("--Message:{0}", ex.Message)
            Catch ex As System.Exception
                Console.WriteLine("--Message:{0}", ex.Message)
            End Try
        End Sub
    End Class
End Namespace

See Also