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,
) {
  final pBaseline = calloc<ffi.Int>();
  final size = calloc<cvg.CvSize>();
  final textPtr = text.toNativeUtf8().cast<ffi.Char>();
  cvRun(
    () => cimgproc.cv_getTextSize(
      textPtr,
      fontFace,
      fontScale,
      thickness,
      pBaseline,
      size,
      ffi.nullptr,
    ),
  );
  final rval = (Size.fromPointer(size), pBaseline.value);
  calloc.free(pBaseline);
  return rval;
}