/[dtapublic]/projs/dtats/trunk/shared_source/c_tk_base_7_5_w_mods/ximage.c
ViewVC logotype

Diff of /projs/dtats/trunk/shared_source/c_tk_base_7_5_w_mods/ximage.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 69 by dashley, Sat Nov 5 10:54:17 2016 UTC revision 71 by dashley, Sat Nov 5 11:07:06 2016 UTC
# Line 1  Line 1 
1  /* $Header$ */  /* $Header$ */
2    
3  /*  /*
4   * ximage.c --   * ximage.c --
5   *   *
6   *      X bitmap and image routines.   *      X bitmap and image routines.
7   *   *
8   * Copyright (c) 1995 Sun Microsystems, Inc.   * Copyright (c) 1995 Sun Microsystems, Inc.
9   *   *
10   * See the file "license.terms" for information on usage and redistribution   * See the file "license.terms" for information on usage and redistribution
11   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12   *   *
13   * RCS: @(#) $Id: ximage.c,v 1.1.1.1 2001/06/13 05:15:44 dtashley Exp $   * RCS: @(#) $Id: ximage.c,v 1.1.1.1 2001/06/13 05:15:44 dtashley Exp $
14   */   */
15    
16  #include "tkInt.h"  #include "tkInt.h"
17    
18    
19  /*  /*
20   *----------------------------------------------------------------------   *----------------------------------------------------------------------
21   *   *
22   * XCreateBitmapFromData --   * XCreateBitmapFromData --
23   *   *
24   *      Construct a single plane pixmap from bitmap data.   *      Construct a single plane pixmap from bitmap data.
25   *   *
26   *      NOTE: This procedure has the correct behavior on Windows and   *      NOTE: This procedure has the correct behavior on Windows and
27   *      the Macintosh, but not on UNIX.  This is probably because the   *      the Macintosh, but not on UNIX.  This is probably because the
28   *      emulation for XPutImage on those platforms compensates for whatever   *      emulation for XPutImage on those platforms compensates for whatever
29   *      is wrong here :-)   *      is wrong here :-)
30   *   *
31   * Results:   * Results:
32   *      Returns a new Pixmap.   *      Returns a new Pixmap.
33   *   *
34   * Side effects:   * Side effects:
35   *      Allocates a new bitmap and drawable.   *      Allocates a new bitmap and drawable.
36   *   *
37   *----------------------------------------------------------------------   *----------------------------------------------------------------------
38   */   */
39    
40  Pixmap  Pixmap
41  XCreateBitmapFromData(display, d, data, width, height)  XCreateBitmapFromData(display, d, data, width, height)
42      Display* display;      Display* display;
43      Drawable d;      Drawable d;
44      _Xconst char* data;      _Xconst char* data;
45      unsigned int width;      unsigned int width;
46      unsigned int height;      unsigned int height;
47  {  {
48      XImage ximage;      XImage ximage;
49      GC gc;      GC gc;
50      Pixmap pix;      Pixmap pix;
51    
52      pix = Tk_GetPixmap(display, d, width, height, 1);      pix = Tk_GetPixmap(display, d, width, height, 1);
53      gc = XCreateGC(display, pix, 0, NULL);      gc = XCreateGC(display, pix, 0, NULL);
54      if (gc == NULL) {      if (gc == NULL) {
55          return None;          return None;
56      }      }
57      ximage.height = height;      ximage.height = height;
58      ximage.width = width;      ximage.width = width;
59      ximage.depth = 1;      ximage.depth = 1;
60      ximage.bits_per_pixel = 1;      ximage.bits_per_pixel = 1;
61      ximage.xoffset = 0;      ximage.xoffset = 0;
62      ximage.format = XYBitmap;      ximage.format = XYBitmap;
63      ximage.data = (char *)data;      ximage.data = (char *)data;
64      ximage.byte_order = LSBFirst;      ximage.byte_order = LSBFirst;
65      ximage.bitmap_unit = 8;      ximage.bitmap_unit = 8;
66      ximage.bitmap_bit_order = LSBFirst;      ximage.bitmap_bit_order = LSBFirst;
67      ximage.bitmap_pad = 8;      ximage.bitmap_pad = 8;
68      ximage.bytes_per_line = (width+7)/8;      ximage.bytes_per_line = (width+7)/8;
69    
70      TkPutImage(NULL, 0, display, pix, gc, &ximage, 0, 0, 0, 0, width, height);      TkPutImage(NULL, 0, display, pix, gc, &ximage, 0, 0, 0, 0, width, height);
71      XFreeGC(display, gc);      XFreeGC(display, gc);
72      return pix;      return pix;
73  }  }
74    
75  /* End of ximage.c */  /* End of ximage.c */

Legend:
Removed from v.69  
changed lines
  Added in v.71

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25