The Winamp Remote Control suite
a remote control client and plugin for Winamp 2.x, 5.x
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
ColourU.cpp
Go to the documentation of this file.
1
/*
2
winamp remote control suite Copyright ©2000-2011 Patrick M. Martin
3
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18
Patrick M. Martin may be reached by email at patrickmmartin@gmail.com.
19
*/
20
21
22
#include <vcl.h>
23
#pragma hdrstop
24
#include <math.h>
// from M_PI
25
#include "
ColourU.h
"
26
27
const
int
BASE_RANGE
= 500;
28
const
double
offset
= 0.15;
29
30
double
periodic
(
double
percent)
31
{
32
return
(0.5 *( cos(2.0 * M_PI * percent) + 1) );
33
}
34
35
36
37
TColor
rainbowColour
(
int
value)
38
{
39
double
percent = (double) ( value %
BASE_RANGE
) /
BASE_RANGE
;
40
41
int
R = 255 * (
periodic
(percent +
offset
));
42
int
G = 255 * (
periodic
(percent +
offset
+ (-0.333)));
43
int
B = 255 * (
periodic
(percent +
offset
+ ( 0.333)));
44
45
return
(TColor) RGB(R, G, B);
46
}
47
ColourU.cpp
Generated by
1.8.1.1