home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / xjig / imgbuff.h < prev    next >
C/C++ Source or Header  |  1996-07-17  |  882b  |  43 lines

  1.  
  2. #ifndef _imgbuff_h
  3. #define _imgbuff_h
  4.  
  5. #ifdef USE_MIT_SHM
  6. #include <sys/ipc.h>
  7. #include <sys/shm.h>
  8. #include <X11/extensions/XShm.h>
  9. #endif
  10.  
  11. class ImageBuffer {
  12.     public:
  13.         ImageBuffer();
  14.         ~ImageBuffer();
  15.  
  16.         XImage *Init(int w, int h, int bpp8);
  17.         XImage *GetXImage()        { return ximage; }
  18.  
  19.         void PutImage(Display *dpy,Drawable d,GC gc,int src_x, int src_y, int dest_x, int dest_y, unsigned int w, unsigned int h) {
  20. #ifdef USE_MIT_SHM
  21.             if (shm) {
  22.                     XShmPutImage(dpy,d,gc,ximage,src_x,src_y,dest_x,dest_y,w,h,False);
  23.                     XSync(dpy,0);
  24.             }
  25.             else
  26. #endif
  27.                     XPutImage(dpy,d,gc,ximage,src_x,src_y,dest_x,dest_y,w,h); }
  28.  
  29.     private:
  30.         void AllocData(int w,int h,int bpp8);
  31.         void FreeData();
  32.  
  33.         XImage                *ximage;
  34.         int                    width, height;
  35.  
  36. #ifdef USE_MIT_SHM
  37.         int                    shm;                // flag, if shared memory is in use
  38.         XShmSegmentInfo    shminfo;            // shm information
  39. #endif
  40. };
  41.  
  42. #endif
  43.