Esempio n. 1
0
def test_bgr_to_rgba():
    data = os.urandom(192)
    array = np.ndarray((8, 8, 3), 'u1', data)
    result = glnext.rgba(data, 'bgr')
    assert len(result) == 256
    expected = np.full((8, 8, 4), 255, 'u1')
    expected[:, :, 0] = array[:, :, 2]
    expected[:, :, 1] = array[:, :, 1]
    expected[:, :, 2] = array[:, :, 0]
    assert result == expected.tobytes()
Esempio n. 2
0
def test_lum_to_rgba():
    data = os.urandom(64)
    array = np.ndarray((8, 8), 'u1', data)
    result = glnext.rgba(data, 'lum')
    assert len(result) == 256
    expected = np.full((8, 8, 4), 255, 'u1')
    expected[:, :, 0] = array
    expected[:, :, 1] = array
    expected[:, :, 2] = array
    assert result == expected.tobytes()
Esempio n. 3
0
def test_bgra_to_rgba():
    data = os.urandom(256)
    array = np.ndarray((8, 8, 4), 'u1', data)
    result = glnext.rgba(data, 'bgra')
    assert len(result) == 256
    expected = np.zeros((8, 8, 4), 'u1')
    expected[:, :, 0] = array[:, :, 2]
    expected[:, :, 1] = array[:, :, 1]
    expected[:, :, 2] = array[:, :, 0]
    expected[:, :, 3] = array[:, :, 3]
    assert result == expected.tobytes()
import glnext
import imageio
import mymodule

windows = mymodule.init()
instance = glnext.instance(surface='VK_KHR_win32_surface')

image = instance.image((640, 360), mode='output')
buffer = instance.staging_buffer([[image]])

for wnd in windows:
    instance.surface(wnd, image)

reader = imageio.get_reader('assets/bunny.mp4')

for im in reader:
    buffer.write(glnext.rgba(im, 'rgb'))
    instance.run()
Esempio n. 5
0
def test_rgba_to_rgba():
    data = os.urandom(256)
    result = glnext.rgba(data, 'rgba')
    assert len(result) == 256
    assert result == data