def _update_strokemap_with_percept_diff(self, before, after, tx, ty): # get the pixel data to compare data_before = before.get((tx, ty), tiledsurface.transparent_tile).rgba data_after = after.get((tx, ty), tiledsurface.transparent_tile).rgba # calculate pixel changes, and add to the stroke's tiled bitmap differences = empty((N, N), 'uint8') mypaintlib.tile_perceptual_change_strokemap(data_before, data_after, differences) self.strokemap[tx, ty] = zlib.compress(differences.tostring())
def new_from_diff(cls, before, after): """Initialize from a diff or two RGBA arrays.""" differences = numpy.empty((N, N), 'uint8') mypaintlib.tile_perceptual_change_strokemap( before, after, differences, ) return cls.new_from_array(differences)
def new_from_diff(cls, before, after): """Initialize from a diff or two RGBA arrays.""" differences = np.empty((N, N), 'uint8') mypaintlib.tile_perceptual_change_strokemap( before, after, differences, ) return cls.new_from_array(differences)
def work(tx=tx, ty=ty): # get the pixel data to compare a_data = a.get((tx, ty), tiledsurface.transparent_tile).rgba b_data = b.get((tx, ty), tiledsurface.transparent_tile).rgba data = empty((N, N), "uint8") mypaintlib.tile_perceptual_change_strokemap(a_data, b_data, data) data_compressed = zlib.compress(data.tostring()) self.strokemap[tx, ty] = data_compressed
def work(tx=tx, ty=ty): # get the pixel data to compare a_data = a.get((tx, ty), tiledsurface.transparent_tile).rgba b_data = b.get((tx, ty), tiledsurface.transparent_tile).rgba data = empty((N, N), 'uint8') mypaintlib.tile_perceptual_change_strokemap( a_data, b_data, data) data_compressed = zlib.compress(data.tostring()) self.strokemap[tx, ty] = data_compressed