cutFaceRawImage method Null safety
- Format colorFormat,
- FaceCutType cutType
Crop face in RawImage format (with raw pixels).
colorFormat
- Image color model.
cutType
- Face cropping types.
Implementation
RawImageF cutFaceRawImage(Format colorFormat, FaceCutType cutType) {
final exception = _getException();
Pointer<Int32> widthPtr = malloc.allocate(sizeOf<Pointer<Int32>>());
Pointer<Int32> heightPtr = malloc.allocate(sizeOf<Pointer<Int32>>());
Pointer<Pointer<Void>> bufer = malloc.allocate(sizeOf<Pointer<Pointer<Uint8>>>());
final get = _dll_handle.lookupFunction<_RScutFaceImage_c, _RScutFaceImage_dart>
(_c_namespace + 'RawSample_cutFaceImage');
get(
this._impl,
bufer.cast(),
Pointer.fromFunction(WrapBytesWrite.writeByteListFunc),
widthPtr,
heightPtr,
-1,
colorFormat.index,
cutType.index,
exception);
checkException(exception, _dll_handle);
int width = widthPtr.value;
int height = heightPtr.value;
Pointer<Uint8> bufferData = bufer.value.cast<Uint8>();
malloc.free(widthPtr);
malloc.free(heightPtr);
malloc.free(bufer);
return RawImageF(width, height, colorFormat, bufferData.cast());
}