| 1 | 
greg | 
1.1 | 
/* Copyright 1990 Regents of the University of California */ | 
| 2 | 
  | 
  | 
 | 
| 3 | 
  | 
  | 
/* SCCSid "$SunId$ LBL" */ | 
| 4 | 
  | 
  | 
 | 
| 5 | 
  | 
  | 
/* | 
| 6 | 
  | 
  | 
 * x11raster.h - header file for X routines using images. | 
| 7 | 
  | 
  | 
 * | 
| 8 | 
  | 
  | 
 *      3/1/90 | 
| 9 | 
  | 
  | 
 */ | 
| 10 | 
  | 
  | 
 | 
| 11 | 
  | 
  | 
typedef struct { | 
| 12 | 
  | 
  | 
        Display *disp;                          /* the display */ | 
| 13 | 
  | 
  | 
        int     screen;                         /* the screen */ | 
| 14 | 
  | 
  | 
        Visual  *visual;                        /* pointer to visual used */ | 
| 15 | 
  | 
  | 
        XImage  *image;                         /* the X image */ | 
| 16 | 
  | 
  | 
        GC      gc;                             /* private graphics context */ | 
| 17 | 
  | 
  | 
        int     ncolors;                        /* number of colors */ | 
| 18 | 
  | 
  | 
        XColor  *cdefs;                         /* color definitions */ | 
| 19 | 
  | 
  | 
        short   *pmap;                          /* inverse pixel mapping */ | 
| 20 | 
  | 
  | 
        unsigned long   *pixels;                /* allocated table entries */ | 
| 21 | 
  | 
  | 
        Colormap        cmap;                   /* installed color map */ | 
| 22 | 
  | 
  | 
        Pixmap  pm;                             /* storage on server side */ | 
| 23 | 
  | 
  | 
}       XRASTER; | 
| 24 | 
  | 
  | 
 | 
| 25 | 
  | 
  | 
extern unsigned long    *map_rcolors(); | 
| 26 | 
  | 
  | 
 | 
| 27 | 
  | 
  | 
extern Pixmap   make_rpixmap(); | 
| 28 | 
  | 
  | 
 | 
| 29 | 
  | 
  | 
extern XRASTER  *make_raster(); | 
| 30 | 
  | 
  | 
 | 
| 31 | 
  | 
  | 
#define put_raster(d,xdst,ydst,xr) \ | 
| 32 | 
  | 
  | 
                patch_raster(d,0,0,xdst,ydst, \ | 
| 33 | 
  | 
  | 
                                (xr)->image->width,(xr)->image->height,xr) | 
| 34 | 
  | 
  | 
 | 
| 35 | 
  | 
  | 
#define patch_raster(d,xsrc,ysrc,xdst,ydst,width,height,xr) \ | 
| 36 | 
  | 
  | 
                (((xr)->pm == 0) \ | 
| 37 | 
  | 
  | 
                ? XPutImage((xr)->disp,d,(xr)->gc,(xr)->image,xsrc,ysrc, \ | 
| 38 | 
  | 
  | 
                                xdst,ydst,width,height) \ | 
| 39 | 
  | 
  | 
                : XCopyArea((xr)->disp,(xr)->pm,d,(xr)->gc,xsrc,ysrc, \ | 
| 40 | 
  | 
  | 
                                width,height,xdst,ydst)) |