1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XGetColCells.c,v 10.4 86/02/01 15:34:32 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: #include "XlibInternal.h"
   7: Status XGetColorCells (contig, ncolors, nplanes, planes, pixels)
   8:         int contig;
   9:     int ncolors;
  10:     int nplanes;
  11:     int *planes;
  12:     register int pixels[];
  13: {
  14:     register Display *dpy;
  15:     register XReq *req;
  16:     XRep rep;
  17: 
  18:     GetReq (X_GetColorCells, 0);
  19:     req->func = contig;
  20:     req->param.s[0] = ncolors;
  21:     req->param.s[1] = nplanes;
  22:     if (!_XReply (dpy, &rep)) {
  23:         *planes = 0;
  24:         return (0);
  25:         }
  26:     *planes = rep.param.u[0];
  27:     if (!ncolors)
  28:         return (1);
  29: 
  30:     /* "pixels" is an array of ints, but the protocol
  31: 	 * returns an array of shorts.  Therefore data must be copied. */
  32:     {
  33:     register int i;
  34:     int nbytes = ncolors*2;
  35:     register u_short *proto_pixels = (u_short *) malloc (nbytes);
  36:     _XReadPad (dpy, proto_pixels, nbytes);
  37:     for (i=0;i<ncolors;i++)
  38:         pixels[i] = proto_pixels[i];
  39:     free (proto_pixels);
  40:     return (1);
  41:     }
  42: }
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 724
Valid CSS Valid XHTML 1.0 Strict