InfraredTorchControl クラス

定義

キャプチャ デバイスで赤外線トーチ LED 設定を制御する機能を提供します。

public ref class InfraredTorchControl sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 524288)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class InfraredTorchControl final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 524288)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class InfraredTorchControl
Public NotInheritable Class InfraredTorchControl
継承
Object Platform::Object IInspectable InfraredTorchControl
属性

Windows の要件

デバイス ファミリ
Windows 10, version 1903 (10.0.18362.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v8.0 で導入)

using Windows.Media.Capture;

MediaCapture mediaCapture = new MediaCapture();

public MainPage()
{
    this.InitializeComponent();
}

protected override async void OnNavigatedTo(NavigationEventArgs e)
{
    await mediaCapture.InitializeAsync();

    // Preview is Windows.UI.Xaml.Controls.CaptureElement defined in XAML file
    // and used to render camera preview
    Preview.Source = mediaCapture;
    await mediaCapture.StartPreviewAsync();

    if (!TryIncrementInfraredPower())
    {
        Debug.WriteLine("Failed to increment InfraredTorch power");
    }
}

private bool TryIncrementInfraredPower()
{
    bool incrementSucceeded = false;

    if (mediaCapture.VideoDeviceController.InfraredTorchControl.IsSupported)
    {
        Debug.WriteLine("IR torch supported");
        InfraredTorchControl infraredTorchControl = mediaCapture.VideoDeviceController.InfraredTorchControl;
        var maxPower = infraredTorchControl.MaxPower;
        var powerStep = infraredTorchControl.PowerStep;
        var oldPower = infraredTorchControl.Power;

        if (oldPower < maxPower)
        {
            infraredTorchControl.Power = oldPower + powerStep;
            incrementSucceeded = true;
        }
        else
        {
            Debug.WriteLine("InfraredTorch is already at max power");
        }
    }

    return incrementSucceeded;
}

注釈

InfraredTorchControl を使用すると、アプリは赤外線 LED の電源と動作を制御できます。

デバイスでこのコントロールがサポートされているかどうかを確認するには、 赤外線TorchControl.IsSupported を確認します。

MediaCapture.VideoDeviceController を使用して、キャプチャ デバイスの赤外線TorchControl にアクセスできます。

プロパティ

CurrentMode

赤外線 LED の現在の動作モードを取得します。

IsSupported

キャプチャ デバイスが 赤外線TorchControl をサポートしているかどうかを示す値を取得します。

MaxPower

キャプチャ デバイスでサポートされている赤外線 LED の最大電力値を取得します。

MinPower

キャプチャ デバイスでサポートされている赤外線 LED の最小電力値を取得します。

Power

現在の赤外線 LED 電源値を取得または設定します。

PowerStep

サポートされている電源ステップ値を取得します。

SupportedModes

SupportedModes プロパティは、赤外線 LED でサポートされているモードを確認するために使用されます。

適用対象

こちらもご覧ください