Пример #1
0
    def _blit_line(self, from_pos, to_pos):

        draw_vect = to_pos - from_pos

        if self.draw_angle is None:
            self.draw_angle = v2d(draw_vect)
            self.draw_angle.length = 20.0
        else:
            self.draw_angle += draw_vect
            self.draw_angle.length = 20.0

        len = draw_vect.length

        if len < self.rest:
            self.rest -= len
            return

        if self.rest > 0.0:
            draw_vect.length = self.rest
            cur_pos = from_pos + draw_vect
        else:
            cur_pos = v2d(from_pos)

        len -= self.rest
        self.rest = 0.0
        self._blit(cur_pos)

        draw_vect.length = self.space
        while len > self.space:
            cur_pos += draw_vect
            self._blit(cur_pos)
            len -= self.space

        self.rest = self.space - len
Пример #2
0
 def _blit_line(self,from_pos,to_pos):
             
     draw_vect = to_pos-from_pos
     
     if self.draw_angle is None:
         self.draw_angle = v2d(draw_vect)
         self.draw_angle.length = 20.0
     else:
         self.draw_angle+=draw_vect
         self.draw_angle.length = 20.0
        
     len = draw_vect.length      
     
     if len < self.rest:
         self.rest-=len
         return
     
     if self.rest>0.0:
         draw_vect.length = self.rest
         cur_pos = from_pos+draw_vect
     else:
         cur_pos = v2d(from_pos)
     
     len-=self.rest
     self.rest = 0.0
     self._blit(cur_pos)
     
     draw_vect.length = self.space
     while len > self.space:
         cur_pos += draw_vect
         self._blit(cur_pos)
         len-=self.space
         
     self.rest = self.space-len
Пример #3
0
 def paint_from(self,pos):
     """
     Starts to paint at the given position.
     Ex: paint_from((30,40))
     """
     if (not self.brush):
         return        
     self.rest = 0.0
     self.lastPos = v2d(pos)
     if (not self.followAngle):            
         self._blit_line(self.lastPos,v2d(pos))
     else:
         self.drawAngle = None 
Пример #4
0
 def paint_from(self, pos):
     """
     Starts to paint at the given position.
     Ex: paint_from((30,40))
     """
     if not self.brush:
         return
     self.rest = 0.0
     self.last_pos = v2d(pos)
     if not self.follow_angle:
         self._blit_line(self.last_pos, v2d(pos))
     else:
         self.draw_angle = None
     self.pattern_index = 0
     self.pattern_cnt = 0
     self.pattern_on = True
Пример #5
0
 def paint_from(self,pos):
     """
     Starts to paint at the given position.
     Ex: paint_from((30,40))
     """
     if not self.brush:
         return        
     self.rest = 0.0
     self.last_pos = v2d(pos)
     if not self.follow_angle:            
         self._blit_line(self.last_pos,v2d(pos))
     else:
         self.draw_angle = None
     self.pattern_index = 0
     self.pattern_cnt = 0
     self.pattern_on = True 
Пример #6
0
 def paint_to(self, pos):
     """
     Paint from the last position to the given one.
     Ex: paint_to((210,113))
     """
     if not self.brush:
         return
     if pos and self.last_pos:
         pos = v2d(pos)
         self._blit_line(self.last_pos, pos)
         self.last_pos = pos
Пример #7
0
 def paint_to(self,pos):
     """
     Paint from the last position to the given one.
     Ex: paint_to((210,113))
     """
     if not self.brush:
         return        
     if pos and self.last_pos:
         pos = v2d(pos)
         self._blit_line(self.last_pos,pos)
         self.last_pos = pos
Пример #8
0
 def _blit_line(self,fromPos,toPos):
     """
     Draws a line between two points as a 2d vector
     """
             
     drawVect = toPos-fromPos
     
     if (self.drawAngle is None):
         self.drawAngle = v2d(drawVect)
         self.drawAngle.length = 20.0
     else:
         self.drawAngle+=drawVect
         self.drawAngle.length = 20.0
        
     len = drawVect.length      
     
     if (len < self.rest):
         self.rest-=len
         return
     
     if (self.rest>0.0):
         drawVect.length = self.rest
         curPos = fromPos+drawVect
     else:
         curPos = v2d(fromPos)
     
     len-=self.rest
     self.rest = 0.0
     self._blit(curPos)
     
     drawVect.length = self.space
     while len > self.space:
         curPos += drawVect
         self._blit(curPos)
         len-=self.space
         
     self.rest = self.space-len