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.SA < prev    next >
Text File  |  1994-11-11  |  2KB  |  65 lines

  1. -- -*-Sather-*-
  2. -- access to the X window system routines
  3. -- (c) 1994/11/10 - 1994/11/11 by Erik Schnetter
  4.    
  5.    
  6.    
  7. class X_IMAGE is
  8.    -- handle an image
  9.    
  10. -- constants
  11.    const XYBitmap, XYPixmap, ZPixmap;
  12.    
  13. -- internal structure
  14.    readonly attr c_image: EXT_OB;
  15.    
  16.    create: SAME is return new end;
  17.    
  18.    Void: BOOL is
  19.       return void(self) or void(c_image) end;
  20.    
  21. -- create an image
  22.    Create (display: X_DISPLAY, visual: X_VISUAL, depth: INT, format: INT,
  23.    offset: INT, width, height: INT, bitmap_pad: INT) pre Void post ~Void is
  24.       c_image := C_X_IMAGE::X_CreateImage (display.c_display, visual.c_visual,
  25.       depth, format, offset, width, height, bitmap_pad);
  26.    end; -- Create
  27.    
  28.    Create (display: X_DISPLAY, visual: X_VISUAL, depth: INT, format: INT,
  29.    offset: INT, size: X_OFFSET, bitmap_pad: INT) pre Void post ~Void is
  30.       Create (display, visual, depth, format, offset, size.width, size.height,
  31.       bitmap_pad);
  32.    end; -- Create
  33.    
  34. -- destroy an image
  35.    Destroy pre Void post ~Void is
  36.       C_X_IMAGE::X_DestroyImage (c_image);
  37.       c_image := void;
  38.    end; -- Destroy
  39.    
  40. -- put a pixel into an image
  41.    PutPixel (x, y: INT, pixel: INT) pre ~Void is
  42.       C_X_IMAGE::X_PutPixel (c_image, x, y, pixel);
  43.    end; -- Put
  44.    
  45. -- put an image into a drawable
  46.    Put (drawable: $X_DRAWABLE, gc: X_GC, src_x, src_y: INT,
  47.    dest_x, dest_y: INT, width, height: INT) pre ~Void is
  48.       C_X_IMAGE::X_PutImage (drawable.display.c_display, drawable.c_drawable,
  49.       gc.c_gc, c_image, src_x, src_y, dest_x, dest_y, width, height);
  50.    end; -- Put
  51. end; -- class X_IMAGE
  52.    
  53.    
  54.    
  55. external class C_X_IMAGE is
  56.    X_CreateImage (display: EXT_OB, visual: EXT_OB, depth: INT, format: INT,
  57.    offset: INT, width, height: INT, bitmap_pad: INT): EXT_OB;
  58.    X_DestroyImage (image: EXT_OB);
  59.    X_PutPixel (image: EXT_OB, x, y: INT, pixel: INT);
  60.    
  61.    X_PutImage (display: EXT_OB, drawable: INT, gc: EXT_OB, image: EXT_OB,
  62.    src_x, src_y: INT, dest_x, dest_y: INT, width, height: INT);
  63. end; -- class C_X_IMAGE
  64.    
  65.