putTextAsync method

Future<void> putTextAsync(
  1. InputOutputArray img,
  2. String text,
  3. Point org,
  4. int fontHeight,
  5. Scalar color, {
  6. int thickness = 1,
  7. int lineType = LINE_8,
  8. bool bottomLeftOrigin = false,
})

Async version of putText

Draws a text string. The function putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by "Tofu" or non-drawn.

img Image. (Only 8UC1/8UC3/8UC4 2D mat is supported.)

text Text string to be drawn.

org Bottom-left/Top-left corner of the text string in the image.

fontHeight Drawing font size by pixel unit.

color Text color.

thickness Thickness of the lines used to draw a text when negative, the glyph is filled. Otherwise, the glyph is drawn with this thickness.

lineType Line type. See the line for details.

bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.

Implementation

Future<void> putTextAsync(
  InputOutputArray img,
  String text,
  Point org,
  int fontHeight,
  Scalar color, {
  int thickness = 1,
  int lineType = LINE_8,
  bool bottomLeftOrigin = false,
}) async {
  final ctext = text.toNativeUtf8().cast<ffi.Char>();
  return cvRunAsync0(
    (callback) => ccontrib.cv_freetype_FreeType2_putText(
      ref,
      img.ref,
      ctext,
      org.ref,
      fontHeight,
      color.ref,
      thickness,
      lineType,
      bottomLeftOrigin,
      callback,
    ),
    (c) {
      calloc.free(ctext);
      return c.complete();
    },
  );
}