Ejemplo n.º 1
0
 def keep_drawing(self, x, y, dx, dy):
     graphics.set_color(1,1,1,1)
     self.draw_point(self.lastx,self.lasty)
     self.draw_point(x,y)
     graphics.set_line_width(graphics.brush_size)
     draw.line(x, y, self.lastx, self.lasty)
     graphics.set_color(0.5,0.5,0.5,1)
     graphics.set_line_width(0.8)
     radius = graphics.brush_size*0.8/2
     draw.ellipse_outline(x-radius,y-radius,x+radius,y+radius)
     self.lastx, self.lasty = x, y
Ejemplo n.º 2
0
 def draw_shape_ellipse(self):
     graphics.enable_line_stipple()
     graphics.set_line_width(1.0)
     #graphics.set_color(0,0,0,1)
     graphics.set_color(color=graphics.get_line_color())
     old_line_size = graphics.user_line_size
     def temp1():
         graphics.user_line_size = 1.0
     def temp2():
         graphics.user_line_size = old_line_size
     graphics.call_twice(temp1)
     draw.ellipse_outline(
         self.img_x+1, self.img_y+1, self.img_x+abs(self.w)-1, self.img_y+abs(self.h)-1
     )
     graphics.disable_line_stipple()
     graphics.call_twice(temp2)
Ejemplo n.º 3
0
    def keep_drawing(self, x, y, dx, dy):
        self.x2, self.y2 = x, y
        graphics.set_color(1, 1, 1, 1)
        draw.image(self.canvas_pre, graphics.canvas_x, graphics.canvas_y)

        if (
            graphics.fill_shapes
            and abs(self.x2 - self.x1) >= graphics.user_line_size
            and abs(self.y2 - self.y1) >= graphics.user_line_size
        ):
            graphics.set_color(color=self.fill_color)
            draw.ellipse(self.x1, self.y1, self.x2, self.y2)
        if graphics.outline_shapes:
            graphics.set_line_width(graphics.user_line_size)
            graphics.set_color(color=self.line_color)
            draw.ellipse_outline(self.x1, self.y1, self.x2, self.y2)
Ejemplo n.º 4
0
 def doodle(self, dt=0):
     if self.fire:
         bs_scaled = int(1.5 + (graphics.brush_size - 1) * 0.2)
         spread = 10 * bs_scaled
         graphics.set_color(*graphics.get_line_color())
         for i in xrange(0, spread*6, max(spread/10, 1)):
             xscale = min(1.0, 0.3+0.7*i/(spread))
             xscale = min(xscale, 0.2+0.8*(spread*6-i)/(spread*6))
             fx = self.x + random.randint(-spread, spread)*xscale
             fy = self.y + -spread + i
             size = (5.0-5.0*(i/float(spread*6))) * bs_scaled // 2
             draw.ellipse(fx-size, fy-size, fx+size, fy+size)
             #draw.points((fx, fy))
         graphics.set_color(*graphics.get_fill_color())
         for i in xrange(0, spread*2, max(spread/10, 1)):
             xscale = min(0.3 + 0.7*i/spread, 1)
             fx = self.x + random.randint(-spread, spread)*xscale
             fy = self.y + -spread + i
             size = (5.0-5.0*(i/float(spread*4))) * bs_scaled // 2
             draw.ellipse(fx-size, fy-size, fx+size, fy+size)
             #draw.points((fx, fy))
     else:
         graphics.set_line_width(graphics.brush_size/2)
         colors = []
         points = [self.make_point() for i in xrange(self.dots_per_frame)]
         if not self.hollow and not self.variable_size:
             draw.points(
                 sum(points,[]),
                 draw._concat([self.get_color() for i in xrange(self.dots_per_frame)])
             )
         else:
             for i in xrange(len(points)):
                 x, y = points[i]
                 if self.variable_size:
                     rad = max(
                         random.random()*graphics.brush_size/2.0 + graphics.brush_size/2.0, 4
                     )
                 else: rad = graphics.brush_size/2.0
                 graphics.set_color(*self.get_color())    
                 if random.random() < self.chance:
                     if self.hollow:
                         graphics.set_line_width(graphics.brush_size*0.2)
                         draw.ellipse_outline(x-rad,y-rad,x+rad,y+rad)
                     else: draw.ellipse(x-rad,y-rad,x+rad,y+rad)