def stroke(self, color, line_width, draw_context, *args, **kwargs): core_graphics.CGContextSetLineWidth(draw_context, line_width) mode = CGPathDrawingMode(kCGPathStroke) if color is not None: core_graphics.CGContextSetRGBStrokeColor( draw_context, color.r / 255, color.g / 255, color.b / 255, color.a ) else: # Set color to black core_graphics.CGContextSetRGBStrokeColor(draw_context, 0, 0, 0, 1) core_graphics.CGContextDrawPath(draw_context, mode)
def fill(self, color, fill_rule, preserve, draw_context, *args, **kwargs): if fill_rule is "evenodd": mode = CGPathDrawingMode(kCGPathEOFill) else: mode = CGPathDrawingMode(kCGPathFill) if color is not None: core_graphics.CGContextSetRGBFillColor( draw_context, color.r / 255, color.g / 255, color.b / 255, color.a ) else: # Set color to black core_graphics.CGContextSetRGBFillColor(draw_context, 0, 0, 0, 1) core_graphics.CGContextDrawPath(draw_context, mode)