1 /*   EXTRAITS DE LA LICENCE
2 	Copyright CEA, contributeurs : Luc BILLARD et Damien
3 	CALISTE, laboratoire L_Sim, (2001-2005)
4 
5 	Adresse mèl :
6 	BILLARD, non joignable par mèl ;
7 	CALISTE, damien P caliste AT cea P fr.
8 
9 	Ce logiciel est un programme informatique servant à visualiser des
10 	structures atomiques dans un rendu pseudo-3D.
11 
12 	Ce logiciel est régi par la licence CeCILL soumise au droit français et
13 	respectant les principes de diffusion des logiciels libres. Vous pouvez
14 	utiliser, modifier et/ou redistribuer ce programme sous les conditions
15 	de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
16 	sur le site "http://www.cecill.info".
17 
18 	Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
19 	pris connaissance de la licence CeCILL, et que vous en avez accepté les
20 	termes (cf. le fichier Documentation/licence.fr.txt fourni avec ce logiciel).
21 */
22 
23 /*   LICENCE SUM UP
24 	Copyright CEA, contributors : Luc BILLARD et Damien
25 	CALISTE, laboratoire L_Sim, (2001-2005)
26 
27 	E-mail address:
28 	BILLARD, not reachable any more ;
29 	CALISTE, damien P caliste AT cea P fr.
30 
31 	This software is a computer program whose purpose is to visualize atomic
32 	configurations in 3D.
33 
34 	This software is governed by the CeCILL  license under French law and
35 	abiding by the rules of distribution of free software.  You can  use,
36 	modify and/ or redistribute the software under the terms of the CeCILL
37 	license as circulated by CEA, CNRS and INRIA at the following URL
38 	"http://www.cecill.info".
39 
40 	The fact that you are presently reading this means that you have had
41 	knowledge of the CeCILL license and that you accept its terms. You can
42 	find a copy of this licence shipped with this software at Documentation/licence.en.txt.
43 */
44 #ifndef TOOLSHADE_H
45 #define TOOLSHADE_H
46 
47 #include <glib.h>
48 #include <glib-object.h>
49 #include "toolMatrix.h"
50 #include "toolPool.h"
51 
52 /**
53  * _ToolShade
54  *
55  * Opaque structure to store linear shade informations.
56  */
57 struct _ToolShade;
58 /**
59  * ToolShade:
60  *
61  * Short name to address _ToolShade objects.
62  */
63 typedef struct _ToolShade ToolShade;
64 
65 /**
66  * ToolShadeColorMode:
67  * @TOOL_SHADE_COLOR_MODE_RGB: variation described in the shade are applied to RGB coding colors ;
68  * @TOOL_SHADE_COLOR_MODE_HSV: variation described in the shade are applied to HSV coding colors ;
69  * @TOOL_SHADE_COLOR_MODE_N_VALUES: number of modes available.
70  *
71  * Defines color mode : Red-Green-Blue or Hue-Saturation-Value.
72  */
73 typedef enum
74   {
75     TOOL_SHADE_COLOR_MODE_RGB,
76     TOOL_SHADE_COLOR_MODE_HSV,
77     TOOL_SHADE_COLOR_MODE_N_VALUES
78   } ToolShadeColorMode;
79 
80 /**
81  * ToolShadeMode:
82  * @TOOL_SHADE_MODE_LINEAR: all channels are defined by a linear variation
83  * Ax+B ;
84  * @TOOL_SHADE_MODE_ARRAY: all channels are defined by a given array of
85  * values ;
86  * @TOOL_SHADE_MODE_N_VALUES: the number of different shade mode.
87  *
88  * Defines the storage of the shade mode.
89  */
90 typedef enum
91   {
92     TOOL_SHADE_MODE_LINEAR,
93     TOOL_SHADE_MODE_ARRAY,
94     TOOL_SHADE_MODE_N_VALUES
95   } ToolShadeMode;
96 
97 /**
98  * ToolShadeStep:
99  * @index: a value.
100  * @channels: (array fixed-size=3): three values in [0;1] for RGB or
101  * HSV channels.
102  *
103  * Stores a step in the definition of a shade.
104  *
105  * Since: 3.7
106  **/
107 typedef struct _ToolShadeStep ToolShadeStep;
108 
109 struct _ToolShadeStep
110 {
111   float index;
112   float channels[3];
113 };
114 
115 GType tool_shade_get_type(void);
116 #define TOOL_TYPE_SHADE (tool_shade_get_type())
117 
118 ToolPool* tool_shade_getStorage(void);
119 
120 const ToolShade* tool_shade_getById(guint id);
121 
122 ToolShade* tool_shade_new(const gchar* labelUTF8, float vectA[3], float vectB[3],
123                           ToolShadeColorMode colorMode);
124 ToolShade* tool_shade_newFromData(const gchar* labelUTF8, guint len, float *vectCh1,
125                                   float *vectCh2, float *vectCh3, ToolShadeColorMode colorMode);
126 ToolShade* tool_shade_newFromSteps(const gchar* labelUTF8, GList *lst,
127                                    ToolShadeColorMode colorMode);
128 ToolShade* tool_shade_newFromString(const gchar* labelUTF8, const gchar *descr,
129                                     ToolShadeColorMode colorMode, GError **error);
130 void tool_shade_free(ToolShade *shade);
131 ToolShade* tool_shade_copy(const ToolShade *shade);
132 gboolean tool_shade_compare(const ToolShade* sh1, const ToolShade *sh2);
133 gchar* tool_shade_getLabel(ToolShade *shade);
134 ToolShadeColorMode tool_shade_getColorMode(ToolShade *shade);
135 gboolean tool_shade_setColorMode(ToolShade *shade, ToolShadeColorMode mode);
136 ToolShadeMode tool_shade_getMode(const ToolShade *shade);
137 gboolean tool_shade_getLinearCoeff(const ToolShade *shade,
138                                    const float **vectA, const float **vectB);
139 gboolean tool_shade_setLinearCoeff(ToolShade *shade, float coeff, int channel, int order);
140 void tool_shade_valueToRGB(const ToolShade *shade, float rgba[4], float value);
141 void tool_shade_channelToRGB(const ToolShade *shade, float rgba[4], float values[3]);
142 
143 #endif
144