Bitmap.WrapHardwareBuffer(HardwareBuffer, ColorSpace) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Create a hardware bitmap backed by a HardwareBuffer
.
[Android.Runtime.Register("wrapHardwareBuffer", "(Landroid/hardware/HardwareBuffer;Landroid/graphics/ColorSpace;)Landroid/graphics/Bitmap;", "", ApiSince=29)]
public static Android.Graphics.Bitmap? WrapHardwareBuffer (Android.Hardware.HardwareBuffer hardwareBuffer, Android.Graphics.ColorSpace? colorSpace);
[<Android.Runtime.Register("wrapHardwareBuffer", "(Landroid/hardware/HardwareBuffer;Landroid/graphics/ColorSpace;)Landroid/graphics/Bitmap;", "", ApiSince=29)>]
static member WrapHardwareBuffer : Android.Hardware.HardwareBuffer * Android.Graphics.ColorSpace -> Android.Graphics.Bitmap
Parameters
- hardwareBuffer
- HardwareBuffer
The HardwareBuffer to wrap.
- colorSpace
- ColorSpace
The color space of the bitmap. Must be a ColorSpace.Rgb
colorspace.
If null, SRGB is assumed.
Returns
A bitmap wrapping the buffer, or null if there was a problem creating the bitmap.
- Attributes
Remarks
Create a hardware bitmap backed by a HardwareBuffer
.
The passed HardwareBuffer's usage flags must contain HardwareBuffer#USAGE_GPU_SAMPLED_IMAGE
.
The bitmap will keep a reference to the buffer so that callers can safely close the HardwareBuffer without affecting the Bitmap. However the HardwareBuffer must not be modified while a wrapped Bitmap is accessing it. Doing so will result in undefined behavior.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.