OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
stage
include
ost
gfx
gradient.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// This file is part of the OpenStructure project <www.openstructure.org>
3
//
4
// Copyright (C) 2008-2011 by the OpenStructure authors
5
//
6
// This library is free software; you can redistribute it and/or modify it under
7
// the terms of the GNU Lesser General Public License as published by the Free
8
// Software Foundation; either version 3.0 of the License, or (at your option)
9
// any later version.
10
// This library is distributed in the hope that it will be useful, but WITHOUT
11
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with this library; if not, write to the Free Software Foundation, Inc.,
17
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
//------------------------------------------------------------------------------
19
#ifndef OST_GFX_GRADIENT_HH
20
#define OST_GFX_GRADIENT_HH
21
22
/*
23
Author: Marco Biasini
24
*/
25
26
#include <vector>
27
28
#include "
color.hh
"
29
30
#include <
ost/info/info.hh
>
31
#include <
ost/info/info_fw.hh
>
32
33
34
namespace
ost {
namespace
gfx {
35
43
class
DLLEXPORT_OST_GFX
Gradient
{
44
public
:
45
struct
Stop
{
46
Stop
(): t(0.0) {}
47
48
Stop
(
float
tt,
const
Color
& c): t(tt), color(c) {}
49
float
t
;
50
Color
color
;
51
52
Color
GetColor
(){
53
return
color;
54
}
55
56
float
GetRel
(){
57
return
t;
58
}
59
60
bool
operator==
(
const
Stop
& ref)
const
61
{
62
return
t==ref.
t
&& color==ref.
color
;
63
}
64
65
};
66
67
typedef
std::vector<Stop>
StopList
;
68
69
public
:
74
Gradient
();
75
77
Gradient
(
const
String
& name);
78
80
Color
GetColorAt(
float
t)
const
;
85
void
SetColorAt(
float
t,
const
Color
& color);
86
88
void
GradientToInfo(
info::InfoGroup
& group)
const
;
89
91
StopList
GetStops()
const
;
92
94
static
gfx::Gradient
GradientFromInfo(
const
info::InfoGroup
& group);
95
private
:
96
std::vector<Stop> stops_;
97
98
};
99
100
104
}}
105
106
#endif
Generated on Mon Nov 5 2012 13:30:57 for OpenStructure by
1.8.1.1