00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _OP_C_H_
00022 #define _OP_C_H_
00023
00024 #include "struct.h"
00025
00027
00028 typedef struct Composantes * Bitmap24B;
00029 typedef byte * Bitmap256;
00030
00031
00032
00034
00035 typedef struct
00036 {
00037 int nbb_r;
00038 int nbb_v;
00039 int nbb_b;
00040
00041 int rng_r;
00042 int rng_v;
00043 int rng_b;
00044
00045 int dec_r;
00046 int dec_v;
00047 int dec_b;
00048
00049 int red_r;
00050 int red_v;
00051 int red_b;
00052
00053 byte * table;
00054 } Table_conversion;
00055
00056
00057
00059
00060 typedef struct
00061 {
00062 int nbb_r;
00063 int nbb_v;
00064 int nbb_b;
00065
00066 int rng_r;
00067 int rng_v;
00068 int rng_b;
00069
00070 int dec_r;
00071 int dec_v;
00072 int dec_b;
00073
00074 int red_r;
00075 int red_v;
00076 int red_b;
00077
00078 int * table;
00079 } Table_occurence;
00080
00081
00082
00084
00085 typedef struct
00086 {
00087 int occurences;
00088
00089
00090 byte Rmin,Rmax;
00091 byte Vmin,Vmax;
00092 byte Bmin,Bmax;
00093
00094
00095 byte rmin,rmax;
00096 byte vmin,vmax;
00097 byte bmin,bmax;
00098
00099 byte plus_large;
00100 byte r,v,b;
00101 byte h;
00102 byte l;
00103 } Cluster;
00104
00105
00106
00108
00109 typedef struct
00110 {
00111 int nb;
00112 int nbmax;
00113 Cluster * clusters;
00114 } ClusterSet;
00115
00116
00117
00119
00120 typedef struct
00121 {
00122 int nbcouleurs;
00123 float min;
00124 float max;
00125 float hue;
00126 } Degrade;
00127
00128
00129
00131
00132 typedef struct
00133 {
00134 int nb;
00135 int nbmax;
00136 Degrade * degrades;
00137 } DegradeSet;
00138
00139
00140
00144
00145 Table_conversion * TC_New(int nbb_r,int nbb_v,int nbb_b);
00146 void TC_Delete(Table_conversion * t);
00147 byte TC_Get(Table_conversion * t,int r,int v,int b);
00148 void TC_Set(Table_conversion * t,int r,int v,int b,byte i);
00149
00150 void RGBtoHSL(int r, int v,int b, byte* h, byte*s, byte* l);
00151 void HSLtoRGB(byte h, byte s, byte l, byte* r, byte* g, byte* b);
00152
00153
00157
00158 void TO_Init(Table_occurence * t);
00159 Table_occurence * TO_New(int nbb_r,int nbb_v,int nbb_b);
00160 void TO_Delete(Table_occurence * t);
00161 int TO_Get(Table_occurence * t,int r,int v,int b);
00162 void TO_Set(Table_occurence * t,int r,int v,int b,int i);
00163 void TO_Inc(Table_occurence * t,int r,int v,int b);
00164 void TO_Compter_occurences(Table_occurence * t,Bitmap24B image,int taille);
00165
00166
00167
00171
00172 void Cluster_Analyser(Cluster * c,Table_occurence * to);
00173 void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int teinte,Table_occurence * to);
00174 void Cluster_Calculer_teinte(Cluster * c,Table_occurence * to);
00175
00176
00177
00181
00182 void CS_Init(ClusterSet * cs,Table_occurence * to);
00183 ClusterSet * CS_New(int nbmax,Table_occurence * to);
00184 void CS_Delete(ClusterSet * cs);
00185 void CS_Get(ClusterSet * cs,Cluster * c);
00186 void CS_Set(ClusterSet * cs,Cluster * c);
00187 void CS_Generer(ClusterSet * cs,Table_occurence * to);
00188 void CS_Calculer_teintes(ClusterSet * cs,Table_occurence * to);
00189 void CS_Generer_TC_et_Palette(ClusterSet * cs,Table_conversion * tc,struct Composantes * palette);
00190
00194
00195 void DS_Init(DegradeSet * ds,ClusterSet * cs);
00196 DegradeSet * DS_New(ClusterSet * cs);
00197 void DS_Delete(DegradeSet * ds);
00198 void DS_Generer(DegradeSet * ds,ClusterSet * cs);
00199
00200
00201
00202
00203
00204 int Convert_bitmap_24B_to_256(Bitmap256 Dest,Bitmap24B Source,int largeur,int hauteur,struct Composantes * palette);
00205
00206
00207
00208 #endif