From e83796c102bc3ca289329ed4e69f872db719fc92 Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Mon, 27 Sep 2010 19:24:43 +0200 Subject: [PATCH] Deal with higher-resolution textures --- textures.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/textures.py b/textures.py index 28953d5..6237447 100644 --- a/textures.py +++ b/textures.py @@ -92,13 +92,19 @@ def _get_terrain_image(): def _split_terrain(terrain): """Builds and returns a length 256 array of each 16x16 chunk of texture""" textures = [] + (terrain_width, terrain_height) = terrain.size + texture_resolution = terrain_width / 16 for y in xrange(16): for x in xrange(16): - left = x*16 - upper = y*16 - right = left+16 - lower = upper+16 - region = terrain.crop((left,upper,right,lower)) + left = x*texture_resolution + upper = y*texture_resolution + right = left+texture_resolution + lower = upper+texture_resolution + region = terrain.transform( + (16, 16), + Image.EXTENT, + (left,upper,right,lower), + Image.BICUBIC) textures.append(region) return textures