home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / x / x11p-13.zip / do_valgc.c < prev    next >
C/C++ Source or Header  |  1989-12-07  |  3KB  |  81 lines

  1. /*****************************************************************************
  2. Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
  3.  
  4.                         All Rights Reserved
  5.  
  6. Permission to use, copy, modify, and distribute this software and its 
  7. documentation for any purpose and without fee is hereby granted, 
  8. provided that the above copyright notice appear in all copies and that
  9. both that copyright notice and this permission notice appear in 
  10. supporting documentation, and that the name of Digital not be
  11. used in advertising or publicity pertaining to distribution of the
  12. software without specific, written prior permission.  
  13.  
  14. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20. SOFTWARE.
  21.  
  22. ******************************************************************************/
  23.  
  24. #ifndef VMS
  25. #include <X11/Xatom.h>
  26. #else
  27. #include <decw$include/Xatom.h>
  28. #endif
  29. #include "x11perf.h"
  30.  
  31. static Window win[2];
  32.  
  33. int InitGC(xp, p, reps)
  34.     XParms  xp;
  35.     Parms   p;
  36.     int     reps;
  37. {
  38.     win[0] = XCreateSimpleWindow(
  39.     xp->d, xp->w, 10, 10, 10, 10, 1, xp->foreground, xp->background);
  40.     win[1] = XCreateSimpleWindow(
  41.     xp->d, xp->w, 30, 30, 10, 10, 1, xp->foreground, xp->background);
  42.     XMapSubwindows(xp->d, xp->w);
  43.     return reps;
  44. }
  45.  
  46. void DoChangeGC(xp, p, reps)
  47.     XParms  xp;
  48.     Parms   p;
  49.     int     reps;
  50. {
  51.     int        i;
  52.     XGCValues   gcv;
  53.  
  54.     for (i = 0; i != reps; i++) {
  55.         gcv.foreground = xp->foreground;
  56.         XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
  57.         XDrawPoint(xp->d, win[0], xp->fggc, 5, 5);       
  58.  
  59.         gcv.foreground = xp->background;
  60.         XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
  61.         XDrawPoint(xp->d, win[1], xp->fggc, 5, 5);       
  62.  
  63.         gcv.foreground = xp->background;
  64.         XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
  65.         XDrawPoint(xp->d, win[0], xp->fggc, 5, 5);       
  66.  
  67.         gcv.foreground = xp->foreground;
  68.         XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
  69.         XDrawPoint(xp->d, win[1], xp->fggc, 5, 5);       
  70.     }
  71. }
  72.  
  73. void EndGC(xp, p)
  74.     XParms  xp;
  75.     Parms   p;
  76. {
  77.     XDestroyWindow(xp->d, win[0]);
  78.     XDestroyWindow(xp->d, win[1]);
  79. }
  80.  
  81.