home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xlibpr3.zip / basicwin / color / fprgb.frag < prev    next >
Text File  |  1989-11-25  |  797b  |  23 lines

  1.    XStandardColormap \f(CWbest_map_info\fP;
  2.    float red, green, blue;
  3.    unsigned long pixelvalue;
  4.    int status;
  5.  
  6. .XX "XGetStandardColormap, example using"
  7.    status = XGetStandardColormap(display, RootWindow(display,
  8.       screen), &best_map_info, XA_RGB_BEST_MAP);
  9.  
  10.    if (!status)
  11.       {
  12.       printf("%s: specified standard colormap not available", argv[0]);
  13.       exit(-1);
  14.       }
  15.  
  16.    pixelvalue = \f(CWbest_map_info\fP.base_pixel +
  17.       ((unsigned long)(0.5 + (red * \f(CWbest_map_info\fP.red_max)) *
  18.            \f(CWbest_map_info\fP.red_mult) + 
  19.       ((unsigned long)(0.5 + (green * \f(CWbest_map_info\fP.green_max)) * 
  20.            \f(CWbest_map_info\fP.green_mult) +
  21.       ((unsigned long)(0.5 + (blue * \f(CWbest_map_info\fP.blue_max)) *
  22.            \f(CWbest_map_info\fP.blue_mult);
  23.