forked from dantros/grafica
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathex_sira_indirect.py
39 lines (28 loc) · 975 Bytes
/
ex_sira_indirect.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# coding=utf-8
"""Using an indirect color scheme with sira"""
import os, sys
import numpy as np
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import sira
__author__ = "Daniel Calderon"
__license__ = "MIT"
if __name__ == "__main__":
windowSize = (600,600)
S = 100
W = 6
H = 4
windowSize = (W*S, H*S)
colorPalette = np.ndarray((4,3), dtype=np.uint8)
colorPalette[0] = np.array([0,50,0], dtype=np.uint8)
colorPalette[1] = np.array([0,100,0], dtype=np.uint8)
colorPalette[2] = np.array([0,150,0], dtype=np.uint8)
colorPalette[3] = np.array([0,200,0], dtype=np.uint8)
imgData = np.ndarray((W,H), dtype=np.uint8)
imgData[:,0] = 0
imgData[:,1] = 1
imgData[:,2] = 2
imgData[:,3] = 3
display = sira.IndirectRGBRasterDisplay(windowSize, (W,H), "Indirect RGB Raster Display")
display.setColorPalette(colorPalette)
display.setMatrix(imgData)
display.draw()