getTextSize function

(Size, int) getTextSize(
  1. String text,
  2. int fontFace,
  3. double fontScale,
  4. int thickness,
)

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

(Size size, int baseline) getTextSize(
  String text,
  int fontFace,
  double fontScale,
  int thickness,
) {
  return using<(Size, int)>((arena) {
    final baseline = arena<ffi.Int>();
    final size = calloc<cvg.Size>();
    final textPtr = text.toNativeUtf8(allocator: arena);
    cvRun(() =>
        cffi.GetTextSizeWithBaseline(textPtr.cast(), fontFace, fontScale, thickness, baseline, size));
    return (Size.fromPointer(size), baseline.value);
  });
}