示例#1
0
文件: canvas.py 项目: tuchang/toga
 def ellipse(
     self,
     x,
     y,
     radiusx,
     radiusy,
     rotation,
     startangle,
     endangle,
     anticlockwise,
     draw_context,
     *args,
     **kwargs
 ):
     core_graphics.CGContextSaveGState(draw_context)
     self.translate(x, y, draw_context)
     if radiusx >= radiusy:
         self.scale(1, radiusy / radiusx, draw_context)
         self.arc(0, 0, radiusx, startangle, endangle, anticlockwise, draw_context)
     elif radiusy > radiusx:
         self.scale(radiusx / radiusy, 1, draw_context)
         self.arc(0, 0, radiusy, startangle, endangle, anticlockwise, draw_context)
     self.rotate(rotation, draw_context)
     self.reset_transform(draw_context)
     core_graphics.CGContextRestoreGState(draw_context)
示例#2
0
文件: canvas.py 项目: obulat/toga
 def reset_transform(self, draw_context, *args, **kwargs):
     # Restore the "clean" state of the graphics context.
     core_graphics.CGContextRestoreGState(draw_context)
     # CoreGraphics has a stack-based state representation,
     # so ensure that there is a new, clean version of the "clean"
     # state on the stack.
     core_graphics.CGContextSaveGState(draw_context)