HardwareBuffer.Create 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.
Creates a new HardwareBuffer instance.
[Android.Runtime.Register("create", "(IIIIJ)Landroid/hardware/HardwareBuffer;", "", ApiSince=26)]
public static Android.Hardware.HardwareBuffer Create(int width, int height, Android.Hardware.HardwareBufferFormat format, int layers, Android.Hardware.HardwareBufferUsage usage);
[<Android.Runtime.Register("create", "(IIIIJ)Landroid/hardware/HardwareBuffer;", "", ApiSince=26)>]
static member Create : int * int * Android.Hardware.HardwareBufferFormat * int * Android.Hardware.HardwareBufferUsage -> Android.Hardware.HardwareBuffer
Parameters
- width
- Int32
The width in pixels of the buffer. Value is 1 or greater
- height
- Int32
The height in pixels of the buffer. Value is 1 or greater
- format
- HardwareBufferFormat
The @Format of each pixel. Value is one of the following: RGBA_8888; RGBA_FP16; RGBA_1010102; RGBX_8888; RGB_888; RGB_565; BLOB; YCBCR_420_888; D_16; D_24; DS_24UI8; D_FP32; DS_FP32UI8; S_UI8; YCBCR_P010; YCBCR_P210; R_8; R_16; RG_1616; RGBA_10101010; R_12; R_14; RG_1212; RG_1414; RGBA_12121212; RGBA_14141414; BGRA_1010102; BGRX_1010102
- layers
- Int32
The number of layers in the buffer. Value is 1 or greater
- usage
- HardwareBufferUsage
The @Usage flags describing how the buffer will be used. Value is either 0 or a combination of the following: USAGE_CPU_READ_RARELY; USAGE_CPU_READ_OFTEN; USAGE_CPU_WRITE_RARELY; USAGE_CPU_WRITE_OFTEN; USAGE_GPU_SAMPLED_IMAGE; USAGE_GPU_COLOR_OUTPUT; USAGE_COMPOSER_OVERLAY; USAGE_PROTECTED_CONTENT; USAGE_VIDEO_ENCODE; USAGE_GPU_DATA_BUFFER; USAGE_SENSOR_DIRECT_DATA; USAGE_GPU_CUBE_MAP; USAGE_GPU_MIPMAP_COMPLETE; USAGE_FRONT_BUFFER
Returns
A HardwareBuffer instance if successful, or throws an IllegalArgumentException if the dimensions passed are invalid (either zero, negative, or too large to allocate), if the format is not supported, if the requested number of layers is less than one or not supported, or if the passed usage flags are not a supported set. This value cannot be null.
- Attributes
Remarks
Creates a new HardwareBuffer instance.
Android reference for android.hardware.HardwareBuffer.create.
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.