Ejemplo n.º 1
0
 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())
Ejemplo n.º 2
0
 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())
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
            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
Ejemplo n.º 6
0
            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