/[gzz]/gzz/gfx/libcolor/spaces.cxx
ViewVC logotype

Diff of /gzz/gfx/libcolor/spaces.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by jvk, Fri Sep 20 15:52:33 2002 UTC revision 1.6 by jvk, Fri Sep 20 16:12:21 2002 UTC
# Line 335  namespace Color { Line 335  namespace Color {
335        }        }
336        glEnd();        glEnd();
337    
338        float edge[12][2][3] = {        const int N = 3;
339          {{ 0, 0, 0 }, { 0, 0, 1 }},        for (int axis = 0; axis < 3; axis++)
340          {{ 0, 1, 0 }, { 0, 1, 1 }},          for (float x = 0; x <= 1.0001; x += 1. / N)
341          {{ 1, 0, 0 }, { 1, 0, 1 }},            for (float y = 0; y <= 1.0001; y += 1. / N) {
342          {{ 1, 1, 0 }, { 1, 1, 1 }},              glBegin(GL_LINE_STRIP);
343                for (float t = 0; t <= 1; t += 1.0 / 16) {
344                  float rgb[3], v[3];
345                  switch (axis) {
346                  case 0: rgb[0] = x; rgb[1] = y; rgb[2] = t; break;
347                  case 1: rgb[0] = x; rgb[1] = t; rgb[2] = y; break;
348                  case 2: rgb[0] = t; rgb[1] = x; rgb[2] = y; break;
349                  }
350                  
351                  fromRGB(rgb, v);
352                  glColor3fv(rgb);
353                  glVertex3fv(v);
354                }
355                glEnd();
356              }
357    
358          {{ 0, 0, 0 }, { 0, 1, 0 }},        if (fromRGB == RGBtoLAB) {
359          {{ 0, 0, 1 }, { 0, 1, 1 }},          glColor3f(1,1,1);
360          {{ 1, 0, 0 }, { 1, 1, 0 }},          glBegin(GL_LINES);
361          {{ 1, 0, 1 }, { 1, 1, 1 }},          glVertex3f(0, 0, 0);
362            glVertex3f(100, 0, 0);
363          {{ 0, 0, 0 }, { 1, 0, 0 }},          glVertex3f(0, -100, 0);
364          {{ 0, 0, 1 }, { 1, 0, 1 }},          glVertex3f(0, +100, 0);
365          {{ 0, 1, 0 }, { 1, 1, 0 }},          glVertex3f(0, 0, -1000);
366          {{ 0, 1, 1 }, { 1, 1, 1 }}          glVertex3f(0, 0, +1000);
       };  
   
       for (int i = 0; i < 12; i++) {  
         float rgb[3], v[3];  
         glBegin(GL_LINE_STRIP);  
         for (float t = 0; t <= 1; t += 1.0 / 8) {  
           for (int c = 0; c < 3; c++)  
             rgb[c] = edge[i][0][c] * (1 - t) + edge[i][1][c] * t;  
           fromRGB(rgb, v);  
           glColor3fv(rgb);  
           glVertex3fv(v);  
         }  
367          glEnd();          glEnd();
368        }        }
369    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26