mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-14 11:26:27 +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):
|
def set_pixel(self, x,y, color):
|
||||||
pixel = self.pixels[y][x]
|
pixel = self.pixels[y][x]
|
||||||
# tuple
|
# tuple
|
||||||
|
#undone clamp?
|
||||||
pixel.r, pixel.g, pixel.b, pixel.a = color
|
pixel.r, pixel.g, pixel.b, pixel.a = color
|
||||||
|
|
||||||
class _PyAccess8(PyAccess):
|
class _PyAccess8(PyAccess):
|
||||||
|
@ -124,10 +125,10 @@ class _PyAccess8(PyAccess):
|
||||||
def set_pixel(self, x,y, color):
|
def set_pixel(self, x,y, color):
|
||||||
try:
|
try:
|
||||||
# integer
|
# integer
|
||||||
self.pixels[y][x] = color & 0xFF
|
self.pixels[y][x] = min(color,255)
|
||||||
except:
|
except:
|
||||||
# tuple
|
# tuple
|
||||||
self.pixels[y][x] = color[0] & 0xFF
|
self.pixels[y][x] = min(color[0],255)
|
||||||
|
|
||||||
|
|
||||||
mode_map = {'1': _PyAccess8,
|
mode_map = {'1': _PyAccess8,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user