(path, absolute=False, color=constant_color)
return canvas
Render the icon's edges, given its path.
Render the icon's edges, given its path.
Render the icon s edges given its path .
def per_step_render(path, absolute=False, color=constant_color):
  """Render the icon's edges, given its path."""
  to_canvas_size = lambda l: [float(f) * (64./24.) for f in l]

  canvas = np.zeros((64, 64, 3))
  curr_pos = (0.0, 0.0)
  for i, cmd in enumerate(path):
    if not cmd: continue
    if cmd[0] in 'mM':
      curr_pos = _update_pos(curr_pos, to_canvas_size(cmd[-2:]), absolute)
    elif cmd[0] in 'cC':
      _render_cubic(canvas, curr_pos, to_canvas_size(cmd[1:]), absolute,
                    color(i, 55))
      curr_pos = _update_pos(curr_pos, to_canvas_size(cmd[-2:]), absolute)
    elif cmd[0] in 'lL':
      _render_line(canvas, curr_pos, to_canvas_size(cmd[1:]), absolute,
                   color(i, 55))
      curr_pos = _update_pos(curr_pos, to_canvas_size(cmd[1:]), absolute)

  return canvas
def per_step_render ( path , absolute = False , color = constant_color ) : to_canvas_size = lambda l : [ float ( f ) * ( 64. / 24. ) for f in l ] canvas = np . zeros ( ( 64 , 64 , 3 ) ) curr_pos = ( 0.0 , 0.0 ) for i , cmd in enumerate ( path ) : if not cmd : continue if cmd [ 0 ] in 'mM' : curr_pos = _update_pos ( curr_pos , to_canvas_size ( cmd [ - 2 : ] ) , absolute ) elif cmd [ 0 ] in 'cC' : _render_cubic ( canvas , curr_pos , to_canvas_size ( cmd [ 1 : ] ) , absolute , color ( i , 55 ) ) curr_pos = _update_pos ( curr_pos , to_canvas_size ( cmd [ - 2 : ] ) , absolute ) elif cmd [ 0 ] in 'lL' : _render_line ( canvas , curr_pos , to_canvas_size ( cmd [ 1 : ] ) , absolute , color ( i , 55 ) ) curr_pos = _update_pos ( curr_pos , to_canvas_size ( cmd [ 1 : ] ) , absolute ) return canvas