hue shift; fill tile

This commit is contained in:
Frank DeMarco 2015-09-07 12:19:51 -04:00
parent bf38844bbd
commit d8f3a3df1b
1 changed files with 18 additions and 0 deletions

View File

@ -143,3 +143,21 @@ def get_busy_channel_count():
for index in xrange(get_num_channels()):
count += Channel(index).get_busy()
return count
def get_hue_shifted_surface(base, offset):
surface = base.copy()
pixels = PixelArray(surface)
color = Color(0, 0, 0)
for x in xrange(surface.get_width()):
for y in xrange(surface.get_height()):
h, s, l, a = Color(*surface.unmap_rgb(pixels[x][y])).hsla
if a:
color.hsla = (h + offset) % 360, s, l, a
pixels[x][y] = color
del pixels
return surface
def fill_tile(surface, tile):
for x in xrange(0, surface.get_width(), tile.get_width()):
for y in xrange(0, surface.get_height(), tile.get_height()):
surface.blit(tile, (x, y))