1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XStoreColors.c,v 10.4 86/02/01 15:40:12 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: #include "XlibInternal.h"
   7: XStoreColors (ncolors, defs)
   8:         int ncolors;
   9:     register Color *defs;
  10: {
  11:     register Display *dpy;
  12:     register XReq *req;
  13:     GetReq (X_StoreColors, 0);
  14:     req->param.s[0] = ncolors;
  15: 
  16:     /* Color structure in library uses int for pixel,
  17: 	   but protocol's ColorDef wants a short;
  18: 	   thus, data must be copied */
  19:         {
  20:     int nbytes = ncolors*sizeof(ColorDef);
  21:     register int i;
  22:     register ColorDef *proto_defs = (ColorDef *) malloc (nbytes);
  23:     for (i=0;i<ncolors;i++) {
  24:         proto_defs[i].pixel = defs[i].pixel;
  25:         proto_defs[i].red = defs[i].red;
  26:         proto_defs[i].green = defs[i].green;
  27:         proto_defs[i].blue = defs[i].blue;
  28:         }
  29:     Data (dpy, proto_defs, nbytes);
  30:     free (proto_defs);
  31:     }
  32: }

Defined functions

XStoreColors defined in line 7; used 18 times
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 820
Valid CSS Valid XHTML 1.0 Strict