INNER CODE UNIT · Python
_get_gradient
ljvmiranda921/sprites-as-a-service · backend/sprites/sprites.py:161
def _get_gradient(
mat: np.ndarray, map_range: Tuple[float, float] = (0.2, 0.25)
) -> np.ndarray:
"""Get gradient of an outline sprite
We use gradient as a way to shade the body of the sprite. It is a crude
approach, but it works most of the time.
Parameters
----------
mat : np.ndarray
The input sprite with outline
map_range : tuple of floats
Map the gradients within a certain set of values. The default is
between 0.2 and 0.25 because those values look better in the color map.
Returns
-------