class_docstr: Antigrain Geometry Fast Path Collection
  
  This collection provides antialiased and accurate paths with caps and miter
  joins. It consume x4 more memory than regular lines and is a bit slower,
  but the quality of the output is worth the cost. Note that no control can
  be made on miter joins which may result in some glitches on screen.
docstr: Given a path P, return the baked vertices as they should be copied in
  the collection if the path has already been appended.
  
  Examples
  --------
  >>> paths.append(P)
  >>> P *= 2
  >>> paths['prev'][0] = bake(P,'prev')
  >>> paths['curr'][0] = bake(P,'curr')
  >>> paths['next'][0] = bake(P,'next')
docstr_tok: ["Given","a","path","P",",","return","the","baked","vertices","as","they","should","be","copied","in","the","collection","if","the","path","has","already","been","appended",".","Examples","--","--","--","--",">",">",">","paths.append","(","P",")",">",">",">","P","*","=","2",">",">",">","paths","[","'prev","'","]","[","0","]","=","bake","(","P",",","'prev","'",")",">",">",">","paths","[","'curr","'","]","[","0","]","=","bake","(","P",",","'curr","'",")",">",">",">","paths","[","'next","'","]","[","0","]","=","bake","(","P",",","'next","'",")"]
code: def bake(self, P, key="curr", closed=False, itemsize=None):
      """
      Given a path P, return the baked vertices as they should be copied in
      the collection if the path has already been appended.
  
      Examples
      --------
      >>> paths.append(P)
      >>> P *= 2
      >>> paths['prev'][0] = bake(P,'prev')
      >>> paths['curr'][0] = bake(P,'curr')
      >>> paths['next'][0] = bake(P,'next')
  
      """
      itemsize = itemsize or len(P)
      itemcount = len(P) / itemsize  # noqa
      n = itemsize
  
      if closed:
          idxs = np.arange(n + 3)
          if key == "prev":
              idxs -= 2
              idxs[0], idxs[1], idxs[-1] = n - 1, n - 1, n - 1
          elif key == "next":
              idxs[0], idxs[-3], idxs[-2], idxs[-1] = 1, 0, 1, 1
          else:
              idxs -= 1
              idxs[0], idxs[-1], idxs[n + 1] = 0, 0, 0
      else:
          idxs = np.arange(n + 2)
          if key == "prev":
              idxs -= 2
              idxs[0], idxs[1], idxs[-1] = 0, 0, n - 2
          elif key == "next":
              idxs[0], idxs[-1], idxs[-2] = 1, n - 1, n - 1
          else:
              idxs -= 1
              idxs[0], idxs[-1] = 0, n - 1
      idxs = np.repeat(idxs, 2)
      return P[idxs]
  
file_path: vispy/vispy/visuals/collections/agg_fast_path_collection.py
imports: import numpy
  from ...None import glsl
  from ...None import gloo
  from .collection import Collection
  from ..transforms import NullTransform
label_desc: Use image node_id 3 for calling the AggFastPathCollection obj's underlying member method code with example usage: obj.bake(P, key, closed, itemsize) and returns: P