Skip to content

Commit

Permalink
Fixed image functions not supporting falsy parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
HexDecimal committed Mar 17, 2018
1 parent cbfb444 commit a7478af
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 76 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -7,6 +7,13 @@ here.
This project adheres to `Semantic Versioning <https://semver.org/>`_ since
v2.0.0

Unreleased
------------------
Deprecated
- Deprecated the use of falsy console parameters with libtcodpy functions.
Fixed
- Fixed libtcodpy image functions not supporting falsy console parameters.

4.3.1 - 2018-03-07
------------------
Fixed
Expand Down
10 changes: 5 additions & 5 deletions tcod/image.py
Expand Up @@ -4,7 +4,7 @@
import numpy as np

from tcod.libtcod import ffi, lib

from tcod.tcod import _console

class _ImageBufferArray(np.ndarray):

Expand Down Expand Up @@ -126,7 +126,7 @@ def refresh_console(self, console):
console (Console): A Console with a pixel width and height
matching this Image.
"""
lib.TCOD_image_refresh_console(self.image_c, console.console_c)
lib.TCOD_image_refresh_console(self.image_c, _console(console))

def _get_size(self):
"""Return the (width, height) for this Image.
Expand Down Expand Up @@ -203,7 +203,7 @@ def blit(self, console, x, y, bg_blend, scale_x, scale_y, angle):
angle (float): Rotation angle in radians. (Clockwise?)
"""
lib.TCOD_image_blit(
self.image_c, console.console_c,
self.image_c, _console(console),
x, y, bg_blend, scale_x, scale_y, angle)

def blit_rect(self, console, x, y, width, height, bg_blend):
Expand All @@ -218,7 +218,7 @@ def blit_rect(self, console, x, y, width, height, bg_blend):
bg_blend (int): Background blending mode to use.
"""
lib.TCOD_image_blit_rect(
self.image_c, console.console_c, x, y, width, height, bg_blend)
self.image_c, _console(console), x, y, width, height, bg_blend)

def blit_2x(self, console, dest_x, dest_y,
img_x=0, img_y=0, img_width=-1, img_height=-1):
Expand All @@ -236,7 +236,7 @@ def blit_2x(self, console, dest_x, dest_y,
Use -1 for the full Image height.
"""
lib.TCOD_image_blit_2x(
self.image_c, console.console_c,
self.image_c, _console(console),
dest_x, dest_y, img_x, img_y, img_width, img_height)

def save_as(self, filename):
Expand Down

0 comments on commit a7478af

Please sign in to comment.