00001 /* 00002 * lib-spamod : Visualisation des objets en discret. 00003 * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC 00004 * http://www.sic.sp2mi.univ-poitiers.fr/ 00005 * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS, 00006 * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/ 00007 * 00008 * This file is part of lib-spamod 00009 * 00010 * This program is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU Lesser General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 /****************************************************************************** 00025 * Fichier : Color_Table.h * 00026 * Auteur : DEXET Martine * 00027 *----------------------------------------------------------------------------* 00028 * Ce fichier contient la spécification de la classe Color_Table. Cette * 00029 * classe permet de représenter un tableau de couleurs comportant quatre * 00030 * éléments. * 00031 * * 00032 *****************************************************************************/ 00033 00034 00035 #ifndef COLOR_TABLE_H 00036 #define COLOR_TABLE_H 00037 00038 #include "color.hh" 00039 00040 00041 00042 /****************************************************************************** 00043 * Classe Color_Table * 00044 *****************************************************************************/ 00045 00046 class Color_Table { 00047 00048 public: 00049 00050 // Constructeurs. 00051 Color_Table(); 00052 Color_Table(Color_Table const & other); 00053 Color_Table(Color const & c1, Color const & c2, 00054 Color const & c3, Color const & c4); 00055 00056 // Méthode permettant la lecture d'une des couleurs du tableau. 00057 Color * Get_Color(int num); 00058 00059 // Méthode permettant l'écriture d'une couleurs dans le tableau. 00060 void Set_Color(int num, Color const & i); 00061 00062 00063 private: 00064 00065 // Tableau comportant 4 cases, et contenant des objets de la classe Color. 00066 Color tab[4]; 00067 }; 00068 00069 /****************************************************************************** 00070 * Fichier : Color_Table.inl * 00071 * Auteur : DEXET Martine * 00072 *----------------------------------------------------------------------------* 00073 * Ce fichier contient l'implémentation des méthodes de la classe Color_Table* 00074 * * 00075 *****************************************************************************/ 00076 00077 00078 #include "vector3d.hh" 00079 00080 00081 00082 // Constructeurs. 00083 inline 00084 Color_Table::Color_Table() 00085 {} 00086 00087 inline 00088 Color_Table::Color_Table(Color_Table const & other) 00089 { 00090 for (int i=0 ; i<4 ; i++) 00091 tab[i] = other.tab[i]; 00092 } 00093 00094 inline 00095 Color_Table::Color_Table(Color const & c1, Color const & c2, 00096 Color const & c3, Color const & c4) 00097 { 00098 tab[0] = c1; 00099 tab[1] = c2; 00100 tab[2] = c3; 00101 tab[3] = c4; 00102 } 00103 00104 00105 // Méthode permettant la lecture d'une des couleurs du tableau. 00106 inline 00107 Color * Color_Table::Get_Color(int num) 00108 { 00109 assert(num >= 0 && num <= 3); 00110 return &tab[num]; 00111 } 00112 00113 00114 // Méthode permettant l'écriture d'une couleurs dans le tableau. 00115 inline 00116 void Color_Table::Set_Color(int num, Color const & i) 00117 { 00118 assert(num >= 0 && num <= 3); 00119 tab[num] = i; 00120 } 00121 00122 #endif