Пример #1
0
 def draw(self):
     paletteShift = self.time
     self.generatePlasmaSurface()
     for y in self.y_range:
         for x in self.x_range:
             plasma_color = self.plasma.readPixel(x,y)
             color_shift = self.palette[paletteShift%256]
             r = (plasma_color[0]+color_shift[0])%256
             g = (plasma_color[1]+color_shift[1])%256
             b = (plasma_color[2]+color_shift[2])%256
             color = (r,g,b,)
             #darken the color to create a better contrast
             color = ColorRGBOps.brighten(color, 20)
             self.graphics.drawPixel(x,y, color)
Пример #2
0
 def process(self):
     if( (time.time()-self.previousTick) >= self.interval ):
         self.previousTick = time.time()
         self.time += 1
     paletteShift = self.time
     for y in self.y_range:
         for x in self.x_range:
             plasma_color = self.plasma.readPixel(x,y)
             color_shift = self.palette[paletteShift%256]
             r = (plasma_color[0]+color_shift[0])%256
             g = (plasma_color[1]+color_shift[1])%256
             b = (plasma_color[2]+color_shift[2])%256
             color = (r,g,b,)
             color = ColorRGBOps.darken(color, 50)
             self.graphics.drawPixel(x,y, color)