docstr: Draw a line, or a connected sequence of line segments.
docstr_tok: ["Draw","a","line",",","or","a","connected","sequence","of","line","segments","."]
code: def line(self, xy, fill=None, width=0, joint=None):
      """Draw a line, or a connected sequence of line segments."""
      ink = self._getink(fill)[0]
      if ink is not None:
          self.draw.draw_lines(xy, ink, width)
          if joint == "curve" and width > 4:
              if not isinstance(xy[0], (list, tuple)):
                  xy = [
                      tuple(xy[i : i + 2]) for i in range(0, len(xy), 2)
                  ]
              for i in range(1, len(xy) - 1):
                  point = xy[i]
                  angles = [
                      math.degrees(
                          math.atan2(
                              end[0] - start[0], start[1] - end[1]
                          )
                      )
                      % 360
                      for start, end in (
                          (xy[i - 1], point),
                          (point, xy[i + 1]),
                      )
                  ]
                  if angles[0] == angles[1]:
                      # This is a straight line, so no joint is required
                      continue
  
                  def coord_at_angle(coord, angle):
                      x, y = coord
                      angle -= 90
                      distance = width / 2 - 1
                      return tuple(
                          p
                          + (
                              math.floor(p_d)
                              if p_d > 0
                              else math.ceil(p_d)
                          )
                          for p, p_d in (
                              (
                                  x,
                                  distance
                                  * math.cos(math.radians(angle)),
                              ),
                              (
                                  y,
                                  distance
                                  * math.sin(math.radians(angle)),
                              ),
                          )
                      )
  
                  flipped = (
                      angles[1] > angles[0]
                      and angles[1] - 180 > angles[0]
                  ) or (
                      angles[1] < angles[0]
                      and angles[1] + 180 > angles[0]
                  )
                  coords = [
                      (
                          point[0] - width / 2 + 1,
                          point[1] - width / 2 + 1,
                      ),
                      (
                          point[0] + width / 2 - 1,
                          point[1] + width / 2 - 1,
                      ),
                  ]
                  if flipped:
                      start, end = (angles[1] + 90, angles[0] + 90)
                  else:
                      start, end = (angles[0] - 90, angles[1] - 90)
                  self.pieslice(coords, start - 90, end - 90, fill)
  
                  if width > 8:
                      # Cover potential gaps between the line and the joint
                      if flipped:
                          gapCoords = [
                              coord_at_angle(point, angles[0] + 90),
                              point,
                              coord_at_angle(point, angles[1] + 90),
                          ]
                      else:
                          gapCoords = [
                              coord_at_angle(point, angles[0] - 90),
                              point,
                              coord_at_angle(point, angles[1] - 90),
                          ]
                      self.line(gapCoords, fill, width=3)
  
imports: import math
  import numbers
  from .None import Image, ImageColor, ImageFont
label_desc: Use image node_id 8 for calling the ImageDraw obj's underlying member method code with example usage: obj.line(xy, fill, width, joint) and returns: tuple