1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# !/usr/bin/python
# -*- coding: utf-8 -*-
# nublo
# a redefinition of senses
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
__licenses__ = ["LICENSE.LGPL"]
__description__ = "Frame background texture"
import math
import clutter
import cairo
from cluttercairo import CairoTexture
class Texture(CairoTexture):
""" Frame widget background CairoTexture """
def __init__(self, width, height):
CairoTexture.__init__(self, width, height)
self.width = width
self.height = height
self.context = self.cairo_create()
linpat = cairo.LinearGradient(0, 0, self.width, self.height)
linpat.add_color_stop_rgba(0, 0, 0.3, 0.8, 1)
linpat.add_color_stop_rgba(1, 0, 0.8, 0.3, 1)
radpat = cairo.RadialGradient(self.width / 2.0, self.height, self.height * 0.25, self.width / 2.0, self.height, self.height * 0.75)
radpat.add_color_stop_rgba(0, 0, 0, 0, 1)
radpat.add_color_stop_rgba(0.5, 0, 0, 0, 0)
self.context.close_path()
self.context.set_source(linpat)
self.context.mask(radpat)
self.context.fill()
self.context.stroke()
del self.context
def resize(self, width, height):
pass
|