Example #1
0
 def draw_point(self,x,y,mult = 1):
     if graphics.brush_size*mult <= 1: return
     point_size = graphics.brush_size*mult*0.95
     if point_size < 10:
         graphics.set_line_width(point_size)
         draw.points((x,y))
     else:
         draw.ellipse(x-point_size/2.0,y-point_size/2.0,x+point_size/2.0,y+point_size/2.0)
Example #2
0
 def draw_fill(self):
     graphics.enter_canvas_mode()
     graphics.set_line_width(self.point_size)
     if not self.smooth_points: graphics.call_twice(pyglet.gl.glDisable, pyglet.gl.GL_POINT_SMOOTH)
     draw.points(self.pixels_old, self.pixel_colors_old)
     draw.points(self.pixels, self.pixel_colors)
     if not self.smooth_points: graphics.call_twice(pyglet.gl.glEnable, pyglet.gl.GL_POINT_SMOOTH)
     self.pixels_old, self.pixel_colors_old = self.pixels, self.pixel_colors
     self.pixels, self.pixel_colors = [], []
     graphics.exit_canvas_mode()
Example #3
0
 def start_drawing(self, x, y):
     self.lastx, self.lasty = x, y
     self.lastx1, self.lasty1 = x, y
     self.lastx2, self.lasty2 = x, y
     self.iteration = 0
     if self.calligraphy:
         self.x_mult = math.cos(math.pi/4)
         self.y_mult = math.sin(math.pi/4)
         self.last_brush_mult = 1.5
     elif self.variable:
         self.last_brush_mult = 0.0
     else:
         self.last_color_1 = graphics.get_line_color()
         graphics.set_color(color=self.last_color_1)
         graphics.set_line_width(graphics.brush_size)
         if graphics.brush_size > 1: draw.points((x,y))
Example #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)
Example #5
0
 def draw_point(self,x,y):
     graphics.set_line_width(graphics.brush_size*0.95)
     if graphics.brush_size > 1: draw.points((x,y))