mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 18:03:07 +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):
|
def set_pixel(self, x,y, color):
|
||||||
pixel = self.pixels[y][x]
|
pixel = self.pixels[y][x]
|
||||||
# tuple
|
# 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):
|
class _PyAccess32_4(PyAccess):
|
||||||
def _post_init(self, *args, **kwargs):
|
def _post_init(self, *args, **kwargs):
|
||||||
|
@ -112,8 +113,11 @@ 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 = min(color[0],255)
|
||||||
pixel.r, pixel.g, pixel.b, pixel.a = color
|
pixel.g = min(color[1],255)
|
||||||
|
pixel.b = min(color[2],255)
|
||||||
|
pixel.a = min(color[3],255)
|
||||||
|
|
||||||
|
|
||||||
class _PyAccess8(PyAccess):
|
class _PyAccess8(PyAccess):
|
||||||
def _post_init(self, *args, **kwargs):
|
def _post_init(self, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user