2
# -*- coding: utf-8 -*-
5
# a redefinition of senses
7
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
8
__licenses__ = ["LICENSE.LGPL"]
9
__description__ = "Button background texture"
14
from cluttercairo import CairoTexture
16
class Texture(CairoTexture):
17
""" Creates a CairoTexture based on a given SVG """
19
def __init__(self, width, height):
21
CairoTexture.__init__(self, width, height)
26
self.context = self.cairo_create()
28
linpat = cairo.LinearGradient(0, 0, self.width, self.height)
29
linpat.add_color_stop_rgba(0, 0, 0.3, 0.8, 1)
30
linpat.add_color_stop_rgba(1, 0, 0.8, 0.3, 1)
32
radpat = cairo.RadialGradient(self.width / 2.0, self.height, self.height * 0.25, self.width / 2.0, self.height, self.height * 0.75)
33
radpat.add_color_stop_rgba(0, 0, 0, 0, .1)
34
radpat.add_color_stop_rgba(0.5, 0, 0, 0, 0)
36
self.context.close_path()
37
self.context.set_source(linpat)
38
self.context.mask(radpat)
44
def resize(self, width, height):