def __paint_triangle (self, width, height, color): cogl.path_move_to(width / 2, 0) cogl.path_line_to(width, height) cogl.path_line_to(0, height) cogl.path_line_to(width / 2, 0) cogl.path_close() cogl.set_source_color(color) cogl.path_fill()
def __paint_triangle(self, width, height, color): cogl.path_move_to(width / 2, 0) cogl.path_line_to(width, height) cogl.path_line_to(0, height) cogl.path_line_to(width / 2, 0) cogl.path_close() cogl.set_source_color(color) cogl.path_fill()
def do_paint(self): (x1,y1,x2,y2) = self.get_allocation_box() width=x2-x1 height=y2-y1 cogl.path_move_to(width / 2,0) cogl.path_line_to(width, height) cogl.path_line_to(0,height) cogl.path_line_to(width / 2, 0) cogl.path_close() cogl.set_source_color(self._color) cogl.path_fill()
def do_paint(self): x = numpy.arange(-400, 400) y = 20 * numpy.sin(x * 0.1) # Plot trace, setting down lines wherever both x and y are finite # (neither NaN, nor infinity, nor minus infinity) pendown = False for x, y in zip(x, y): if numpy.isfinite(x) and numpy.isfinite(y): if pendown: cogl.path_line_to(x, -y) else: cogl.path_move_to(x, -y) pendown = True else: pendown = False cogl.set_source_color(self.color) cogl.path_stroke()
def do_paint(self): if type(self._path) == clutter.Path: cogl.path_new() for node in self._path: if node.type == clutter.PATH_MOVE_TO: cogl.path_move_to(*node[0]) elif node.type == clutter.PATH_LINE_TO: cogl.path_line_to(*node[0]) elif node.type == clutter.PATH_CURVE_TO: cogl.path_curve_to(node[0][0], node[0][1], node[1][0], node[1][1], node[2][0], node[2][1]) elif node.type == clutter.PATH_CLOSE: cogl.path_close() cogl.clip_push_from_path() clutter.Texture.do_paint(self) cogl.clip_pop() else: clutter.Texture.do_paint(self)