Compartir a través de


Bitmap.WrapHardwareBuffer(HardwareBuffer, ColorSpace) Method

Definition

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.

Java documentation for android.graphics.Bitmap.wrapHardwareBuffer(android.hardware.HardwareBuffer, android.graphics.ColorSpace).

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.

Applies to