Skip to main content

OH_PixelmapNative_CreatePixelmapUsingAllocator

Function OH_PixelmapNative_CreatePixelmapUsingAllocator 

Source
pub unsafe extern "C" fn OH_PixelmapNative_CreatePixelmapUsingAllocator(
    data: *mut u8,
    dataLength: usize,
    options: *mut OH_Pixelmap_InitializationOptions,
    allocator: IMAGE_ALLOCATOR_MODE,
    pixelmap: *mut *mut OH_PixelmapNative,
) -> ImageResult
Available on crate features api-12 and pixelmap and api-20 only.
Expand description

Creates a pixelmap based on options OH_Pixelmap_InitializationOptions, the memory type used by the pixelmap can be specified by allocatorType IMAGE_ALLOCATOR_MODE. By default, the system selects the memory type based on the image type, image size, platform capability, etc. When processing the pixelmap returned by this interface, please always consider the impact of stride.

§Arguments

  • data - Input color buffer in BGRA_8888 format by default.

  • dataLength - Length of input buffer in bytes.

  • options - Pixelmap initialization properties including size, pixel format, alpha type, and editable flags.

  • allocator - Indicate which memory type will be used by the returned pixelmap.

  • pixelmap - Output parameter receiving the created pixelmap object pointer.

§Returns

  • Function result code: [IMAGE_SUCCESS] If the operation is successful. [IMAGE_BAD_PARAMETER] If the param is nullptr or invalid. [IMAGE_TOO_LARGE] too large data or image. [IMAGE_UNSUPPORTED_OPERATION] unsupported operations. [IMAGE_DMA_OPERATION_FAILED] DMA operation failed. [IMAGE_ALLOCATOR_MODE_UNSUPPORTED] unsupported allocator mode, e.g., use share memory to create a HDR image as only DMA supported hdr metadata.

Available since API-level: 20