コード例 #1
0
 def test_fix15_to_uint8_opaque(self):
     """Fully opaque tile stays fully opaque"""
     src = np.zeros((N, N, 4), 'uint16')
     src[:, :, 3] = 1 << 15
     src[:, :, :3] = np.random.randint(0, 1 << 15, (N, N, 3))
     dst = np.zeros((N, N, 4), 'uint8')
     mypaintlib.tile_convert_rgba16_to_rgba8(src, dst)
     self.assertTrue((dst[:, :, 3] == 255).all(), msg="Not fully opaque")
コード例 #2
0
ファイル: mypaintlib.py プロジェクト: sam-m888/mypaint
 def test_fix15_to_uint8_opaque(self):
     """Fully opaque tile stays fully opaque"""
     src = np.zeros((N, N, 4), 'uint16')
     src[:, :, 3] = 1 << 15
     src[:, :, :3] = np.random.randint(0, 1 << 15, (N, N, 3))
     dst = np.zeros((N, N, 4), 'uint8')
     mypaintlib.tile_convert_rgba16_to_rgba8(src, dst)
     self.assertTrue((dst[:, :, 3] == 255).all(), msg="Not fully opaque")
コード例 #3
0
ファイル: test_mypaintlib.py プロジェクト: chunws/mypaint
def tileConversions():
    # fully transparent tile stays fully transparent (without noise)
    N = mypaintlib.TILE_SIZE
    src = np.zeros((N, N, 4), 'uint16')
    dst = np.ones((N, N, 4), 'uint8')
    mypaintlib.tile_convert_rgba16_to_rgba8(src, dst)
    assert not dst.any()
    # fully opaque tile stays fully opaque
    src[:, :, 3] = 1 << 15
    src[:, :, :3] = np.randint(0, 1 << 15, (N, N, 3))
    dst = np.zeros((N, N, 4), 'uint8')
    mypaintlib.tile_convert_rgba16_to_rgba8(src, dst)
    assert (dst[:, :, 3] == 255).all()
コード例 #4
0
ファイル: test_mypaintlib.py プロジェクト: dvberkel/mypaint
def tileConversions():
    # fully transparent tile stays fully transparent (without noise)
    N = mypaintlib.TILE_SIZE
    src = zeros((N, N, 4), 'uint16')
    dst = ones((N, N, 4), 'uint8')
    mypaintlib.tile_convert_rgba16_to_rgba8(src, dst)
    assert not dst.any()
    # fully opaque tile stays fully opaque
    src[:,:,3] = 1<<15
    src[:,:,:3] = randint(0, 1<<15, (N, N, 3))
    dst = zeros((N, N, 4), 'uint8')
    mypaintlib.tile_convert_rgba16_to_rgba8(src, dst)
    assert (dst[:,:,3] == 255).all()
コード例 #5
0
 def test_fix15_to_int8_transparent(self):
     """Fully transparent tile stays fully transparent, without noise"""
     src = np.zeros((N, N, 4), 'uint16')
     dst = np.ones((N, N, 4), 'uint8')
     mypaintlib.tile_convert_rgba16_to_rgba8(src, dst)
     self.assertFalse(dst.any(), msg="Not fully transparent")
コード例 #6
0
ファイル: mypaintlib.py プロジェクト: sam-m888/mypaint
 def test_fix15_to_int8_transparent(self):
     """Fully transparent tile stays fully transparent, without noise"""
     src = np.zeros((N, N, 4), 'uint16')
     dst = np.ones((N, N, 4), 'uint8')
     mypaintlib.tile_convert_rgba16_to_rgba8(src, dst)
     self.assertFalse(dst.any(), msg="Not fully transparent")