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 TOOLCOLOR_H 45 #define TOOLCOLOR_H 46 47 #include <glib.h> 48 #include <glib-object.h> 49 50 #include "toolPool.h" 51 52 G_BEGIN_DECLS 53 54 /** 55 * TOOL_COLOR_MASK_R: 56 * 57 * This value can be used to create a mask for methods that 58 * require one for reading rgb color array. This value actually 59 * correspond to red. 60 */ 61 #define TOOL_COLOR_MASK_R (1 << 0) 62 /** 63 * TOOL_COLOR_MASK_G: 64 * 65 * This value can be used to create a mask for methods that 66 * require one for reading rgb color array. This value actually 67 * correspond to green. 68 */ 69 #define TOOL_COLOR_MASK_G (1 << 1) 70 /** 71 * TOOL_COLOR_MASK_B: 72 * 73 * This value can be used to create a mask for methods that 74 * require one for reading rgb color array. This value actually 75 * correspond to blue. 76 */ 77 #define TOOL_COLOR_MASK_B (1 << 2) 78 /** 79 * TOOL_COLOR_MASK_A: 80 * 81 * This value can be used to create a mask for methods that 82 * require one for reading rgb color array. This value actually 83 * correspond to the alpha channel. 84 */ 85 #define TOOL_COLOR_MASK_A (1 << 3) 86 /** 87 * TOOL_COLOR_MASK_RGBA: 88 * 89 * This value can be used to create a mask for methods that 90 * require one for reading rgb color array. This value is a 91 * shortcut for #TOOL_COLOR_MASK_R | #TOOL_COLOR_MASK_G | #TOOL_COLOR_MASK_B. 92 */ 93 #define TOOL_COLOR_MASK_RGBA (15) 94 95 /** 96 * ToolColorChannel: 97 * @TOOL_COLOR_RED: the red channel. 98 * @TOOL_COLOR_GREEN: the red channel. 99 * @TOOL_COLOR_BLUE: the red channel. 100 * @TOOL_COLOR_ALPHA: the red channel. 101 * 102 * Index to be used whenever accessing red, green or blue channels is 103 * required. 104 * 105 * Since: 3.8 106 */ 107 typedef enum 108 { 109 TOOL_COLOR_RED, 110 TOOL_COLOR_GREEN, 111 TOOL_COLOR_BLUE, 112 TOOL_COLOR_ALPHA 113 } ToolColorChannel; 114 115 /******************/ 116 /* Storing colors */ 117 /******************/ 118 /** 119 * ToolColor: 120 * @rgba: the coding of color in Red, Green, Blue, Alpha format, 121 * floating point numbers between 0 and 1 ; 122 * @repr: store the representation of the colour as "#rrggbbaa". 123 * @userData: unused. 124 * 125 * A structure to store colors. @repr is not set before 126 * tool_color_asStr() is called. Any changes in @rgba are not 127 * transfered to @repr and tool_color_asStr() should be called again. 128 */ 129 typedef struct _ToolColor ToolColor; 130 struct _ToolColor 131 { 132 float rgba[4]; 133 gchar repr[10]; 134 gpointer userData; 135 }; 136 137 #define TOOL_TYPE_COLOR (tool_color_get_type()) 138 GType tool_color_get_type(void); 139 ToolColor* tool_color_new(const float rgba[4]); 140 const ToolColor* tool_color_new_bright(guint id); 141 gboolean tool_color_equal(const ToolColor *color1, const ToolColor *color2); 142 void tool_color_copy(ToolColor *color, const ToolColor *color_old); 143 144 ToolPool* tool_color_getStorage(); 145 ToolColor* tool_color_getByValues(int *pos, float red, float green, float blue, float alpha); 146 ToolColor* tool_color_addFloatRGBA(const float rgba[4], int *position); 147 ToolColor* tool_color_addIntRGBA(int rgba[4]); 148 149 const ToolColor* tool_color_fromStr(const gchar *str, int *pos); 150 const gchar* tool_color_asStr(ToolColor *color); 151 152 const ToolColor* tool_color_fromName(const gchar *name, int *pos); 153 154 void tool_color_invertRGBA(float inv[4], const float rgba[4]); 155 void tool_color_convertHSVtoRGB(float* rgb, const float* hsv); 156 void tool_color_convertHSLtoRGB(float *rgb, const float *hsl); 157 void tool_color_convertRGBtoHSL(float *hsl, const float *rgb); 158 159 /** 160 * ToolMaterialIds: 161 * @TOOL_MATERIAL_AMB: the ambient identifier ; 162 * @TOOL_MATERIAL_DIF: the diffuse identifier ; 163 * @TOOL_MATERIAL_SHI: the shiningness identifier ; 164 * @TOOL_MATERIAL_SPE: the specular identifier ; 165 * @TOOL_MATERIAL_EMI: the emissivity identifier ; 166 * @TOOL_MATERIAL_N_VALUES: number of used material identifiers. 167 * 168 * This enum is used to address the OpenGL parameters for light rendering. 169 */ 170 typedef enum 171 { 172 TOOL_MATERIAL_AMB, 173 TOOL_MATERIAL_DIF, 174 TOOL_MATERIAL_SHI, 175 TOOL_MATERIAL_SPE, 176 TOOL_MATERIAL_EMI, 177 TOOL_MATERIAL_N_VALUES 178 } ToolMaterialIds; 179 180 /** 181 * ToolMaterial: 182 * 183 * A type used to exchange five floats defining material values between 184 * #GObject properties. 185 */ 186 #define TOOL_TYPE_MATERIAL (tool_material_get_type()) 187 GType tool_material_get_type(void); 188 189 G_END_DECLS 190 191 #endif 192