Beispiel #1
0
 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)
Beispiel #2
0
 def stroke(self, color, line_width, line_dash, 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)
     if line_dash is not None:
         core_graphics.CGContextSetLineDash(draw_context, 0, (CGFloat*len(line_dash))(*line_dash), len(line_dash))
     else:
         core_graphics.CGContextSetLineDash(draw_context, 0, None, 0)
     core_graphics.CGContextDrawPath(draw_context, mode)