docstr: Draw a rounded rectangle.
docstr_tok: ["Draw","a","rounded","rectangle","."]
code: def rounded_rectangle(
      self, xy, radius=0, fill=None, outline=None, width=1
  ):
      """Draw a rounded rectangle."""
      if isinstance(xy[0], (list, tuple)):
          (x0, y0), (x1, y1) = xy
      else:
          x0, y0, x1, y1 = xy
  
      d = radius * 2
  
      full_x = d >= x1 - x0
      if full_x:
          # The two left and two right corners are joined
          d = x1 - x0
      full_y = d >= y1 - y0
      if full_y:
          # The two top and two bottom corners are joined
          d = y1 - y0
      if full_x and full_y:
          # If all corners are joined, that is a circle
          return self.ellipse(xy, fill, outline, width)
  
      if d == 0:
          # If the corners have no curve, that is a rectangle
          return self.rectangle(xy, fill, outline, width)
  
      r = d // 2
      ink, fill = self._getink(outline, fill)
  
      def draw_corners(pieslice):
          if full_x:
              # Draw top and bottom halves
              parts = (
                  ((x0, y0, x0 + d, y0 + d), 180, 360),
                  ((x0, y1 - d, x0 + d, y1), 0, 180),
              )
          elif full_y:
              # Draw left and right halves
              parts = (
                  ((x0, y0, x0 + d, y0 + d), 90, 270),
                  ((x1 - d, y0, x1, y0 + d), 270, 90),
              )
          else:
              # Draw four separate corners
              parts = (
                  ((x1 - d, y0, x1, y0 + d), 270, 360),
                  ((x1 - d, y1 - d, x1, y1), 0, 90),
                  ((x0, y1 - d, x0 + d, y1), 90, 180),
                  ((x0, y0, x0 + d, y0 + d), 180, 270),
              )
          for part in parts:
              if pieslice:
                  self.draw.draw_pieslice(*(part + (fill, 1)))
              else:
                  self.draw.draw_arc(*(part + (ink, width)))
  
      if fill is not None:
          draw_corners(True)
  
          if full_x:
              self.draw.draw_rectangle(
                  (x0, y0 + r + 1, x1, y1 - r - 1), fill, 1
              )
          else:
              self.draw.draw_rectangle(
                  (x0 + r + 1, y0, x1 - r - 1, y1), fill, 1
              )
          if not full_x and not full_y:
              self.draw.draw_rectangle(
                  (x0, y0 + r + 1, x0 + r, y1 - r - 1), fill, 1
              )
              self.draw.draw_rectangle(
                  (x1 - r, y0 + r + 1, x1, y1 - r - 1), fill, 1
              )
      if ink is not None and ink != fill and width != 0:
          draw_corners(False)
  
          if not full_x:
              self.draw.draw_rectangle(
                  (x0 + r + 1, y0, x1 - r - 1, y0 + width - 1), ink, 1
              )
              self.draw.draw_rectangle(
                  (x0 + r + 1, y1 - width + 1, x1 - r - 1, y1), ink, 1
              )
          if not full_y:
              self.draw.draw_rectangle(
                  (x0, y0 + r + 1, x0 + width - 1, y1 - r - 1), ink, 1
              )
              self.draw.draw_rectangle(
                  (x1 - width + 1, y0 + r + 1, x1, y1 - r - 1), ink, 1
              )
  
imports: import math
  import numbers
  from .None import Image, ImageColor, ImageFont
label_desc: Use image node_id 15 for calling the ImageDraw obj's underlying member method code with example usage: obj.rounded_rectangle(xy, radius, fill, outline, width) and returns: self, self