예제 #1
0
파일: strokemap.py 프로젝트: Xananax/dopey
 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())
예제 #2
0
파일: strokemap.py 프로젝트: Griatch/dopey
 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())
예제 #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)
예제 #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)
예제 #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
예제 #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