~ubuntu-branches/ubuntu/dapper/xcolors/dapper

« back to all changes in this revision

Viewing changes to xcolors.c

  • Committer: Bazaar Package Importer
  • Author(s): Fredrik Hallenberg
  • Date: 2001-10-04 21:43:20 UTC
  • Revision ID: james.westby@ubuntu.com-20011004214320-floz3hyg00v44d1n
Tags: 1.5a-2
Added libxaw7 build dependency (closes: #113275)

Show diffs side-by-side

added added

removed removed

Lines of Context:
285
285
    
286
286
    prev_r = prev_g = prev_b = -1;
287
287
    save_colorname[0] = '\0';
288
 
    while (4 == fscanf(rgb, "%d %d %d %[^\n]\n", &r, &g, &b, colorname)) {
289
 
        if (startcolor)
290
 
          if (l_strcasecmp(colorname, startcolor))
291
 
            continue;           /* haven't reached starting point yet */
292
 
          else
293
 
            startcolor = (char *)NULL;
294
 
        if (r != prev_r  ||  g != prev_g  ||  b != prev_b) {
295
 
            if (nearcolor.flags) {
296
 
                double ourdist =
297
 
                    sqrt((double)((nearcolor.red-r)*(nearcolor.red-r)
 
288
    while (!feof(rgb)) {
 
289
        char str[1024];
 
290
        
 
291
        fgets(str, 1024L, rgb);
 
292
        if (*str != '!') /* comment */ {
 
293
          sscanf(str, "%d %d %d %[^\n]\n", &r, &g, &b, colorname);
 
294
          if (startcolor)
 
295
            if (l_strcasecmp(colorname, startcolor))
 
296
              continue;         /* haven't reached starting point yet */
 
297
            else
 
298
              startcolor = (char *)NULL;
 
299
          if (r != prev_r  ||  g != prev_g  ||  b != prev_b) {
 
300
              if (nearcolor.flags) {
 
301
                  double ourdist =
 
302
                      sqrt((double)((nearcolor.red-r)*(nearcolor.red-r)
298
303
                                  + (nearcolor.green-g)*(nearcolor.green-g)
299
304
                                  + (nearcolor.blue-b)*(nearcolor.blue-b)));
300
 
                if (ourdist > ddist)
301
 
                    continue;
302
 
            }
303
 
            if (save_colorname[0] != '\0') /* skip first time through */
304
 
              if (!do_color(parent, save_colorname))
305
 
                return;
306
 
            prev_r = r;
307
 
            prev_g = g;
308
 
            prev_b = b;
 
305
                  if (ourdist > ddist)
 
306
                      continue;
 
307
              }
 
308
              if (save_colorname[0] != '\0') /* skip first time through */
 
309
                if (!do_color(parent, save_colorname))
 
310
                  return;
 
311
              prev_r = r;
 
312
              prev_g = g;
 
313
              prev_b = b;
 
314
          }
 
315
          strcpy(save_colorname, colorname);
309
316
        }
310
 
        strcpy(save_colorname, colorname);
311
317
    }
312
318
    if (save_colorname[0] != '\0')
313
319
      (void)do_color(parent, save_colorname);