Esempio n. 1
0
    def shift_right(self):
        new_map = []

        for i in range(0, self.height):
            line = [pixel(0, 0, 0)] + self.pixel_map[(self.width*i):(self.width*(i+1))-1]
            new_map += line

        self.pixel_map = new_map
Esempio n. 2
0
    def shift_left(self):
        new_map = []

        for i in range(0, self.height):
            line = self.pixel_map[(self.width*i)+1:(self.width*(i+1))] + [pixel(0, 0, 0)]
            new_map += line

        self.pixel_map = new_map
Esempio n. 3
0
def rand_pixel():
    return pixel(random.randint(-MAX, MAX), random.randint(-MAX, MAX), random.randint(-MAX, MAX))
Esempio n. 4
0
	def safe_get_pixel(line, size, index):
		if index < 0 or index >= size:
			return pixel(0, 0, 0)
		return line[index]
Esempio n. 5
0
 def set_pixel(self, x, y, red, green, blue):
     index = (y * self.width) + x
     self.pixel_map[index] = pixel(red, green, blue)
Esempio n. 6
0
 def __init__(self, width, height):
     self.width = width
     self.height = height
     self.pixel_map = [ pixel(0, 0, 0) for i in range( width * height ) ]
     self.animations = []
Esempio n. 7
0
 def shift_down(self):
     new_map = [pixel(0, 0, 0) for i in xrange(self.width)]
     new_map += self.pixel_map[:self.width*(self.height-1)]
     self.pixel_map = new_map