def finalize_selection(self): if self.selection != None: graphics.set_color(1,1,1,1) draw.image(self.canvas_pre,0,0) if not self.copy: self.draw_selection_mask( self.original_x, self.original_y, self.original_x+abs(self.w), self.original_y+abs(self.h) ) self.draw_selection_image() self.canvas_pre = graphics.get_snapshot() self.undo_image = graphics.get_canvas()
def select(self): self.canvas_pre = graphics.get_snapshot() self.undo_image = graphics.get_canvas() self.selection = None self.x1, self.y1, self.x2, self.y2 = 0.0, 0.0, 0.0, 0.0 self.img_x, self.img_y = 0.0, 0.0 self.w, self.h = 0.0, 0.0 self.original_x, self.original_y = 0.0, 0.0 self.mouse_offset_x, self.mouse_offset_y = 0.0, 0.0 self.dragging = False self.mouse_start_x, self.mouse_start_y = -1, -1 images = [ resources.Selection, resources.SelectEllipse, resources.SelectionCopy, resources.SelectEllipseCopy ] functions = [ self.select_rect, self.select_ellipse, self.select_rect_copy, self.select_ellipse_copy ] self.bg = tool.generate_button_row(images, functions)
def start_drawing(self, x, y): graphics.set_selected_color(graphics.get_pixel_from_image(graphics.get_snapshot(),x,y))