(self, pattern)
return tile
Build a flood-fill tile.
Build a flood-fill tile.
Build a flood - fill tile .
def __call__(self, pattern):
        """Build a flood-fill tile."""
        # append nulls until we can cleanly partition into planes
        extra_chars = len(pattern) % self._number_planes
        if extra_chars:
            pattern.extend(bytearray(self._number_planes - extra_chars))
        # unpack bytes into pattern
        allplanes = bytematrix.ByteMatrix.frompacked(
            pattern, height=len(pattern), items_per_byte=8
        )
        planes = (
            allplanes[_plane::self._number_planes, :] << _plane
            for _plane in range(self._number_planes)
        )
        tile = functools.reduce(operator.__ior__, planes)
        return tile
def __call__ ( self , pattern ) : # append nulls until we can cleanly partition into planes extra_chars = len ( pattern ) % self . _number_planes if extra_chars : pattern . extend ( bytearray ( self . _number_planes - extra_chars ) ) # unpack bytes into pattern allplanes = bytematrix . ByteMatrix . frompacked ( pattern , height = len ( pattern ) , items_per_byte = 8 ) planes = ( allplanes [ _plane : : self . _number_planes , : ] << _plane for _plane in range ( self . _number_planes ) ) tile = functools . reduce ( operator . __ior__ , planes ) return tile