+ chansons dans svn:ignore.
[minwii.git] / src / minwii / widgets / data / minwii_theme / generate.py
1 import pygame
2 from pygame.locals import *
3 pygame.display.init()
4 pygame.display.set_mode((80,80),32)
5
6 def prep(name):
7 fname = name+".png"
8 img = pygame.image.load(fname)
9 w,h = img.get_width()/2,img.get_height()/2
10
11 out = pygame.Surface((w*3,h*3),SWSURFACE|SRCALPHA,32)
12 out.fill((0,0,0,0))
13 out.blit(img.subsurface(0,0,w,h),(0,0))
14 out.blit(img.subsurface(w,0,w,h),(w*2,0))
15 out.blit(img.subsurface(0,h,w,h),(0,h*2))
16 out.blit(img.subsurface(w,h,w,h),(w*2,h*2))
17 for i in range(0,w):
18 img = out.subsurface((w-1,0,1,h*3)).convert_alpha()
19 out.blit(img,(w+i,0))
20 for i in range(0,h):
21 img = out.subsurface((0,h-1,w*3,1)).convert_alpha()
22 out.blit(img,(0,h+i))
23
24 return out,w,h
25
26 todo = [
27 ('button.normal','dot.normal',None,3,3,'789456123'),
28 ('button.hover','dot.hover',None,3,3,'789456123'),
29 ('button.down','dot.down',None,3,3,'789456123'),
30
31 ('checkbox.off.normal','box.normal',None,2,2,'7913'),
32 ('checkbox.on.normal','box.down','check',2,2,'7913'),
33 ('checkbox.off.hover','box.hover',None,2,2,'7913'),
34 ('checkbox.on.hover','box.hover','check',2,2,'7913'),
35
36 ('radio.off.normal','dot.normal',None,2,2,'7913'),
37 ('radio.on.normal','dot.down','radio',2,2,'7913'),
38 ('radio.off.hover','dot.hover',None,2,2,'7913'),
39 ('radio.on.hover','dot.hover','radio',2,2,'7913'),
40
41 ('tool.normal','box.normal',None,3,3,'789456123'),
42 ('tool.hover','box.hover',None,3,3,'789456123'),
43 ('tool.down','box.down',None,3,3,'789456123'),
44
45 ('hslider','idot.normal',None,3,3,'789456123'),
46 ('hslider.bar.normal','dot.normal',None,3,3,'789456123'),
47 ('hslider.bar.hover','dot.hover',None,3,3,'789456123'),
48 ('hslider.left','sbox.normal','left',2,2,'7913'),
49 ('hslider.right','sbox.normal','right',2,2,'7913'),
50
51
52 ('vslider','idot.normal',None,3,3,'789456123'),
53 ('vslider.bar.normal','vdot.normal',None,3,3,'789456123'),
54 ('vslider.bar.hover','vdot.hover',None,3,3,'789456123'),
55 ('vslider.up','vsbox.normal','up',2,2,'7913'),
56 ('vslider.down','vsbox.normal','down',2,2,'7913'),
57
58 ('dialog.close.normal','rdot.hover',None,2,2,'7913'),
59 ('dialog.close.hover','rdot.hover','x',2,2,'7913'),
60 ('dialog.close.down','rdot.down','x',2,2,'7913'),
61
62 ('menu.normal','desktop',None,1,1,'7'),
63 ('menu.hover','box.normal',None,3,3,'789456123'),
64 ('menu.down','box.down',None,3,3,'789456123'),
65
66 ('select.selected.normal','box.normal',None,3,3,'788455122'),
67 ('select.selected.hover','box.hover',None,3,3,'788455122'),
68 ('select.selected.down','box.down',None,3,3,'788455122'),
69
70 ('select.arrow.normal','box.hover',None,3,3,'889556223'),
71 ('select.arrow.hover','box.hover',None,3,3,'889556223'),
72 ('select.arrow.down','box.down',None,3,3,'889556223'),
73
74 ('progressbar','sbox.normal',None,3,3,'789456123'),
75 ('progressbar.bar','box.hover',None,3,3,'789456123'),
76 ]
77
78 for fname,img,over,ww,hh,s in todo:
79 print fname
80 img,w,h = prep(img)
81 out = pygame.Surface((ww*w,hh*h),SWSURFACE|SRCALPHA,32)
82 out.fill((0,0,0,0))
83 n = 0
84 for y in range(0,hh):
85 for x in range(0,ww):
86 c = int(s[n])
87 xx,yy = (c-1)%3,2-(c-1)/3
88 out.blit(img.subsurface((xx*w,yy*h,w,h)),(x*w,y*h))
89 n += 1
90 if over != None:
91 over = pygame.image.load(over+".png")
92 out.blit(over,(0,0))
93 pygame.image.save(out,fname+".tga")
94
95
96
97
98