Improve speed by using a 1-bit mask instead of the alpha channel when pasting blocks

master
Zeg9 2013-01-04 11:17:21 +01:00
parent 8073b1dbe2
commit ed613dd6fd
2 changed files with 3 additions and 1 deletions

View File

@ -70,11 +70,13 @@ for name in textures:
side = Image.open(os.path.join("textures", textures[name][1])).convert("RGBA")
blocks[name] = build_block(top, side)
mask = Image.open("mask.png").convert("1")
map = Map(".")
def drawNode(canvas, x, y, z, block, start):
canvas.paste(block, (start[0] + NODE_SIZE/2 * (z - x), start[1] + NODE_SIZE/4 * (x + z - 2 * y)), block)
canvas.paste(block, (start[0] + NODE_SIZE/2 * (z - x), start[1] + NODE_SIZE/4 * (x + z - 2 * y)), mask)
def drawBlock(canvas, bx, by, bz, start):

BIN
mask.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B