def paint_self(self): #self._border_width = self.get_border_width() (self._width, self._height) = self.get_size() if (self._width < self._border_width) or \ (self._height < self._border_width): return self._arc = 10 self._step = 10 cogl.path_polygon(0.0, 0.0, self._width, 0.0, 0.0, self._height) cogl.path_close() cogl.path_fill() glBegin(GL_TRIANGLES) # Draw the highlight glColor(*self._highlight_color) glVertex2f(0.0, self._height) glVertex2f(0,0) glVertex2f(self._width,0.0) # Draw the lowlight glColor(*self._lowlight_color) glVertex2f(self._width, self._height) glVertex2f(0.0, self._height) glVertex2f(self._width,0.0) # draw the middle glColor(*self._color) glVertex2f(self._border_width, self._height - self._border_width) glVertex2f(self._border_width,self._border_width) glVertex2f(self._width - self._border_width,self._border_width) glVertex2f(self._width - self._border_width, self._height - self._border_width) glVertex2f(self._border_width, self._height - self._border_width) glVertex2f(self._width - self._border_width,self._border_width) glEnd()
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 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()
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()