code: def __init__(self):
      app.Canvas.__init__(self, size=(512, 512), keys="interactive")
  
      self.image = Program(image_vertex, image_fragment, 4)
      self.image["position"] = (-1, -1), (-1, +1), (+1, -1), (+1, +1)
      self.image["texcoord"] = (0, 0), (0, +1), (+1, 0), (+1, +1)
      self.image["vmin"] = +0.0
      self.image["vmax"] = +1.0
      self.image["cmap"] = 0  # Colormap index to use
      self.image["colormaps"] = colormaps
      self.image["n_colormaps"] = colormaps.shape[0]
      self.image["image"] = idxs.astype("float32")
      self.image["image"].interpolation = "linear"
  
      set_viewport(0, 0, *self.physical_size)
  
      self.lines = Program(lines_vertex, lines_fragment)
      self.lines["position"] = np.zeros(
          (4 + 4 + 514 + 514, 2), np.float32
      )
      color = np.zeros((4 + 4 + 514 + 514, 4), np.float32)
      color[1 : 1 + 2, 3] = 0.25
      color[5 : 5 + 2, 3] = 0.25
      color[9 : 9 + 512, 3] = 0.5
      color[523 : 523 + 512, 3] = 0.5
      self.lines["color"] = color
  
      set_state(
          clear_color="white",
          blend=True,
          blend_func=("src_alpha", "one_minus_src_alpha"),
      )
  
      self.show()
  
file_path: vispy/examples/demo/gloo/imshow_cuts.py
imports: import numpy
  from vispy import app
  from vispy.gloo import set_viewport, clear, set_state, Program
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()