示例#1
0
 def draw_initial(self):
     """Render the image"""
     graphics.set_color(1,1,1,1)
     draw.rect(self.x,self.y+self.height/2,self.x+self.width,self.y+self.height)
     graphics.set_color(0,0,0,1)
     draw.rect(self.x,self.y,self.x+self.width,self.y+self.height/2)
     for x in xrange(0,int(self.array_w)):
         for y in xrange(0,int(self.array_h)):
             #if y == 0 and x > int(self.array_w/2): break
             graphics.set_color(color=self.array[x][y])
             draw.rect(
                 self.x+x*self.step_x,
                 self.y+y*self.step_y,
                 self.x+(x+1)*self.step_x,
                 self.y+(y+1)*self.step_y
             )
     draw.rainbow(self.x+self.width*0.5,self.y,self.x+self.width*0.75,self.y+self.step_y)
     draw.rainbow(self.x+self.width*0.75,self.y,self.x+self.width,self.y+self.step_y)
     temp_image = pyglet.image.get_buffer_manager().get_color_buffer().get_image_data()
     self.image = temp_image.get_texture().get_region(
         self.x, self.y, int(self.width), int(self.height)
     )
示例#2
0
 def draw(self):
     if self.which_color == 0:
         if graphics.line_rainbow():
             draw.rainbow(self.x,self.y,self.x+self.width,self.y+self.height)
         else:
             graphics.set_color(color=graphics.line_color)
             draw.rect(self.x, self.y, self.x+self.width, self.y+self.height)
     else:
         if graphics.fill_rainbow():
             draw.rainbow(self.x,self.y,self.x+self.width,self.y+self.height)
         else:
             graphics.set_color(color=graphics.fill_color)
             draw.rect(self.x, self.y, self.x+self.width, self.y+self.height)
     
     if self.selected:
         graphics.set_color(1,1,1,1)
         graphics.set_line_width(1)
         draw.ellipse_outline(self.x+5, self.y+5, self.x+self.width-5, self.y+self.height-5)
         graphics.set_color(0,0,0,1)
         draw.ellipse_outline(self.x+7, self.y+7, self.x+self.width-7, self.y+self.height-7)
     graphics.set_line_width(1.0)    
     graphics.set_color(0,0,0,1)
     draw.rect_outline(self.x, self.y, self.x+self.width, self.y+self.height)