Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def draw_path(self, gc, path, transform, rgbFace=None):
- polygons = path.to_polygons(transform, self.widget.width,
- self.widget.height)
- list_canvas_instruction = self.get_path_instructions(gc, polygons,
- rgbFace=rgbFace)
- for widget, instructions in list_canvas_instruction:
- widget.canvas.add(instructions)
- def get_path_instructions(self, gc, polygons, rgbFace=None):
- instructions_list = []
- points_line = []
- for polygon in polygons:
- for x, y in polygon:
- x = x + self.widget.x
- y = y + self.widget.y
- points_line += [float(x), float(y), ]
- tess = Tesselator()
- tess.add_contour(points_line)
- if not tess.tesselate():
- Logger.warning("Tesselator didn't work :(")
- return
- newclip = self.handle_clip_rectangle(gc, x, y)
- if newclip > -1:
- instructions_list.append((self.clip_rectangles[newclip],
- self.get_graphics(gc, tess, points_line, rgbFace)))
- else:
- instructions_list.append((self.widget,
- self.get_graphics(gc, tess, points_line, rgbFace)))
- return instructions_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement