#include #include #include #include #include /* This is a quick and dirty hack. It uses globals everywhere and only supports one window. But it was quick to write. */ Display *GblDisplay = NULL; Window GblWindow; Visual *GblVisual; Window GblRootWindow; XImage *GblImage; char *GblImageData; float *GblImageSrc = NULL; int GblImageSrcSize; GC GblGC; int GblNumColors = 128; int GblBaseColor; Colormap GblColorMap; unsigned long GblMasks[256]; unsigned long GblPixels[256]; XColor GblColors[256]; imageXregister( a,N) float *a; int N; { GblImageSrc = a; GblImageSrcSize=N; } imageXdraw( a, N) float *a; int N; { char* pPix; int i; int value; pPix=GblImageData; for (i=0; i 0 ) { XEvent event; XNextEvent( GblDisplay, &event); switch ( event.type ) { case Expose: /* purge other exposes */ while ( XCheckTypedEvent( GblDisplay, Expose, &event) ) ; if ( GblImageSrc ) imageXdraw( GblImageSrc, GblImageSrcSize); break; } } }