fix inputoverlay text blank and backgroundinputoverlay size
-from PIL import Image
+from PIL import Image, ImageDraw
import numpy as np
+from EEnum.EImageFrom import ImageFrom
from ImageProcess.Animation.size import shrink
from ImageProcess.PrepareFrames.YImage import YImage
from ImageProcess import imageproc
@@ -19,9 +20,19 @@ def prepare_scoreentry(scale, color):
:return: [PIL.Image]
"""
numbers_animation = []
+ imagedraw = None
+ img = None
for x in range(10):
number = YImage(scoreentry + str(x), scale)
- tmp = imageproc.add_color(number.img, color)
+ if number.imgfrom == ImageFrom.BLANK:
+ img = Image.new("RGBA", (14, 14))
+ imagedraw = ImageDraw.Draw(img)
+ size = imagedraw.getfont().getsize(str(x))
+ imagedraw.text((0, 0), str(x), (255, 255, 255, 255))
+ img = imageproc.change_size(img.crop((0, 0, size[0], size[1])), scale * 1.2, scale * 1.2)
+ else:
+ img = number.img
+ tmp = imageproc.add_color(img, color)
numbers_animation.append(shrink(tmp, 1, 0.3, 0.05 * 60/Settings.fps))
return numbers_animation
@@ -57,7 +68,7 @@ def prepare_inputoverlaybg(scale):
:param scale: float
:return: [PIL.Image]
"""
- yimg = YImage(bg, scale)
+ yimg = YImage(bg, scale * 1.05)
img = yimg.img.transpose(Image.ROTATE_270)
frame = [img]
return frame
