def do_paint(self): # Draw a rectangle for the clipping cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc, self._step) cogl.path_close() # Start the clip cogl.clip_push_from_path() # set color to border color cogl.set_source_color(self._border_color) # draw the rectangle for the border which is the same size and the # object cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc, self._step) cogl.path_close() # color the path usign the border color ##cogl.path_fill() #cogl.path_stroke() if True: #False: # set the color of the filled area cogl.set_source_color(self._color) # draw the content with is the same size minus the wirth of the border # finish the clip cogl.path_round_rectangle(self._border_width, self._border_width, self._width - self._border_width, self._height - self._border_width, self._arc, self._step) cogl.path_fill() cogl.path_close() cogl.clip_pop()
def pick_self(self, color): if self.should_pick_paint() == False: return cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc, self._step) cogl.path_close() # Start the clip cogl.clip_push_from_path() # set color to border color cogl.set_source_color(color) # draw the rectangle for the border which is the same size and the # object cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc, self._step) cogl.path_close() cogl.path_fill() cogl.clip_pop()
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)
def do_pick(self, color): if self.should_pick_paint() == False: return #return cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc, self._step) cogl.path_close() # Start the clip cogl.clip_push_from_path() # set color to border color cogl.set_source_color(color) # draw the rectangle for the border which is the same size and the # object cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc, self._step) cogl.path_close() cogl.path_fill() cogl.clip_pop()