Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@pending_deprecate()
def image_blit(
image: tcod.image.Image,
console: tcod.console.Console,
x: float,
y: float,
bkgnd_flag: int,
scalex: float,
scaley: float,
angle: float,
) -> None:
image.blit(console, x, y, bkgnd_flag, scalex, scaley, angle)
@pending_deprecate()
def namegen_parse(
filename: str, random: Optional[tcod.random.Random] = None
) -> None:
lib.TCOD_namegen_parse(_bytes(filename), random or ffi.NULL)
@pending_deprecate()
def heightmap_lerp_hm(
hm1: np.ndarray, hm2: np.ndarray, hm3: np.ndarray, coef: float
) -> None:
"""Perform linear interpolation between two heightmaps storing the result
in ``hm3``.
This is the same as doing ``hm3[:] = hm1[:] + (hm2[:] - hm1[:]) * coef``
Args:
hm1 (numpy.ndarray): The first heightmap.
hm2 (numpy.ndarray): The second heightmap to add to the first.
hm3 (numpy.ndarray): A destination heightmap to store the result.
coef (float): The linear interpolation coefficient.
"""
lib.TCOD_heightmap_lerp_hm(
_heightmap_cdata(hm1),
@pending_deprecate()
def color_gen_map(
colors: Iterable[Tuple[int, int, int]], indexes: Iterable[int]
) -> List[Color]:
"""Return a smoothly defined scale of colors.
If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
All in-betweens will be filled with a gradient.
Args:
colors (Iterable[Union[Tuple[int, int, int], Sequence[int]]]):
Array of colors to be sampled.
indexes (Iterable[int]): A list of indexes.
Returns:
List[Color]: A list of Color instances.
@pending_deprecate()
def image_new(width: int, height: int) -> tcod.image.Image:
return tcod.image.Image(width, height)
@pending_deprecate()
def color_set_hsv(c: Color, h: float, s: float, v: float) -> None:
"""Set a color using: hue, saturation, and value parameters.
Does not return a new Color. ``c`` is modified inplace.
Args:
c (Union[Color, List[Any]]): A Color instance, or a list of any kind.
h (float): Hue, from 0 to 360.
s (float): Saturation, from 0 to 1.
v (float): Value, from 0 to 1.
"""
new_color = ffi.new("TCOD_color_t*")
lib.TCOD_color_set_HSV(new_color, h, s, v)
c[:] = new_color.r, new_color.g, new_color.b
@pending_deprecate()
def dijkstra_path_set(p: tcod.path.Dijkstra, x: int, y: int) -> bool:
return bool(lib.TCOD_dijkstra_path_set(p._path_c, x, y))
@pending_deprecate()
def path_get_destination(p: tcod.path.AStar) -> Tuple[int, int]:
"""Get the current destination position.
Args:
p (AStar): An AStar instance.
Returns:
Tuple[int, int]: An (x, y) point.
"""
x = ffi.new("int *")
y = ffi.new("int *")
lib.TCOD_path_get_destination(p._path_c, x, y)
return x[0], y[0]
@pending_deprecate()
def dijkstra_new(m: tcod.map.Map, dcost: float = 1.41) -> tcod.path.Dijkstra:
return tcod.path.Dijkstra(m, dcost)
@pending_deprecate()
def image_get_alpha(image: tcod.image.Image, x: int, y: int) -> int:
return image.get_alpha(x, y)