LowLagPhotoCapture.FinishAsync 메서드

정의

캡처 사진 작업에 사용되는 LowLagPhotoCapture 개체 및 리소스를 비동기적으로 해제합니다.

public:
 virtual IAsyncAction ^ FinishAsync() = FinishAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction FinishAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction FinishAsync();
function finishAsync()
Public Function FinishAsync () As IAsyncAction

반환

비동기 작업을 제어하는 데 사용되는 개체입니다.

특성

예제

다음은 낮은 지연 사진을 설정 및 찍는 방법을 보여 주는 예제입니다. 캡처된 사진과 썸네일을 Image 개체에 표시합니다. XAML은 MediaCapture 요소와 상호 작용할 두 개의 Image 개체와 일부 Button 개체를 사용하여 간단한 UI를 만듭니다. 코드에는 MediaCapture 개체를 초기화하는 메서드, LowLagPhotoCapture 개체를 초기화하는 메서드, 사진을 찍어 표시하는 메서드 및 LowLagPhotoCapture를 종료하는 메서드가 있습니다.

<StackPanel Orientation="Horizontal">
    <Image x:Name="imageLowLagPhoto" Stretch="None" 
           Width="320" Height="240" />
    <Image x:Name="imageLowLagThumbnail" Stretch="None" 
           Width="320" Height="240" />
</StackPanel>

<StackPanel Orientation="Horizontal">
    <Button Click="InitMediaCapture_Click" Content="Initialize Camera" />
    <Button Click="InitLowLagPhotoCapture_Click" Content="Initialize Low Lag Photo Capture"/>
    <Button Click="CaptureLagPhotoCapture_Click" Content="Capture Low Lag Photo"/>
    <Button Click="CloseLagPhotoCapture_Click" Content="Finish low Lag Capture"/>
</StackPanel>
LowLagPhotoCapture lowLagCaptureMgr = null;
MediaCapture mediaCaptureManager;

async private void InitMediaCapture_Click(object sender, RoutedEventArgs e)
{
    mediaCaptureManager = new MediaCapture();
    await mediaCaptureManager.InitializeAsync();
}

async private void InitLowLagPhotoCapture_Click(object sender, RoutedEventArgs e)
{
    // Enable thumbnail images
    mediaCaptureManager.VideoDeviceController.LowLagPhoto.ThumbnailEnabled = true;
    mediaCaptureManager.VideoDeviceController.LowLagPhoto.ThumbnailFormat = MediaThumbnailFormat.Bmp;
    mediaCaptureManager.VideoDeviceController.LowLagPhoto.DesiredThumbnailSize = 25;

    // Image properties
    ImageEncodingProperties imgFormat = ImageEncodingProperties.CreateJpeg();

    // Create LowLagPhotoCapture object
    lowLagCaptureMgr = await mediaCaptureManager.PrepareLowLagPhotoCaptureAsync(imgFormat);
}

async private void CaptureLagPhotoCapture_Click(object sender, RoutedEventArgs e)
{
    // Take photo
    CapturedPhoto photo = await lowLagCaptureMgr.CaptureAsync();

    // Get photo as a BitmapImage
    BitmapImage bitmap = new BitmapImage();
    await bitmap.SetSourceAsync(photo.Frame);

    // Get thumbnail as a BitmapImage
    BitmapImage bitmapThumbnail = new BitmapImage();    
    await bitmapThumbnail.SetSourceAsync(photo.Thumbnail);

    // imageLowLagPhoto is a <Image> object defined in XAML
    imageLowLagPhoto.Source = bitmap;

    // imageLowLagThumbnail is a <Image> object defined in XAML
    imageLowLagThumbnail.Source = bitmapThumbnail;
}

async private void CloseLagPhotoCapture_Click(object sender, RoutedEventArgs e)
{
    // Release the LowLagPhotoCapture object and resources
    await lowLagCaptureMgr.FinishAsync();
}

적용 대상