def create_zoom_frame(self):
zoomWidth = self.width / self.zoomLevels[self.zoomCurrent]
zoomHeight = self.height / self.zoomLevels[self.zoomCurrent]
# create an movable image showing the zoom area
with ui.ImageContext(320,200) as ctx:
ui.set_color('black')
line_inside = ui.Path.rect(2,2,316,196)
line_inside.line_width = 4
line_inside.stroke()
ui.set_color('white')
line_outside = ui.Path.rect(0,0,320,200)
line_outside.line_width = 4
line_outside.stroke()
zoomSquare = ctx.get_image()
zoom_frame = ui.ImageView(hidden=True)
zoom_frame.bounds = (0,0,zoomWidth,zoomHeight)
zoom_frame.center = (self.width/2, self.height/2)
zoom_frame.image = zoomSquare
self.add_subview(zoom_frame)
return zoom_frame
评论列表
文章目录