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
Authors: Marco Biasini, Ansgar Philippsen
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
namespace
ost {
namespace
gfx {
34
59
class
DLLEXPORT_OST_GFX
Gradient
{
60
public
:
61
struct
Stop
{
62
Stop
(): t(0.0) {}
63
64
Stop
(
float
tt,
const
Color
& c): t(tt), color(c) {}
65
float
t
;
66
Color
color
;
67
68
Color
GetColor
()
const
{
69
return
color;
70
}
71
72
float
GetRel
()
const
{
73
return
t;
74
}
75
76
bool
operator==
(
const
Stop
& ref)
const
77
{
78
return
t==ref.
t
&& color==ref.
color
;
79
}
80
81
};
82
83
typedef
std::vector<Stop>
StopList
;
84
85
public
:
90
Gradient
();
91
93
Gradient
(
const
String
& name);
94
96
Color
GetColorAt(
float
t)
const
;
101
void
SetColorAt(
float
t,
const
Color
& color);
102
104
// TODO: rename to ToInfo
105
// TODO:: add stand-alone function named GradientToInfo(Gradient, InfoGroup)
106
void
GradientToInfo(
info::InfoGroup
& group)
const
;
107
109
StopList
GetStops()
const
;
110
112
// TODO: move outside
113
// TODO: add FromInfo member function that overwrites this
114
static
gfx::Gradient
GradientFromInfo(
const
info::InfoGroup
& group);
115
117
void
SetHSVMode
(
bool
m) {hsv_mode_=m;}
119
bool
GetHSVMode
()
const
{
return
hsv_mode_;}
120
121
private
:
122
std::vector<Stop> stops_;
123
bool
hsv_mode_;
124
};
125
126
130
}}
131
132
#endif
Generated on Mon Nov 11 2013 09:56:11 for OpenStructure by
1.8.1.1