color component difference

This commit is contained in:
Frank 2016-03-12 00:13:01 -05:00
parent 05619331aa
commit 1f4b3384ed
1 changed files with 12 additions and 1 deletions

View File

@ -163,7 +163,18 @@ def get_hue_shifted_surface(base, offset):
return surface
def get_inverted_surface(base):
return get_hue_shifted_surface(base, 180)
surface = base.copy()
pixels = PixelArray(surface)
for x in xrange(surface.get_width()):
for y in xrange(surface.get_height()):
color = Color(*surface.unmap_rgb(pixels[x][y]))
if color.hsla[3]:
color.r = 255 - color.r
color.g = 255 - color.g
color.b = 255 - color.b
pixels[x][y] = color
del pixels
return surface
def fill_tile(surface, tile):
for x in xrange(0, surface.get_width(), tile.get_width()):