-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchop+save.py
36 lines (30 loc) · 1.09 KB
/
chop+save.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pygame
import sys
from Constant import NoteType, NoteIMG, NoteInfo
ni = NoteInfo()
nt = NoteType()
nt_img = NoteIMG()
def foo(noteType, lane):
if noteType is not nt.flick:
image = ni.notesPNG.subsurface(
list(ni(noteType, lane).values())
).copy()
elif noteType is nt.flick:
flick_body, flick_top = ni(nt.flick, lane)
_, __, wb, hb = flick_body.values()
_, __, wt, ht = flick_top.values()
flick_body = ni.notesPNG.subsurface(
list(flick_body.values())
)
flick_top = ni.notesPNG.subsurface(
list(flick_top.values())
)
pygame.image.save(flick_body, "res/" + noteType + '_' + str(lane) + '.png')
image = pygame.Surface((wb, hb+round(ht/1.5)), pygame.SRCALPHA)
image.blit(flick_body, (0, image.get_height()-hb))
image.blit(flick_top, (round((wb-wt)/2),0))
else:
print('Unsupported Note Type.', file=sys.stderr)
sys.exit(-3)
pygame.image.save(image, "res/2UN"+noteType+'_'+str(lane)+'.png')
[foo(nt.flick, i) for i in range(1, 8)]