mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
existing behaviour is to clamp to max, not bitmask
This commit is contained in:
parent
32f4097d1e
commit
594276c45e
|
@ -112,6 +112,7 @@ class _PyAccess32_4(PyAccess):
|
|||
def set_pixel(self, x,y, color):
|
||||
pixel = self.pixels[y][x]
|
||||
# tuple
|
||||
#undone clamp?
|
||||
pixel.r, pixel.g, pixel.b, pixel.a = color
|
||||
|
||||
class _PyAccess8(PyAccess):
|
||||
|
@ -124,10 +125,10 @@ class _PyAccess8(PyAccess):
|
|||
def set_pixel(self, x,y, color):
|
||||
try:
|
||||
# integer
|
||||
self.pixels[y][x] = color & 0xFF
|
||||
self.pixels[y][x] = min(color,255)
|
||||
except:
|
||||
# tuple
|
||||
self.pixels[y][x] = color[0] & 0xFF
|
||||
self.pixels[y][x] = min(color[0],255)
|
||||
|
||||
|
||||
mode_map = {'1': _PyAccess8,
|
||||
|
|
Loading…
Reference in New Issue
Block a user