def draw_in_border(self, w, h): # in border. self.surface_cr.reset_clip() cairo_popover_rectangle(self, self.surface_cr, self.trayicon_x + self.trayicon_border + 1, self.trayicon_y + self.trayicon_border + 1, w, h + 1, self.radius) self.surface_cr.set_source_rgba(1, 1, 1, 1.0) # set in border color. self.surface_cr.set_line_width(self.border_width) self.surface_cr.fill()
def draw_background(self, cr, rect): x, y, w, h = rect cr.save() cairo_popover_rectangle(self, cr, self.trayicon_x + self.trayicon_border + 1, self.trayicon_y + self.trayicon_border + 1, w, h + 1, self.radius) cr.clip() if self.bg_pixbuf: cr.set_source_pixbuf(self.bg_pixbuf, self.bg_x, self.bg_y) cr.paint_with_alpha(self.bg_alpha) else: cr.set_source_rgb(1, 1, 1) cr.rectangle(x, y, w, h) cr.fill() cr.restore()
def __compute_shadow(self, w, h): # sahow. cairo_popover_rectangle(self, self.surface_cr, self.trayicon_x, self.trayicon_y, w, h, self.radius) self.surface_cr.set_source_rgba( # set sahow color. *alpha_color_hex_to_cairo((self.sahow_color))) self.surface_cr.fill_preserve() gaussian_blur(self.surface, SAHOW_VALUE) # border. if self.draw_rectangle_bool: # out border. self.surface_cr.clip() cairo_popover_rectangle(self, self.surface_cr, self.trayicon_x + self.trayicon_border, self.trayicon_y + self.trayicon_border, w, h + 1, self.radius) self.surface_cr.set_source_rgba( # set out border color. *alpha_color_hex_to_cairo(self.border_out_color)) self.surface_cr.set_line_width(self.border_width) self.surface_cr.fill() self.draw_in_border(w, h)