home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sa104os2.zip / SATHR104.ZIP / SATHER / CONTRIB / SCHNETTR / XLIB / IMAGE.C < prev    next >
C/C++ Source or Header  |  1994-11-28  |  1KB  |  40 lines

  1. /* -*-C-*-
  2.  * access to the X Window System for Sather
  3.  * (c) 1994/11/03 - 1994/11/28 by Erik Schnetter
  4.  */
  5.  
  6. #include <X11/X.h>
  7. #include <X11/Xlib.h>
  8. #include "../../System/header.h"
  9.  
  10.  
  11.  
  12. XImage* X_CreateImage (Display* display, Visual* visual, INT depth, INT format,
  13.                INT offset, INT width, INT height, INT bitmap_pad)
  14. {
  15.   int scanline = ((width+offset-1) /bitmap_pad +1) *bitmap_pad /8;
  16.   int bytes_per_line = scanline * height;
  17.   char* data = (char*) malloc (height * scanline * depth);
  18.   return XCreateImage (display, visual, depth, format, offset, data,
  19.                width, height, bitmap_pad, bytes_per_line);
  20. }
  21.  
  22. X_DestroyImage (XImage* image)
  23. {
  24.   XDestroyImage (image);
  25. }
  26.  
  27. X_PutPixel (XImage* image, INT x, INT y, INT pixel)
  28. {
  29.   XPutPixel (image, x, y, pixel);
  30. }
  31.  
  32. X_PutImage (Display* display, INT drawable, GC gc, XImage* image,
  33.         INT src_x, INT src_y, INT dest_x, INT dest_y,
  34.         INT width, INT height)
  35. /* GC is struct* */
  36. {
  37.   XPutImage (display, drawable, gc, image,
  38.          src_x, src_y, dest_x, dest_y, width, height);
  39. }
  40.