Add runes
This commit is contained in:
parent
06529d5516
commit
8a16f37328
7 changed files with 15 additions and 15 deletions
BIN
assets/alphabet-complete.jpg
Normal file
BIN
assets/alphabet-complete.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
BIN
assets/blue.png
Normal file
BIN
assets/blue.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
BIN
assets/green.png
Normal file
BIN
assets/green.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
assets/red.png
Normal file
BIN
assets/red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/white.png
Normal file
BIN
assets/white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
assets/yellow.png
Normal file
BIN
assets/yellow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
30
main.py
30
main.py
|
|
@ -4,35 +4,27 @@ from __future__ import print_function
|
||||||
from wand.image import Image
|
from wand.image import Image
|
||||||
from wand.drawing import Drawing
|
from wand.drawing import Drawing
|
||||||
from wand.color import Color
|
from wand.color import Color
|
||||||
|
from wand.display import display
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
colors = ['red', 'green', 'blue', 'yellow']
|
colors = ['red', 'green', 'blue', 'yellow']
|
||||||
special_cards = ['W', 'N']
|
special_cards = ['W', 'N']
|
||||||
|
|
||||||
for color in colors:
|
for color in colors:
|
||||||
for i in range(1, 14):
|
for i in range(1, 4):
|
||||||
draw_card_face_number(color, i)
|
draw_card_face(color, i)
|
||||||
|
|
||||||
for sign in special_cards:
|
for sign in special_cards:
|
||||||
draw_card_face_special('white', sign)
|
draw_card_face('white', sign)
|
||||||
|
|
||||||
def draw_card_face_number(color, symbol):
|
def draw_card_face(color, symbol):
|
||||||
with Image(filename='assets/wozard-card.png') as img:
|
with Image(filename='assets/wozard-card.png') as img:
|
||||||
img = draw_symbol(img, symbol, color, 90, 130)
|
img = draw_symbol(img, symbol, color, 90, 130)
|
||||||
img = draw_symbol(img, symbol, color, int(img.width - 90), 130)
|
img = draw_symbol(img, symbol, color, int(img.width - 90), 130)
|
||||||
img.flip()
|
img.flip() # Make mirrored text
|
||||||
img = draw_symbol(img, symbol, color, 90, 130)
|
|
||||||
img = draw_symbol(img, symbol, color, int(img.width - 100), 130)
|
|
||||||
img.save(filename='output/card-{}-{}.png'.format(color, symbol))
|
|
||||||
|
|
||||||
def draw_card_face_special(color, symbol):
|
|
||||||
with Image(filename='assets/wozard-card.png') as img:
|
|
||||||
img = draw_symbol(img, symbol, color, 90, 130)
|
|
||||||
img = draw_symbol(img, symbol, color, int(img.width - 90), 130)
|
|
||||||
img.flip()
|
|
||||||
img = draw_symbol(img, symbol, color, 90, 130)
|
img = draw_symbol(img, symbol, color, 90, 130)
|
||||||
img = draw_symbol(img, symbol, color, int(img.width - 100), 130)
|
img = draw_symbol(img, symbol, color, int(img.width - 100), 130)
|
||||||
|
img = draw_rune(img, color)
|
||||||
img.save(filename='output/card-{}-{}.png'.format(color, symbol))
|
img.save(filename='output/card-{}-{}.png'.format(color, symbol))
|
||||||
|
|
||||||
def draw_symbol(img, symbol, color, x, y):
|
def draw_symbol(img, symbol, color, x, y):
|
||||||
|
|
@ -43,7 +35,15 @@ def draw_symbol(img, symbol, color, x, y):
|
||||||
draw.fill_color=Color(color)
|
draw.fill_color=Color(color)
|
||||||
draw.text(x, y, str(symbol))
|
draw.text(x, y, str(symbol))
|
||||||
draw(img)
|
draw(img)
|
||||||
|
return img
|
||||||
|
|
||||||
|
def draw_rune(img, color):
|
||||||
|
with Image(filename='assets/{}.png'.format(color)) as rune:
|
||||||
|
rune.resize(110,122)
|
||||||
|
img.composite(
|
||||||
|
rune,
|
||||||
|
left=int((img.width - rune.width) / 2),
|
||||||
|
top=int((img.height - rune.height) / 2))
|
||||||
return img
|
return img
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue