diff options
Diffstat (limited to 'contrib/python/Pillow/py3/PIL/ImageDraw.py')
-rw-r--r-- | contrib/python/Pillow/py3/PIL/ImageDraw.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/python/Pillow/py3/PIL/ImageDraw.py b/contrib/python/Pillow/py3/PIL/ImageDraw.py index fbf320d72a..84665f54ff 100644 --- a/contrib/python/Pillow/py3/PIL/ImageDraw.py +++ b/contrib/python/Pillow/py3/PIL/ImageDraw.py @@ -29,9 +29,11 @@ # # See the README file for information on usage and redistribution. # +from __future__ import annotations import math import numbers +import struct from . import Image, ImageColor @@ -542,7 +544,8 @@ class ImageDraw: # font.getmask2(mode="RGBA") returns color in RGB bands and mask in A # extract mask and set text alpha color, mask = mask, mask.getband(3) - color.fillband(3, (ink >> 24) & 0xFF) + ink_alpha = struct.pack("i", ink)[3] + color.fillband(3, ink_alpha) x, y = coord self.im.paste(color, (x, y, x + mask.size[0], y + mask.size[1]), mask) else: @@ -921,7 +924,7 @@ def floodfill(image, xy, value, border=None, thresh=0): if border is None: fill = _color_diff(p, background) <= thresh else: - fill = p != value and p != border + fill = p not in (value, border) if fill: pixel[s, t] = value new_edge.add((s, t)) |