語言

Camera.SetPreviewTexture(SurfaceTexture) 方法

定義

警告

deprecated

設定 將 SurfaceTexture 用於現場預覽。

[Android.Runtime.Register("setPreviewTexture", "(Landroid/graphics/SurfaceTexture;)V", "")]
[System.Obsolete("deprecated")]
public void SetPreviewTexture(Android.Graphics.SurfaceTexture? surfaceTexture);
[<Android.Runtime.Register("setPreviewTexture", "(Landroid/graphics/SurfaceTexture;)V", "")>]
[<System.Obsolete("deprecated")>]
member this.SetPreviewTexture : Android.Graphics.SurfaceTexture -> unit

參數

surfaceTexture
SurfaceTexture

預覽影像要傳送到 的 , SurfaceTexture 或是 null 以移除目前的預覽表面貼圖

屬性

例外狀況

如果方法失敗(例如,表面貼圖無法取得或不適用)。

備註

設定 將 SurfaceTexture 用於現場預覽。 預覽需要表面或表面貼圖,而預覽則是拍照的必要條件。 相同的表面紋理可以重新重置而不會造成傷害。 設定預覽表面貼圖會解除任何透過 設定的 #setPreviewDisplay預覽表面。

此方法必須在 #startPreview()之前被呼叫。 唯一的例外是,如果在 startPreview() 呼叫前未設定預覽表面貼圖(或設為 null),則此方法可使用非 null 參數呼叫一次以設定預覽表面。 (這讓攝影機的設置與表面製作可以同時進行,節省時間。)預覽表面貼圖在預覽執行時可能不會改變。

SurfaceTexture 作為預覽材質所提供 SurfaceTexture#getTimestamp() 的時間戳記,其零點未指定,無法直接在不同相機間、同一相機的不同實例間,或同一程式的多次執行中進行比較。

如果你使用預覽資料製作影片或靜態影像,強烈建議用它 android.media.MediaActionSound 來正確標示影像擷取或錄影開始/停止。

Java 文件 android.hardware.Camera.setPreviewTexture(android.graphics.SurfaceTexture)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

另請參閱