def on_draw(self, dt=0):
     self.try_redraw()
     if not graphics.drawing:
         #toolbar background
         #draw.rect(0,graphics.canvas_y,graphics.canvas_x,graphics.height)
         draw.gradient(
             0, graphics.canvas_y, graphics.canvas_x, graphics.height,
             self.toolbar_bg_1, self.toolbar_bg_2,
             self.toolbar_bg_2, self.toolbar_bg_1
         )
         #draw.rect(0,0,graphics.width,graphics.canvas_y)
         draw.gradient(
             0, 0, graphics.width, graphics.canvas_y,
             self.toolbar_bg_1, self.toolbar_bg_2,
             self.toolbar_bg_2, self.toolbar_bg_1
         )
         #buttons
         graphics.set_color(1,1,1,1)
         for button in self.toolbar: button.draw()   #toolbar buttons
         for button in self.buttons: button.draw()   #bottom buttons
         for label in self.labels: draw.label(label) #text labels
         self.colorpicker.draw()                     #color picker
         #self.colordisplay.draw()                    #line/fill color selector
         tool.controlspace.draw()
         #divider lines
         graphics.set_color(0,0,0,1)
         graphics.set_line_width(1.0)
         graphics.call_twice(pyglet.gl.glDisable,pyglet.gl.GL_BLEND)
         draw.line(0, graphics.canvas_y, graphics.width, graphics.canvas_y)
         draw.line(graphics.canvas_x, graphics.canvas_y, graphics.canvas_x, graphics.height)
         graphics.call_twice(pyglet.gl.glEnable,pyglet.gl.GL_BLEND)
     self.drawn_this_frame = False
示例#2
0
 def draw_stamp(self, x, y):
     pyglet.gl.glColor4f(1,1,1,1)
     pyglet.gl.glEnable(pyglet.gl.GL_BLEND)
     pyglet.gl.glBlendFunc(pyglet.gl.GL_SRC_ALPHA, pyglet.gl.GL_ONE_MINUS_SRC_ALPHA)
     if self.mode == MOVE:
         self.this_stamp.blit(x, y)
         draw.image(self.this_stamp, x, y)
     else:
         pyglet.gl.glPushMatrix()
         pyglet.gl.glTranslatef(self.start_x, self.start_y, 0)
         pyglet.gl.glPushMatrix()
         if self.mode == ROTATESCALE: pyglet.gl.glRotatef(self.rot, 0, 0, -1)
         pyglet.gl.glScalef(self.scale, self.scale, 1)
         self.this_stamp.blit(0, 0)
         pyglet.gl.glPopMatrix()
         pyglet.gl.glPopMatrix()
     graphics.call_twice(pyglet.gl.glDisable, pyglet.gl.GL_BLEND)
示例#3
0
 def draw(self):
     if not self.visible: return
     color = (1,1,1,1)
     if self.parent_group != None and self.selected: color = (0.8, 0.8, 0.8, 1)
     if self.pressed: color = (0.7, 0.7, 0.7, 1)
     graphics.set_color(color=color)
     draw.image(self.image,self.x,self.y)
     if self.image_2 != None:
         graphics.set_color(1,1,1,1)
         graphics.call_twice(pyglet.gl.glPushMatrix)
         if self.scale_factor != 1.0:
             pyglet.gl.glScalef(self.scale_factor, self.scale_factor, self.scale_factor)
         graphics.call_twice(
             pyglet.gl.glTranslatef, 
             self.x/self.scale_factor, self.y/self.scale_factor, 0
         )
         if self.centered:
             graphics.call_twice(
                 pyglet.gl.glTranslatef,
                 self.image.width/self.scale_factor/2, self.image.height/self.scale_factor/2, 0
             )
         draw.image(self.image_2, 0, 0)
         graphics.call_twice(pyglet.gl.glPopMatrix)
示例#4
0
 def stop_drawing(self, x, y):
     self.keep_drawing(x, y, 0, 0)
     graphics.call_twice(self.draw_stamp, x, y)
     self.canvas_pre = graphics.get_canvas()
     if self.mode == MOVE: graphics.show_cursor()