getTextSizeAsync function
GetTextSizeWithBaseline calculates the width and height of a text string including the basline of the text. It returns an image.Point with the size required to draw text using a specific font face, scale, and thickness as well as its baseline.
For further details, please see: http:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga3d2abfcb995fd2db908c8288199dba82
Implementation
Future<(Size size, int baseline)> getTextSizeAsync(
String text,
int fontFace,
double fontScale,
int thickness,
) {
final pBaseline = calloc<ffi.Int>();
final size = calloc<cvg.CvSize>();
final textPtr = text.toNativeUtf8().cast<ffi.Char>();
return cvRunAsync0(
(callback) => cimgproc.cv_getTextSize(
textPtr,
fontFace,
fontScale,
thickness,
pBaseline,
size,
callback,
),
(c) {
final rval = (Size.fromPointer(size), pBaseline.value);
calloc.free(pBaseline);
return c.complete(rval);
},
);
}