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

Contents of /projs/trunk/shared_source/c_tk_base_7_5_w_mods/ximage.c

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style native
svn:keywords Header

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25