MCPcopy Create free account
hub / github.com/Image-Py/imagepy / linear_color

Method linear_color

imagepy/ui/widgets/cmappanel.py:38–45  ·  view source on GitHub ↗
(cls, cs)

Source from the content-addressed store, hash-verified

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()

Callers 8

on_ldMethod · 0.95
on_rdMethod · 0.95
on_rdcMethod · 0.95
on_mvMethod · 0.95
on_cmapMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected