Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 def drawRect_(self, rect: NSRect) -> None:
     context = NSGraphicsContext.currentContext.CGContext
     # Save the "clean" state of the graphics context.
     core_graphics.CGContextSaveGState(context)
     if self.interface.redraw:
         self.interface._draw(self._impl, draw_context=context)