#include "hisview_view.h" #include "hisview_misc.h" #include "hisview_widgets.h" #include #include void hsvimage(startf1, startf2, startf3, xmin, xmax, ymin, ymax, startb, scalex, scaley, clip1, clip2, clip3) /* Addresses de depart des donnees 2Dfloat a extraire */ float *startf1, *startf2, *startf3; int xmin, /* Borne inferieure sur la 1ere dimension */ xmax, /* Borne superieure sur la 1ere dimension */ ymin, /* Borne inferieure sur la 2eme dimension */ ymax; /* Borne superieure sur la 2eme dimension */ unsigned char *startb; /* Addresse de depart de la zone memoire */ /* contenant les valeurs de pixel */ int scalex, /* Facteur d'echelle selon la 1ere dimension */ scaley; /* Facteur d'echelle selon la 2eme dimension */ float clip1[2], clip2[2], clip3[2]; { int i, j, x, y, nh, ns, nv; float h, s, v, r, g, b; int width, height; float testh, testv, tests; float dist, newdist; unsigned char *p; if ((clip1[1] == clip1[0]) || (clip2[1] == clip2[0]) || (clip3[1] == clip3[0])) return; width = (xmax - xmin + 1)*scalex; height = (ymax - ymin + 1)*scaley; startb = startb + (height-1)*width; for (y = ymin ; y <= ymax ; y++) { p = startb; for (x = xmin ; x <= xmax ; x++) { testh = *startf1; tests = *startf2; testv = *startf3; h = ((testh - clip1[0])/(clip1[1] - clip1[0]))*270.; s = (tests - clip2[0])/(clip2[1] - clip2[0]); v = (testv - clip3[0])/(clip3[1] - clip3[0]); if (h < 0.) h = 0.; else { if (h > 270.) h =270.; } if (s < 0.) s = 0.; else { if (s > 1.) s = 1.; } if (v < 0.) v = 0.; else { if (v > 1.) v = 1.; } nh = 0; dist = (h - valhue[0])*(h - valhue[0]); for(i=1; i>8); gd = gi - (ctab[j].green>>8); bd = bi - (ctab[j].blue >>8); d = rd*rd + gd*gd + bd*bd; if (d1) ? "s" : "", unique); */ if (p2alloc) fprintf(stderr,"\nGot %d 'close' color%s.\n", p2alloc, (p2alloc>1) ? "s" : ""); if (nfcols == numcols) { return; } /* THIRD PASS COLOR ALLOCATION*/ for (i=0; i>8); gd = gi - (defs[k].green>>8); bd = bi - (defs[k].blue >>8); d = rd*rd + gd*gd + bd*bd; if (d