Advertisement
Guest User

draw_path.py

a guest
Aug 14th, 2015
200
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def draw_path(self, gc, path, transform, rgbFace=None):
  2.         transform = transform + Affine2D(). \
  3.             scale(1.0, -1.0).translate(0, self.height)
  4.         polygons = path.to_polygons(transform, self.width, self.height)
  5.         for polygon in polygons:
  6.             # draw_polygon won't take an arbitrary sequence -- it must be a list
  7.             # of tuples
  8.             polygon = [(int(round(x)), int(round(y))) for x, y in polygon]
  9.             if rgbFace is not None:
  10.                 saveColor = gc.gdkGC.foreground
  11.                 gc.gdkGC.foreground = gc.rgb_to_gdk_color(rgbFace)
  12.                 self.gdkDrawable.draw_polygon(gc.gdkGC, True, polygon)
  13.                 gc.gdkGC.foreground = saveColor
  14.             if gc.gdkGC.line_width > 0:
  15.                 self.gdkDrawable.draw_lines(gc.gdkGC, polygon)
Advertisement
RAW Paste Data Copied
Advertisement