drawCircle function

Image drawCircle(
  1. Image image, {
  2. required int x,
  3. required int y,
  4. required int radius,
  5. required Color color,
  6. bool antialias = false,
  7. Image? mask,
  8. Channel maskChannel = Channel.luminance,
})

Draw a circle into the image with a center of x,y and the given radius and color.

Implementation

Image drawCircle(Image image,
    {required int x,
    required int y,
    required int radius,
    required Color color,
    bool antialias = false,
    Image? mask,
    Channel maskChannel = Channel.luminance}) {
  if (antialias) {
    return drawAntialiasCircle(image,
        x: x,
        y: y,
        radius: radius,
        color: color,
        mask: mask,
        maskChannel: maskChannel);
  }

  final points = calculateCircumference(image, x, y, radius);
  for (final pt in points) {
    drawPixel(image, pt.xi, pt.yi, color, mask: mask, maskChannel: maskChannel);
  }
  return image;
}