(canvas, curr_pos, l_args, absolute, color)
Renders a line in the given canvas.
Renders a line in the given canvas.
Renders a line in the given canvas .
def _render_line(canvas, curr_pos, l_args, absolute, color):
  """Renders a line in the given canvas."""
  end_point = l_args
  if not absolute:
    end_point[0] += curr_pos[0]
    end_point[1] += curr_pos[1]
  rr, cc, val = draw.line_aa(int(curr_pos[0]), int(curr_pos[1]),
                             int(end_point[0]), int(end_point[1]))

  max_possible = len(canvas)
  within_range = lambda x: 0 <= x < max_possible
  filtered = [(x, y, v) for x, y, v in zip(rr, cc, val)
              if within_range(x) and within_range(y)]
  if not filtered:
    return
  rr, cc, val = list(zip(*filtered))
  val = [(v * color) for v in val]
  canvas[cc, rr, :] = val
def _render_line ( canvas , curr_pos , l_args , absolute , color ) : end_point = l_args if not absolute : end_point [ 0 ] += curr_pos [ 0 ] end_point [ 1 ] += curr_pos [ 1 ] rr , cc , val = draw . line_aa ( int ( curr_pos [ 0 ] ) , int ( curr_pos [ 1 ] ) , int ( end_point [ 0 ] ) , int ( end_point [ 1 ] ) ) max_possible = len ( canvas ) within_range = lambda x : 0 <= x < max_possible filtered = [ ( x , y , v ) for x , y , v in zip ( rr , cc , val ) if within_range ( x ) and within_range ( y ) ] if not filtered : return rr , cc , val = list ( zip ( * filtered ) ) val = [ ( v * color ) for v in val ] canvas [ cc , rr , : ] = val