def redraw_canvas(self, updategrid=False):
# Gets the pixels covered by the current zoom level
zoomPixels = self.position_pixels()
# Redraw view
self.image_view.image = self.create_new_image()
with ui.ImageContext(self.width, self.height) as ctx:
for i in zoomPixels:
p = self.pixels[i]
ui.set_color(p.color)
pixel_path = ui.Path.rect(p.rect[0],p.rect[1],p.rect[2],p.rect[3])
pixel_path.fill()
pixel_path.line_width = 0.5
pixel_path.stroke()
self.image_view.image = ctx.get_image()
## Todo: insert drawing of preview window:
# Redraw grid
if updategrid == True:
self.grid_layout.image = self.draw_grid_image()
self.grid_layout.alpha = self.gridOpacity
if self.color_check.hidden is False:
self.character_colorcheck()
return True
# Flip colors
评论列表
文章目录