getData method

Uint8List getData()

Gets the raw data buffer of the image.

return Raw data buffer of the image. throws FaceException An error has occurred during Face Library execution.

Implementation

Uint8List getData() {
  Pointer<UnsignedChar> pData = nullptr;
  Pointer<Int> pDataSize = calloc();
  pDataSize[0] = -1;
  try {
    var err = faceSDK.id3FaceImage_GetData(_pHandle.value, pData, pDataSize);
    if (err == FaceError.insufficientBuffer.value) {
      pData = calloc.allocate(pDataSize.value);
      err = faceSDK.id3FaceImage_GetData(_pHandle.value, pData, pDataSize);
    }
    if (err != FaceError.success.value) {
      throw FaceException(err);
    }
    final vData = Uint8List.fromList(pData.cast<Uint8>().asTypedList(pDataSize.value));
    return vData;
  } finally {
    calloc.free(pData);
    calloc.free(pDataSize);
  }
}