summaryrefslogtreecommitdiff
path: root/games/pysolfc/pillow6.patch
blob: 80f0f1868e1b122b651015323482b142e8acf514 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
From fa20e7f834a1385f383f09a3aa8f4fb4bb86da18 Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlomif@shlomifish.org>
Date: Fri, 5 Apr 2019 17:13:13 +0300
Subject: [PATCH] Try fixing issue #108 - compat with pillow 6.0

See https://github.com/shlomif/PySolFC/issues/108 .
---
 pysollib/mfxutil.py          |  2 +-
 pysollib/ui/tktile/tkutil.py | 11 +++--------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/pysollib/mfxutil.py b/pysollib/mfxutil.py
index a0d0aed4..f461ed10 100644
--- a/pysollib/mfxutil.py
+++ b/pysollib/mfxutil.py
@@ -51,7 +51,7 @@
         from PIL import PpmImagePlugin  # noqa: F401
         Image._initialized = 2
 USE_PIL = False
-if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7':
+if TOOLKIT == 'tk' and Image:
     USE_PIL = True
 
 # debug
diff --git a/pysollib/ui/tktile/tkutil.py b/pysollib/ui/tktile/tkutil.py
index af43130a..0319e6d3 100644
--- a/pysollib/ui/tktile/tkutil.py
+++ b/pysollib/ui/tktile/tkutil.py
@@ -353,15 +353,10 @@ def shadowImage(image, color='#3896f8', factor=0.3):
     if not hasattr(image, '_pil_image'):
         return None
     im = image._pil_image
-    if Image.VERSION >= '1.1.7':
-        # use an alpha image
-        sh = Image.new('RGBA', im.size, color)
-        sh.putalpha(100)
-        out = Image.composite(sh, im, im)
-        return PIL_Image(image=out)
+    # use an alpha image
     sh = Image.new('RGBA', im.size, color)
-    tmp = Image.blend(im, sh, factor)
-    out = Image.composite(tmp, im, im)
+    sh.putalpha(100)
+    out = Image.composite(sh, im, im)
     return PIL_Image(image=out)