pierogis.ingredients.sort module

class pierogis.ingredients.sort.Sort(opacity: int = 100, mask: Optional[numpy.ndarray] = None, **kwargs)[source]

Bases: pierogis.ingredients.ingredient.Ingredient

sort a pixel array

uses its mask to determine which groups of pixels to sort (white pixels get sorted)

can use a seasoning to create that mask when cooking, or have it preloaded using a season method

cook(pixels: numpy.ndarray)[source]

cook sorts from bottom to top after rotation, then unrotates. sort within each sequence group of contiguous white pixels in the mask (may be all white)

delimiter: numpy.ndarray

pixel used as the sort subgroup delimiter

prep(rotate: Optional[pierogis.ingredients.rotate.Rotate] = None, delimiter: numpy.ndarray = array([255, 255, 255]), **kwargs)[source]

extra kwargs get passed to the Rotate if one is not provided

rotate: pierogis.ingredients.rotate.Rotate

define the direction to rotate on