Slight strangeness in 8 bit CLUT support code

Marcel Weiher marcel at system.de
Thu Dec 3 19:49:02 UTC 1998


The code for generating the 8 bit color tables looks like this:

for (r = 0; r < 6; r++) {
  for (g = 0; g < 6; g++) {
	for (b = 0; b < 6; b++) {
	  i = 40 + ((36 * r) + (6 * b) + g);
                            ^^^^^^^^^^^^
		if (i > 255) error("index out of range in color  
table compuation");
		SetColorEntry(i, (r * 65535) / 5, (g * 65535) / 5,  
(b * 65535) / 5);
	 }
   }
}

Shouldn't that read '6*g+b' to give the usual layout of colors in  
the RGB cube?  The code building the Squeak-side CLUT also does it  
like this as well as the code for finding colors (Color  
closestPixelValue8), so the colors seem to map correctly, but it  
still seems strange.

Marcel





More information about the Squeak-dev mailing list