Subversion Repositories Applications.gtt

Rev

Rev 61 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
60 jpm 1
<?php
2
/*
3
 * This work is hereby released into the Public Domain.
4
 * To view a copy of the public domain dedication,
5
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
6
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
7
 *
8
 */
9
 
10
 
11
require_once dirname(__FILE__)."/../Graph.class.php";
12
 
13
 
14
/**
15
 * Create your gradients
16
 *
17
 * @package Artichow
18
 */
19
abstract class awGradient {
20
 
21
	/**
22
	 * From color
23
	 *
24
	 * @var Color
25
	 */
26
	public $from;
27
 
28
	/**
29
	 * To color
30
	 *
31
	 * @var Color
32
	 */
33
	public $to;
34
 
35
	/**
36
	 * Build the gradient
37
	 *
38
	 * @param awColor $from From color
39
	 * @param awColor $to To color
40
	 */
41
	public function __construct(awColor $from, awColor $to) {
42
 
43
		$this->from = $from;
44
		$this->to = $to;
45
 
46
	}
47
 
48
}
49
 
50
registerClass('Gradient', TRUE);
51
 
52
 
53
/**
54
 * Create a linear gradient
55
 *
56
 * @package Artichow
57
 */
58
class awLinearGradient extends awGradient {
59
 
60
	/**
61
	 * Gradient angle
62
	 *
63
	 * @var int
64
	 */
65
	public $angle;
66
 
67
	/**
68
	 * Build the linear gradient
69
	 *
70
	 * @param awColor $from From color
71
	 * @param awColor $to To color
72
	 * @param int $angle Gradient angle
73
	 */
74
	public function __construct($from, $to, $angle) {
75
 
76
		parent::__construct(
77
			$from, $to
78
		);
79
 
80
		$this->angle = (int)$angle;
81
 
82
	}
83
 
84
}
85
 
86
registerClass('LinearGradient');
87
 
88
 
89
/**
90
 * Create a bilinear gradient
91
 *
92
 * @package Artichow
93
 */
94
class awBilinearGradient extends awLinearGradient {
95
 
96
	/**
97
	 * Gradient center
98
	 *
99
	 * @var float Center between 0 and 1
100
	 */
101
	public $center;
102
 
103
	/**
104
	 * Build the bilinear gradient
105
	 *
106
	 * @param awColor $from From color
107
	 * @param awColor $to To color
108
	 * @param int $angle Gradient angle
109
	 * @param int $center Gradient center
110
	 */
111
	public function __construct($from, $to, $angle, $center = 0.5) {
112
 
113
		parent::__construct(
114
			$from, $to, $angle
115
		);
116
 
117
		$this->center = (float)$center;
118
 
119
	}
120
 
121
}
122
 
123
registerClass('BilinearGradient');
124
 
125
/**
126
 * Create a radial gradient
127
 *
128
 * @package Artichow
129
 */
130
class awRadialGradient extends awGradient {
131
 
132
}
133
 
134
registerClass('RadialGradient');
135
?>