mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
clamping channels to 255
This commit is contained in:
parent
53ba63fcd5
commit
c3812f46b2
|
@ -98,8 +98,9 @@ class _PyAccess32_3(PyAccess):
|
|||
def set_pixel(self, x,y, color):
|
||||
pixel = self.pixels[y][x]
|
||||
# tuple
|
||||
pixel.r, pixel.g, pixel.b = color
|
||||
|
||||
pixel.r = min(color[0],255)
|
||||
pixel.g = min(color[1],255)
|
||||
pixel.b = min(color[2],255)
|
||||
|
||||
class _PyAccess32_4(PyAccess):
|
||||
def _post_init(self, *args, **kwargs):
|
||||
|
@ -112,8 +113,11 @@ 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
|
||||
pixel.r = min(color[0],255)
|
||||
pixel.g = min(color[1],255)
|
||||
pixel.b = min(color[2],255)
|
||||
pixel.a = min(color[3],255)
|
||||
|
||||
|
||||
class _PyAccess8(PyAccess):
|
||||
def _post_init(self, *args, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue
Block a user