(cls, cs)
| 36 | |
| 37 | @classmethod |
| 38 | def linear_color(cls, cs): |
| 39 | cs = sorted(cs) |
| 40 | cmap = np.vstack([np.arange(256)]*3).T |
| 41 | for i in range(1, len(cs)): |
| 42 | c1, c2 = cs[i-1][1:], cs[i][1:] |
| 43 | rs, gs, bs = [np.linspace(c1[j], c2[j], cs[i][0]-cs[i-1][0]+1) for j in (0,1,2)] |
| 44 | cmap[cs[i-1][0]:cs[i][0]+1] = np.array((rs, gs, bs)).T |
| 45 | return cmap.astype(np.uint8) |
| 46 | |
| 47 | def on_size(self, event): |
| 48 | self.init_buf() |