WriteableBitmap 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供可寫入並更新的 BitmapSource 。
public ref class WriteableBitmap sealed : BitmapSource
/// [Windows.Foundation.Metadata.Activatable(Microsoft.UI.Xaml.Media.Imaging.IWriteableBitmapFactory, 65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class WriteableBitmap final : BitmapSource
[Windows.Foundation.Metadata.Activatable(typeof(Microsoft.UI.Xaml.Media.Imaging.IWriteableBitmapFactory), 65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class WriteableBitmap : BitmapSource
Public NotInheritable Class WriteableBitmap
Inherits BitmapSource
- 繼承
- 屬性
範例
關於 C# 和 C++/WinRT 的程式碼範例,請參見 WriteableBitmap.PixelBuffer。
備註
可寫位圖的影像來源資料是一個底層的像素緩衝區。
WriteableBitmap.PixelBuffer 回傳的 IBuffer 無法直接寫入。 但你可以用語言特定的技術寫入緩衝區底層的像素內容。 詳情請參閱 WriteableBitmap.PixelBuffer 的備註區段。
過去 XAML 框架中可能使用 WriteableBitmap 類別的某些情境,在 Windows 執行階段 中可改用 RenderTargetBitmap 類別來實現。 更多資訊請參見 RenderTargetBitmap。
建構函式
| 名稱 | Description |
|---|---|
| WriteableBitmap(Int32, Int32) |
初始化 WriteableBitmap 類別的新實例。 |
屬性
| 名稱 | Description |
|---|---|
| Dispatcher |
它總是在 Windows 應用程式 SDK 應用程式中回傳 |
| DispatcherQueue |
得到 |
| PixelBuffer |
取得可 寫位圖 每個像素所寫入的直接緩衝區存取權。 |
| PixelHeight |
它會取得點陣圖的高度(像素單位)。 (繼承來源 BitmapSource) |
| PixelWidth |
會得到點陣圖的寬度(像素數)。 (繼承來源 BitmapSource) |
方法
| 名稱 | Description |
|---|---|
| ClearValue(DependencyProperty) |
清除依賴性財產的局部價值。 (繼承來源 DependencyObject) |
| GetAnimationBaseValue(DependencyProperty) |
回傳任何為相依屬性建立的基礎值,適用於動畫未啟用時。 (繼承來源 DependencyObject) |
| GetValue(DependencyProperty) |
回傳 DependencyObject 中相依屬性的當前有效值。 (繼承來源 DependencyObject) |
| Invalidate() |
請求繪製或重繪整個位圖。 |
| ReadLocalValue(DependencyProperty) |
若設定了本地值,則回傳依賴性質的局部值。 (繼承來源 DependencyObject) |
| RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback) |
註冊一個通知函式,用於監聽此 DependencyObject 實例中特定 DependencyProperty 的變更。 (繼承來源 DependencyObject) |
| SetSource(IRandomAccessStream) |
透過存取串流來設定 BitmapSource 的原始影像。 大多數呼叫者應該改用 SetSourceAsync 。 (繼承來源 BitmapSource) |
| SetSourceAsync(IRandomAccessStream) |
透過存取串流並非同步處理結果,設定 BitmapSource 的原始影像。 (繼承來源 BitmapSource) |
| SetValue(DependencyProperty, Object) |
將相依屬性的局部值設定在 DependencyObject 上。 (繼承來源 DependencyObject) |
| UnregisterPropertyChangedCallback(DependencyProperty, Int64) |
取消先前透過呼叫 RegisterPropertyChangedCallback 註冊的變更通知。 (繼承來源 DependencyObject) |