(canvas, curr_pos, c_args, absolute, color)
Renders a cubic bezier curve in the given canvas.
Renders a cubic bezier curve in the given canvas.
Renders a cubic bezier curve in the given canvas .
def _render_cubic(canvas, curr_pos, c_args, absolute, color):
  """Renders a cubic bezier curve in the given canvas."""
  if not absolute:
    c_args[0] += curr_pos[0]
    c_args[1] += curr_pos[1]
    c_args[2] += curr_pos[0]
    c_args[3] += curr_pos[1]
    c_args[4] += curr_pos[0]
    c_args[5] += curr_pos[1]
  x, y = _cubicbezier(curr_pos[0], curr_pos[1],
                      c_args[0], c_args[1],
                      c_args[2], c_args[3],
                      c_args[4], c_args[5])
  max_possible = len(canvas)
  x = [int(round(x_)) for x_ in x]
  y = [int(round(y_)) for y_ in y]
  within_range = lambda x: 0 <= x < max_possible
  filtered = [(x_, y_) for x_, y_ in zip(x, y)
              if within_range(x_) and within_range(y_)]
  if not filtered:
    return
  x, y = list(zip(*filtered))
  canvas[y, x, :] = color
def _render_cubic ( canvas , curr_pos , c_args , absolute , color ) : if not absolute : c_args [ 0 ] += curr_pos [ 0 ] c_args [ 1 ] += curr_pos [ 1 ] c_args [ 2 ] += curr_pos [ 0 ] c_args [ 3 ] += curr_pos [ 1 ] c_args [ 4 ] += curr_pos [ 0 ] c_args [ 5 ] += curr_pos [ 1 ] x , y = _cubicbezier ( curr_pos [ 0 ] , curr_pos [ 1 ] , c_args [ 0 ] , c_args [ 1 ] , c_args [ 2 ] , c_args [ 3 ] , c_args [ 4 ] , c_args [ 5 ] ) max_possible = len ( canvas ) x = [ int ( round ( x_ ) ) for x_ in x ] y = [ int ( round ( y_ ) ) for y_ in y ] within_range = lambda x : 0 <= x < max_possible filtered = [ ( x_ , y_ ) for x_ , y_ in zip ( x , y ) if within_range ( x_ ) and within_range ( y_ ) ] if not filtered : return x , y = list ( zip ( * filtered ) ) canvas [ y , x , : ] = color