Reduce the amount of file I/O and the number of image files we need
Before Width: | Height: | Size: 921 B After Width: | Height: | Size: 921 B |
BIN
ui/res/go_d.png
Before Width: | Height: | Size: 656 B |
BIN
ui/res/go_dl.png
Before Width: | Height: | Size: 1.1 KiB |
BIN
ui/res/go_dr.png
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 656 B After Width: | Height: | Size: 656 B |
BIN
ui/res/go_l.png
Before Width: | Height: | Size: 666 B |
BIN
ui/res/go_r.png
Before Width: | Height: | Size: 665 B |
BIN
ui/res/go_ur.png
Before Width: | Height: | Size: 1.1 KiB |
|
@ -221,10 +221,23 @@ def _build_img_res():
|
||||||
height = ret['bT'].get_height()
|
height = ret['bT'].get_height()
|
||||||
triangle.composite(ret['bT'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
triangle.composite(ret['bT'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
||||||
|
|
||||||
for d in ('u', 'd', 'l', 'r', 'm', 'dl', 'dr', 'ul', 'ur', 'h', 'w', 'b'):
|
base = _load_png('go_corner.png')
|
||||||
|
ret['ul'] = base
|
||||||
|
ret['dl'] = base.copy().rotate_simple(90)
|
||||||
|
ret['dr'] = base.copy().rotate_simple(180)
|
||||||
|
ret['ur'] = base.copy().rotate_simple(270)
|
||||||
|
|
||||||
|
base = _load_png('go_edge.png')
|
||||||
|
ret['u'] = base
|
||||||
|
ret['l'] = base.copy().rotate_simple(90)
|
||||||
|
ret['d'] = base.copy().rotate_simple(180)
|
||||||
|
ret['r'] = base.copy().rotate_simple(270)
|
||||||
|
|
||||||
|
for d in ('m', 'h', 'w', 'b'):
|
||||||
ret[d] = _load_png('go_' + d + '.png')
|
ret[d] = _load_png('go_' + d + '.png')
|
||||||
|
|
||||||
ret[d + 'C'] = _load_png('go_' + d + '.png')
|
for d in ('u', 'd', 'l', 'r', 'm', 'dl', 'dr', 'ul', 'ur', 'h', 'w', 'b'):
|
||||||
|
ret[d + 'C'] = ret[d].copy()
|
||||||
width = ret[d + 'C'].get_width()
|
width = ret[d + 'C'].get_width()
|
||||||
height = ret[d + 'C'].get_height()
|
height = ret[d + 'C'].get_height()
|
||||||
circle.composite(ret[d + 'C'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
circle.composite(ret[d + 'C'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
||||||
|
@ -237,30 +250,4 @@ def _load_png(name):
|
||||||
fullname = os.path.join('ui/res/', name)
|
fullname = os.path.join('ui/res/', name)
|
||||||
image = gtk.gdk.pixbuf_new_from_file(fullname)
|
image = gtk.gdk.pixbuf_new_from_file(fullname)
|
||||||
|
|
||||||
# if alpha is not None:
|
|
||||||
# image = _set_alpha(image, alpha)
|
|
||||||
|
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
|
||||||
# _trans_png = None
|
|
||||||
|
|
||||||
# def _set_alpha(image, alpha):
|
|
||||||
# """
|
|
||||||
# change_opacity - changes the opacity of pixbuf by combining
|
|
||||||
# the pixbuf with a pixbuf derived from a transparent .png
|
|
||||||
|
|
||||||
# returns: a pixbuf of image made alpha more composite
|
|
||||||
# """
|
|
||||||
|
|
||||||
# global _trans_png
|
|
||||||
|
|
||||||
# if _trans_png == None:
|
|
||||||
# _trans_png = _load_png('transparent.png')
|
|
||||||
|
|
||||||
# width = image.get_width()
|
|
||||||
# height = image.get_height()
|
|
||||||
|
|
||||||
# trans= _trans_png.scale_simple(width,height,gtk.gdk.INTERP_NEAREST)
|
|
||||||
# trans.composite(image, 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, alpha)
|
|
||||||
# return trans
|
|
||||||
|
|