~glitter-team/glitter/trunk

« back to all changes in this revision

Viewing changes to glitter/data/themes/nublo/resources/frame_background_texture_normal.py

  • Committer: Jan Jokela
  • Date: 2009-06-05 09:55:54 UTC
  • mfrom: (28.1.3 nublo_theme)
  • Revision ID: jan@jan-laptop-20090605095554-kdnkk1nuzc8st4h3
(Merge) From nublo theme

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# !/usr/bin/python
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
# nublo
 
5
# a redefinition of senses
 
6
        
 
7
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
 
8
__licenses__ = ["LICENSE.LGPL"]
 
9
__description__ = "Button background texture"
 
10
 
 
11
import math
 
12
import clutter
 
13
import cairo
 
14
from cluttercairo import CairoTexture
 
15
 
 
16
class Texture(CairoTexture):
 
17
    """ Creates a CairoTexture based on a given SVG """
 
18
 
 
19
    def __init__(self, width, height):
 
20
        
 
21
        CairoTexture.__init__(self, width, height)
 
22
        
 
23
        self.width = width
 
24
        self.height = height
 
25
        
 
26
        self.context = self.cairo_create()
 
27
        
 
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) 
 
31
        
 
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)
 
35
        
 
36
        self.context.close_path()
 
37
        self.context.set_source(linpat)
 
38
        self.context.mask(radpat)
 
39
        self.context.fill()
 
40
        
 
41
        self.context.stroke()
 
42
        del self.context
 
43
          
 
44
    def resize(self, width, height):
 
45
 
 
46
        pass
 
47