(
            self, line_seed, x_start, x_stop, y,
            tile, is_solid, bg_tile, border_attr, ydir
        )
return line_seed
Append all subintervals between border colours to the scanning stack.
Append all subintervals between border colours to the scanning stack.
Append all subintervals between border colours to the scanning stack .
def _check_scanline(
            self, line_seed, x_start, x_stop, y,
            tile, is_solid, bg_tile, border_attr, ydir
        ):
        """Append all subintervals between border colours to the scanning stack."""
        if x_stop < x_start:
            return line_seed
        max_width = x_stop - x_start + 1
        # repeat row ceildiv + 1 times to ensure we can start in the middle of the first tile
        rtile = tile[y % tile.height, :]
        repeated_tile = rtile.htile(1 - (-max_width // rtile.width))
        if bg_tile:
            # bg_tile is only one row
            repeated_back = bg_tile.htile(1 - (-max_width // bg_tile.width))
        x = x_start
        while x <= x_stop:
            # scan horizontally until border colour found, then append interval & continue scanning
            pattern = self._scanline_until(border_attr, y, x, x_stop+1)
            if pattern.width > 0:
                # check if scanline pattern matches fill pattern
                tile_x = x % rtile.width
                has_same_pattern = (
                    # don't match zero row unless pattern is solid (special case)
                    # - avoid breaking off pattern filling on zero rows
                    # - but also don't loop forever on solid background fills
                    # - if the fill attribute is not 0, the behaviour differs:
                    #   here, the fill breaks off on encountering the matching solid line
                    (is_solid or rtile != ZERO_TILE[0, :rtile.width])
                    and pattern == repeated_tile[0, tile_x : tile_x+pattern.width]
                )
                # background tile specified: don't stop if we match the background tile (fully!)
                if bg_tile:
                    has_same_pattern = has_same_pattern and (
                        pattern.width < bg_tile.width
                        or pattern != repeated_back[0, tile_x : tile_x+pattern.width]
                    )
                # we've reached a border colour, append our interval & start a new one
                # don't append if same fill colour/pattern,
                # to avoid infinite loops over bits already painted (eg. 00 shape)
                if not has_same_pattern:
                    line_seed.append([x, x + pattern.width - 1, y, ydir])
            x += pattern.width + 1
        return line_seed
def _check_scanline ( self , line_seed , x_start , x_stop , y , tile , is_solid , bg_tile , border_attr , ydir ) : if x_stop < x_start : return line_seed max_width = x_stop - x_start + 1 # repeat row ceildiv + 1 times to ensure we can start in the middle of the first tile rtile = tile [ y % tile . height , : ] repeated_tile = rtile . htile ( 1 - ( - max_width // rtile . width ) ) if bg_tile : # bg_tile is only one row repeated_back = bg_tile . htile ( 1 - ( - max_width // bg_tile . width ) ) x = x_start while x <= x_stop : # scan horizontally until border colour found, then append interval & continue scanning pattern = self . _scanline_until ( border_attr , y , x , x_stop + 1 ) if pattern . width > 0 : # check if scanline pattern matches fill pattern tile_x = x % rtile . width has_same_pattern = ( # don't match zero row unless pattern is solid (special case) # - avoid breaking off pattern filling on zero rows # - but also don't loop forever on solid background fills # - if the fill attribute is not 0, the behaviour differs: #   here, the fill breaks off on encountering the matching solid line ( is_solid or rtile != ZERO_TILE [ 0 , : rtile . width ] ) and pattern == repeated_tile [ 0 , tile_x : tile_x + pattern . width ] ) # background tile specified: don't stop if we match the background tile (fully!) if bg_tile : has_same_pattern = has_same_pattern and ( pattern . width < bg_tile . width or pattern != repeated_back [ 0 , tile_x : tile_x + pattern . width ] ) # we've reached a border colour, append our interval & start a new one # don't append if same fill colour/pattern, # to avoid infinite loops over bits already painted (eg. 00 shape) if not has_same_pattern : line_seed . append ( [ x , x + pattern . width - 1 , y , ydir ] ) x += pattern . width + 1 return line_seed