Lines Matching defs:rgb
27 * rgb.c: *
54 * Read a rgb text file. It stores the rgb values (0->65535)
55 * and the rgb mnemonics (malloc'ed) into the "rgbn" array. Returns the
66 xpmRgbName *rgb;
68 /* Open the rgb text file. Abort if error. */
74 rgb = rgbn;
75 /* Quit if rgb text file has too many entries. */
84 * Make sure rgb values are within 0->255 range. Skip silently if
101 /* Save the rgb values and ascii name in the array. */
102 rgb->r = red * 257; /* 65535/255 = 257 */
103 rgb->g = green * 257;
104 rgb->b = blue * 257;
105 rgb->name = rgbname;
106 rgb++;
112 /* Return the number of read rgb names. */
117 * Return the color name corresponding to the given rgb values
121 xpmRgbName rgbn[], /* rgb mnemonics from rgb text file */
122 int rgbn_max, /* number of rgb mnemonics in table */
123 int red, /* rgb values */
128 xpmRgbName *rgb;
131 * Just perform a dumb linear search over the rgb values of the color
132 * mnemonics. One could speed things up by sorting the rgb values and
135 for (i = 0, rgb = rgbn; i < rgbn_max; i++, rgb++)
136 if (red == rgb->r && green == rgb->g && blue == rgb->b)
137 return rgb->name;
152 xpmRgbName *rgb;
154 for (i = 0, rgb = rgbn; i < rgbn_max; i++, rgb++)
155 XpmFree(rgb->name);
161 #include "rgbtab.h" /* hard coded rgb.txt table */
176 * MSW rgb values are made from 3 BYTEs, this is different from X XColor.red,
181 xpmRgbName rgbn[], /* rgb mnemonics from rgb text file
184 int red, /* rgb values */
194 rgbVal = theRGBRecords[i].rgb;
252 rgbVal = theRGBRecords[middle].rgb;