home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / glview.sit / glview.src / xlib.h < prev   
Encoding:
C/C++ Source or Header  |  1991-10-16  |  4.6 KB  |  242 lines

  1. /* 
  2.   xlib.h
  3.   mac hack at X window calls
  4.   oct91
  5. */
  6.  
  7. #include <Types.h>
  8.  
  9. typedef     char Bool;
  10.  
  11. #define    DoRed    1
  12. #define    DoBlue    2
  13. #define    DoGreen    4
  14.  
  15. #define XYBitmap     1
  16. #define XYPixmap    2
  17. #define    ZPixmap        3
  18.  
  19. #define    LSBFirst    0
  20. #define    MSBFirst    1
  21. #define    AllocNone    0
  22.  
  23. typedef     int* Colormap;
  24. typedef     char* Pixmap;
  25. typedef     int Display;
  26. typedef     Pixmap Drawable; // Pixmap is used as drawable in some places...
  27. typedef     Pixmap Window;
  28. typedef     int xCursor;
  29. typedef     int GC;
  30. typedef     int Visual;
  31. typedef     int VisualID;
  32.  
  33.  
  34. typedef struct {
  35.     int    x,y;
  36.     int    width,height;
  37.     } XRectangle;
  38.     
  39. typedef struct {
  40.     unsigned long    pixel;
  41.     unsigned short    red,green,blue;
  42.     char    flags;
  43.     char    pad;
  44.     } XColor;
  45.     
  46. typedef    struct    _XImage {
  47.     int width,height;    // size of image
  48.     int xoffset;        //num pixels offset in X direction
  49.     int format;        //XYBitmap,XYPixmap,ZPixmap
  50.     char *data;        // ptr to image
  51.     int byte_order;        //data byte order LSB/MSBFirst
  52.     int bitmap_unit;    //scanline 8/16/32
  53.     int bitmap_bit_order;    //LSB/MSBFirst
  54.     int bitmap_pad;        // 8/16/32 for Pixmaps
  55.     int depth;        //depth of image
  56.     int bytes_per_line;    //
  57.     int bits_per_pixel;    //ZPixmap
  58.     unsigned long red_mask;    //
  59.     unsigned long green_mask;
  60.     unsigned long blue_mask;
  61.     char *obdata;        //hook for object routines
  62.     struct funcs {        //image manip routines
  63.         struct _XImage *(*create_image)();
  64.         int (*destroy_image)();
  65.         unsigned long (*get_pixel)();
  66.         int (*put_pixel)();
  67.         struct _XImage *(*sub_image)();
  68.         int (*add_pixel)();
  69.         } f;
  70.     } XImage;
  71.     
  72.     
  73. typedef     struct {
  74.     Pixmap background_pixmap;
  75.     unsigned long background_pixel;
  76.     Pixmap border_pixmap;
  77.     unsigned long border_pixel;
  78.     int bit_gravity;
  79.     int win_gravity;
  80.     int backing_store;
  81.     unsigned long backing_planes;
  82.     unsigned long backing_pixel;
  83.     Bool save_under;
  84.     long event_mask;
  85.     long do_not_propogate_mask;
  86.     Bool override_redirect;
  87.     Colormap colormap;
  88.     xCursor cursor;
  89.     } XSetWindowAttributes;
  90.  
  91. typedef     struct {
  92.     Visual *visual;
  93.     VisualID visualid;
  94.     int screen;
  95.     unsigned int depth;
  96.     int class;
  97.     unsigned long red_mask;
  98.     unsigned long green_mask;
  99.     unsigned long blue_mask;
  100.     int colormap_size;
  101.     int bits_per_rgb;
  102.     } XVisualInfo;
  103.  
  104.     
  105. #define        XSync(dsp, flag)                
  106. #define        XSetClipMask(dsp, gc, a)            
  107. #define        XSetClipRectangles(dsp, gc, a,b,c,d,e) 
  108. #define        XDrawImageString(dsp, win, gc, a,b,c,d)     
  109. #define        XDrawString(dsp, win, gc, x,y, s, slen) 
  110. #define        XSetFillStyle(dsp, gc, a);
  111. #define     XFreeColormap(dsp, cmap)
  112. #define     XMapWindow(dsp, win) 
  113. #define     XCreateWindow(dsp, win, x, y, w, h, z, d, io, vis, bs, xswa) (Window)NULL
  114. #define     XMoveResizeWindow(dsp, win,  x,  y,  w,  h) 
  115. #define     XUnmapWindow(dsp, win) 
  116. #define     XDestroyWindow(dsp, win) 
  117. #define     XDrawLine(dsp, win, gc, x1, y1, x2, y2)
  118. #define     XDrawPoint(dsp, win, gc, x, y) 
  119.  
  120. XImage *XCreateImage(
  121.     Display *dsp, 
  122.     Visual *vis, 
  123.     unsigned int depth, 
  124.     int format, 
  125.     int offset, 
  126.     char *data, 
  127.     unsigned int width, 
  128.     unsigned int height, 
  129.     int bitmap_pad, 
  130.     int bytes_per_line);
  131.     
  132. void XPutImage(
  133.     Display *dsp, 
  134.     Drawable win, 
  135.     GC gc, 
  136.     XImage *image, 
  137.     int src_x, 
  138.     int src_y,
  139.     int dest_x, 
  140.     int dest_y, 
  141.     unsigned int width, 
  142.     unsigned int height);
  143.  
  144. void XCopyArea(
  145.     Display *dsp, 
  146.     Drawable src, 
  147.     Drawable dest, 
  148.     GC gc, 
  149.     int src_x, 
  150.     int src_y,
  151.     unsigned int width, 
  152.     unsigned int height,
  153.     int dest_x, 
  154.     int dest_y);
  155.  
  156. Pixmap XCreatePixmap(
  157.     Display *dsp,
  158.     Drawable win,
  159.     unsigned int width,
  160.     unsigned int height,
  161.     unsigned int depth);
  162.     
  163. void XFreePixmap(
  164.     Display *dsp,
  165.     Pixmap pix);
  166.  
  167. Display *XOpenDisplay( char* name);
  168.     
  169. XResizeWindow( dsp, win, width, height);
  170.  
  171. void XSetWindowColormap(
  172.     Display *dsp,
  173.     Drawable win,
  174.     Colormap cmap);
  175.     
  176. XAllocColorCells( dsp, cmap, contig, plane_masks_return,
  177.     nplanes, pixels_return, npixels);
  178. /***
  179. int XAllocColorCells( 
  180.     Display *dsp,
  181.     Colormap  cmap,
  182.     Bool  contig,
  183.     unsigned long plane_masks_return[],
  184.     unsigned int nplanes,
  185.     unsigned long pixels_return[],
  186.     unsigned int npixels);
  187. *****/
  188.  
  189. void XStoreColors(  
  190.     Display *dsp,
  191.     Colormap  cmap,
  192.     XColor color[],
  193.     int  ncolors);
  194.     
  195. Colormap XCreateColormap(     
  196.     Display *dsp,
  197.     Window win,
  198.     Visual *vis, 
  199.     int allocflag);
  200.  
  201. void XSetForeground(  
  202.     Display *dsp,
  203.     GC gc,
  204.     unsigned long foreground);
  205.     
  206. void XSetBackground( 
  207.     Display *dsp,
  208.     GC gc,
  209.     unsigned long background);
  210.     
  211. void XFillRectangle( 
  212.     Display *dsp,
  213.     Drawable win,
  214.     GC gc,
  215.     int x,
  216.     int y,
  217.     int width,
  218.     int height);
  219.     
  220. void XFillRectangles( 
  221.     Display *dsp,
  222.     Drawable win,
  223.     GC gc,
  224.     XRectangle *rects,
  225.     int nrects);
  226.     
  227. Bool optionKeyIsDown();
  228. Bool capsLockIsDown();
  229. Bool shiftKeyIsDown();
  230. Bool cmdKeyIsDown();
  231. Bool StopKey();
  232. Bool MouseButton();
  233. Bool Keypress();
  234. int  usleep( unsigned long usec);
  235. long hundredthsofseconds();
  236.  
  237. char *StdGetFile(
  238.     char*  prompt, 
  239.     OSType fileTypes[],
  240.     int    nFileTypes);
  241.  
  242.