draw method

void draw(
  1. Image img,
  2. int width,
  3. int height,
  4. int channel,
  5. List<int> regions,
  6. List<int> colors,
)

@brief draw color to regions of img.

@param img the image to draw. @param w the image's width. @param h the image's height. @param c the image's channel. @param regions the regions to draw, size is num * 3 contain num x { y, xl, xr } @param num regions num @param color the color to draw.

Implementation

void draw(Image img, int width, int height, int channel, List<int> regions, List<int> colors) {
  final pRegions = calloc<ffi.Int>(regions.length);
  pRegions.cast<ffi.Int32>().asTypedList(regions.length).setAll(0, regions);
  final pColors = calloc<ffi.Uint8>(colors.length);
  pColors.asTypedList(colors.length).setAll(0, colors);
  c.mnn_cv_image_process_draw(
    ptr,
    img.ptr.cast(),
    width,
    height,
    channel,
    pRegions,
    regions.length,
    pColors,
  );
  calloc.free(pRegions);
  calloc.free(pColors);
}