| 10 | from imagepy.core.manager import ClipBoardManager, ColorManager |
| 11 | |
| 12 | class PasteMove(Tool): |
| 13 | def __init__(self): |
| 14 | self.moving = True |
| 15 | self.cx, self.cy = 0, 0 |
| 16 | |
| 17 | def mouse_down(self, ips, x, y, btn, **key): |
| 18 | goon = ips.roi.pick(x, y, 0) |
| 19 | print(goon) |
| 20 | if goon != True : |
| 21 | print('mouse_down') |
| 22 | else : |
| 23 | self.moving = True |
| 24 | self.ox, self.oy = x, y |
| 25 | |
| 26 | def mouse_up(self, ips, x, y, btn, **key): |
| 27 | if self.moving == True: |
| 28 | self.moving = False |
| 29 | ci = ClipBoardManager.img |
| 30 | img = ips.img |
| 31 | #ips.roi.draged(ci.shape[1]/2,ci.shape[0]/2, ips.size[1]/2, ips.size[0]/2, True) |
| 32 | #ips.roi = IPy.clipboard[1].affine(np.eye(2), ((np.array(ips.size)-ci.shape[:2])[::-1]/2)) |
| 33 | x,y = (np.array(ips.size)-ci.shape[:2])/2+(self.cy,self.cx) |
| 34 | bliter.blit(img, ci, y, x) |
| 35 | |
| 36 | ips.reset(True) |
| 37 | ips.update() |
| 38 | |
| 39 | def mouse_move(self, ips, x, y, btn, **key): |
| 40 | if self.moving==True and btn!=None: |
| 41 | ips.roi.draged(self.ox, self.oy, x, y, True) |
| 42 | self.cx += x-self.ox |
| 43 | self.cy += y-self.oy |
| 44 | self.ox, self.oy = x, y |
| 45 | ips.update() |
| 46 | |
| 47 | class Paste(Simple): |
| 48 | title = 'Paste' |