head	1.9;
access;
symbols
	core-8-5-9:1.9
	core-8-5-8:1.9
	macosx-cocoa-merge:1.9
	macosx-cocoa-premerge:1.9
	macosx-carbon-freeze:1.9
	core-8-5-7:1.9
	core-8-5-6:1.9
	core-8-6-b1:1.9
	core-8-6-a3:1.9
	core-8-5-5:1.9
	core-8-6-a2:1.9
	core-8-5-4:1.9
	core-8-5-3:1.9
	core-8-6-a1:1.9
	core-8-4-19:1.4.8.3
	core-8-5-branch:1.9.0.2
	core-8-5-2:1.9
	core-8-4-18:1.4.8.3
	core-8-5-1:1.9
	core-8-4-17:1.4.8.3
	core-8-5-0:1.9
	core-8-5-b3:1.8
	core-8-5-b2:1.8
	core-8-4-16:1.4.8.3
	core-8-5-b1:1.8
	core-stablilizer-merge:1.8
	core-stabilizer-branch:1.6.0.2
	core-stabilizer-merge:1.9
	core-8-4-15:1.4.8.1
	core-8-5-a6:1.6
	core-8-5-a5:1.5
	core-8-4-14:1.4.8.1
	core-8-5-a4:1.5
	core-8-4-13:1.4.8.1
	core-8-4-12:1.4.8.1
	core-8-4-11:1.4.8.1
	core-8-5-a3:1.5
	core-8-4-10:1.4.8.1
	core-8-4-9-branch:1.4.8.1.0.2
	core-8-5-a2:1.5
	core-8-4-9:1.4.8.1
	core-8-4-8:1.4.8.1
	core-8-4-7:1.4.8.1
	core-8-5-a1:1.5
	core-8-4-6:1.4.8.1
	core-8-4-5:1.4
	mistachkin-dev-branch:1.4.0.10
	core-8-4-4:1.4
	core-8-4-3:1.4
	core-8-4-branch:1.4.0.8
	core-8-4-2:1.4
	core-8-4-1:1.4
	core-8-3-5:1.3.18.1
	core-8-4-0:1.4
	macosx-8-4-merge-2002-08-31-trunk:1.4
	macosx-8-4-premerge-2002-08-31-branch:1.4
	macosx-8-4-premerge-2002-08-31-trunk:1.4
	macosx-8-4-merge-2002-08-30-branch:1.4
	macosx-8-4-merge-2002-08-30-trunk:1.4
	macosx-8-4-merge-2002-08-20-branch:1.4
	macosx-8-4-merge-2002-08-20-trunk:1.4
	core-8-4-b2:1.4
	core-8-4-b1:1.4
	macosx-premerge-6-9-02:1.4
	core-8-4-a4:1.4
	core-8-3-4:1.3.18.1
	macosx-8-4-branch:1.4.0.6
	macosx-8-4-branchpoint:1.4
	core-8-4-a3:1.4
	core-8-3-3:1.3.18.1
	dgp-privates-into-namespace:1.4.0.4
	tclpro-1-5-0:1.3
	core-8-4-win-speedup:1.4.0.2
	core-8-4-a2:1.4
	tclpro-1-4-1:1.3
	tclpro-1-4-0:1.3
	core-8-3-2:1.3
	ajuba-ajuba2-2-1-base:1.3
	ajuba-ajuba2-2-0:1.3
	core-8-4-a1:1.3
	core-8-3-1-branch:1.3.0.18
	core-8-3-1:1.3
	scriptics-sc-2-0-b5:1.3
	scriptics-sc-2-0-fixed:1.3
	scriptics-sc-2-0-b2:1.3
	scriptics-sc-2-0-b1:1.3
	core-8-3-0:1.3
	core-8-3-b2:1.3
	core-8-3-b1:1.3
	scriptics-sc-1-1:1.3
	scriptics-sc-1-1-b1:1.3
	core-8-2-3:1.3
	scriptics-sc-1-1-branch:1.3.0.16
	scriptics-sc-1-1-base:1.3
	scriptics-sc-1-0:1.3
	scriptics-sc-1-0-branch:1.3.0.14
	scriptics-sc-1-0-base:1.3
	core-8-2-2:1.3
	core-8-2-1:1.3
	scriptics-bc-1-0-b1:1.3
	core-8-2-1-branch:1.3.0.12
	scriptics-tclpro-1-3-0:1.3
	core-8-2-0:1.3
	core-8-2-b3-branch:1.3.0.10
	core-8-2-b3-base:1.3
	scriptics-tclpro-1-3-b4:1.3
	core-8-2-b2:1.3
	scriptics-tclpro-1-3-b3:1.3
	core-8-2-b1:1.3
	scriptics-tclpro-1-3-b2:1.3
	merge-to-mainline-5/21/99:1.3
	scriptics-tclpro-1-3-b2-branch:1.3.0.8
	core-8-1-1:1.3
	scriptics-tclpro-1-3-b1:1.3
	core-8-1-1-base:1.3
	core-8-1-0:1.3
	merge-to-mainline-4-29-99:1.3
	merge-to-mainline-4-23-99:1.3
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.3.0.6
	core-8-0-6-base:1.3
	core-8-0-5:1.3
	core-8-1-b3:1.1.4.1
	core-8-1-b2:1.1.4.1
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.3.0.4
	scriptics-tclpro-1-2:1.3
	scriptics-tclpro-1-2-b2:1.3
	core-8-1-merge-2/10/99:1.3
	core-8-0-5-branch:1.3.0.2
	core-8-0-5-base:1.3
	scriptics-tclpro-1-2-b1:1.3
	scriptics-tclpro-1-2-a1:1.3
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.3
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.3;
locks; strict;
comment	@ * @;


1.9
date	2007.12.13.15.29.45;	author dgp;	state Exp;
branches;
next	1.8;

1.8
date	2007.06.29.03.18.08;	author das;	state Exp;
branches;
next	1.7;

1.7
date	2007.06.23.00.25.38;	author das;	state Exp;
branches;
next	1.6;

1.6
date	2007.01.02.23.39.40;	author dkf;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2004.02.23.10.48.11;	author das;	state Exp;
branches;
next	1.4;

1.4
date	2000.07.06.03.17.45;	author mo;	state Exp;
branches
	1.4.8.1;
next	1.3;

1.3
date	98.09.14.18.24.03;	author stanton;	state Exp;
branches
	1.3.18.1;
next	1.2;

1.2
date	98.08.04.15.30.20;	author welch;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.10.03.34;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.19.45;	author stanton;	state Exp;
branches;
next	;

1.3.18.1
date	2001.04.04.07.57.19;	author hobbs;	state Exp;
branches;
next	;

1.4.8.1
date	2004.02.23.10.49.29;	author das;	state Exp;
branches;
next	1.4.8.2;

1.4.8.2
date	2007.06.23.00.26.42;	author das;	state Exp;
branches;
next	1.4.8.3;

1.4.8.3
date	2007.06.29.03.20.58;	author das;	state Exp;
branches;
next	;

1.6.2.1
date	2007.06.25.19.12.14;	author dgp;	state Exp;
branches;
next	1.6.2.2;

1.6.2.2
date	2007.07.01.17.31.40;	author dgp;	state Exp;
branches;
next	;


desc
@@


1.9
log
@merge stable branch onto HEAD
@
text
@/*
 * ximage.c --
 *
 *	X bitmap and image routines.
 *
 * Copyright (c) 1995 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @@(#) $Id: ximage.c,v 1.6.2.2 2007/07/01 17:31:40 dgp Exp $
 */

#include "tkInt.h"

/*
 *----------------------------------------------------------------------
 *
 * XCreateBitmapFromData --
 *
 *	Construct a single plane pixmap from bitmap data.
 *
 *	NOTE: This procedure has the correct behavior on Windows and the
 *	Macintosh, but not on UNIX. This is probably because the emulation for
 *	XPutImage on those platforms compensates for whatever is wrong here
 *	:-)
 *
 * Results:
 *	Returns a new Pixmap.
 *
 * Side effects:
 *	Allocates a new bitmap and drawable.
 *
 *----------------------------------------------------------------------
 */

Pixmap
XCreateBitmapFromData(
    Display *display,
    Drawable d,
    _Xconst char *data,
    unsigned int width,
    unsigned int height)
{
    XImage *ximage;
    GC gc;
    Pixmap pix;

    pix = Tk_GetPixmap(display, d, (int) width, (int) height, 1);
    gc = XCreateGC(display, pix, 0, NULL);
    if (gc == NULL) {
	return None;
    }
    ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width,
	    height, 8, (width + 7) / 8);
    ximage->bitmap_bit_order = LSBFirst;
    _XInitImageFuncPtrs(ximage);
    TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height);
    ximage->data = NULL;
    XDestroyImage(ximage);
    XFreeGC(display, gc);
    return pix;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
@


1.8
log
@	* xlib/ximage.c:		bitmaps created from the static .xbm
					arrays always have LSBFirst bit order.
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.7 2007/06/23 00:25:38 das Exp $
@


1.7
log
@	* generic/tkImgPhoto.c (ImgPhotoConfigureInstance, DisposeInstance):
	use XDestroyImage instead of XFree to destroy XImage; replace runtime
	endianness determination by compile-time check for WORDS_BIGENDIAN.

	* xlib/ximage.c (XCreateBitmapFromData): use XCreateImage and
	XDestroyImage instead of creating XImage structure manually.
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.6 2007/01/02 23:39:40 dkf Exp $
d56 2
@


1.6
log
@Made the generic fake-X11 glue layer abide by the formatting rules of the core.
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.5 2004/02/23 10:48:11 das Exp $
d45 1
a45 1
    XImage ximage;
d54 5
a58 17
    ximage.height = height;
    ximage.width = width;
    ximage.depth = 1;
    ximage.bits_per_pixel = 1;
    ximage.xoffset = 0;
    ximage.format = XYBitmap;
    ximage.data = (char *)data;
    ximage.byte_order = LSBFirst;
    ximage.bitmap_unit = 8;
    ximage.bitmap_bit_order = LSBFirst;
    ximage.bitmap_pad = 8;
    ximage.bytes_per_line = (width+7)/8;
#ifdef MAC_OSX_TK
    ximage.obdata = NULL;
#endif

    TkPutImage(NULL, 0, display, pix, gc, &ximage, 0, 0, 0, 0, width, height);
@


1.6.2.1
log
@merge updates from HEAD
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.6 2007/01/02 23:39:40 dkf Exp $
d45 1
a45 1
    XImage *ximage;
d54 17
a70 5
    ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width,
	    height, 8, (width + 7) / 8);
    TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height);
    ximage->data = NULL;
    XDestroyImage(ximage);
@


1.6.2.2
log
@merge updates from HEAD
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id$
a55 2
    ximage->bitmap_bit_order = LSBFirst;
    _XInitImageFuncPtrs(ximage);
@


1.5
log
@	* macosx/tkMacOSXDraw.c:
	* macosx/tkMacOSXXStubs.c:
	* xlib/ximage.c: fixed MacOSX XGetImage/XPutImage and related
	functions to deal properly with XImages copied from screen.
	* generic/tkCanvPs.c (TkImageGetColor): MacOSX fix.
	[Bug 809157]
@
text
@d1 1
a1 1
/* 
d8 2
a9 2
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.4 2000/07/06 03:17:45 mo Exp $
a14 1

d23 4
a26 4
 *	NOTE: This procedure has the correct behavior on Windows and
 *	the Macintosh, but not on UNIX.  This is probably because the
 *	emulation for XPutImage on those platforms compensates for whatever
 *	is wrong here :-)
d38 6
a43 6
XCreateBitmapFromData(display, d, data, width, height)
    Display* display;
    Drawable d;
    _Xconst char* data;
    unsigned int width;
    unsigned int height;
d74 8
@


1.4
log
@	* generic/tkFileFilter.c (AddClause): Cast to match function prototype.
	* win/stubs.c (_XInitImageFuncPtrs): Add return value for function.
	* win/tkWinButton.c (buttonStyles, ButtonBindProc, ComputeStyle):
	Remove unused declarations.
	* win/tkWinColor.c (GetColorByName, GetColorByValue): Remove unused
	function declarations.
	* win/tkWinDialog.c (TrySetDirectory): Remove unused function declaration.
	* win/tkWinEmbed.c (TkWinEmbeddedEventProc): Cast to match function prototype.
	* win/tkWinMenu.c (winMenuMutex, MenuExitProc): Remove unused declaration.
	* win/tkWinWindow.c (StackWindow): Remove unused declaration.
	* win/tkWinWm.c (ConfigureEvent): Remove unused declaration.
	* win/tkWinX.c (winXMutex): Remove unused declaration.
	* xlib/ximage.c (XCreateBitmapFromData): Cast to match function prototype.
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.3 1998/09/14 18:24:03 stanton Exp $
d67 3
@


1.4.8.1
log
@	* macosx/tkMacOSXDraw.c:
	* macosx/tkMacOSXXStubs.c:
	* xlib/ximage.c: fixed MacOSX XGetImage/XPutImage and related
	functions to deal properly with XImages copied from screen.
	* generic/tkCanvPs.c (TkImageGetColor): MacOSX fix.
	* generic/tkImgPhoto.c (ImgPhotoDisplay): enabled alpha blending
	for images with partial transparency on MacOSX.
	[Bug 809157]
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.4 2000/07/06 03:17:45 mo Exp $
a66 3
#ifdef MAC_OSX_TK
    ximage.obdata = NULL;
#endif
@


1.4.8.2
log
@	* generic/tkImgPhoto.c (ImgPhotoConfigureInstance, DisposeInstance):
	use XDestroyImage instead of XFree to destroy XImage; replace runtime
	endianness determination by compile-time check for WORDS_BIGENDIAN.

	* xlib/ximage.c (XCreateBitmapFromData): use XCreateImage and
	XDestroyImage instead of creating XImage structure manually.
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.4.8.1 2004/02/23 10:49:29 das Exp $
d46 1
a46 1
    XImage *ximage;
d55 17
a71 5
    ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width,
	    height, 8, (width + 7) / 8);
    TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height);
    ximage->data = NULL;
    XDestroyImage(ximage);
@


1.4.8.3
log
@	* xlib/ximage.c:		bitmaps created from the static .bmp
					arrays always have LSBFirst bit order.
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.4.8.2 2007/06/23 00:26:42 das Exp $
a56 2
    ximage->bitmap_bit_order = LSBFirst;
    _XInitImageFuncPtrs(ximage);
@


1.3
log
@Replaced SCCS strings, fixed binary files
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id$
d50 1
a50 1
    pix = Tk_GetPixmap(display, d, width, height, 1);
@


1.3.18.1
log
@see ChangeLog for specific file details
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.4 2000/07/06 03:17:45 mo Exp $
d50 1
a50 1
    pix = Tk_GetPixmap(display, d, (int) width, (int) height, 1);
@


1.2
log
@Eliminated XReadBitmapFile emulation
@
text
@d11 1
a11 1
 * SCCS: @@(#) ximage.c 1.6 96/07/23 16:59:10
@


1.1
log
@Initial revision
@
text
@d24 5
a70 49
}

/*
 *----------------------------------------------------------------------
 *
 * XReadBitmapFile --
 *
 *	Loads a bitmap image in X bitmap format into the specified
 *	drawable.
 *
 * Results:
 *	Sets the size, hotspot, and bitmap on success.
 *
 * Side effects:
 *	Creates a new bitmap from the file data.
 *
 *----------------------------------------------------------------------
 */

int
XReadBitmapFile(display, d, filename, width_return, height_return,
	bitmap_return, x_hot_return, y_hot_return) 
    Display* display;
    Drawable d;
    _Xconst char* filename;
    unsigned int* width_return;
    unsigned int* height_return;
    Pixmap* bitmap_return;
    int* x_hot_return;
    int* y_hot_return;
{
    Tcl_Interp *dummy;
    char *data;

    dummy = Tcl_CreateInterp();

    data = TkGetBitmapData(dummy, NULL, (char *) filename,
	    (int *) width_return, (int *) height_return, x_hot_return,
	    y_hot_return);
    if (data == NULL) {
	return BitmapFileInvalid;
    }

    *bitmap_return = XCreateBitmapFromData(display, d, data, *width_return,
	    *height_return);

    Tcl_DeleteInterp(dummy);
    ckfree(data);
    return BitmapSuccess;
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d11 1
a11 1
 * RCS: @@(#) $Id: ximage.c,v 1.3 1998/09/14 18:24:03 stanton Exp $
a23 5
 *	NOTE: This procedure has the correct behavior on Windows and
 *	the Macintosh, but not on UNIX.  This is probably because the
 *	emulation for XPutImage on those platforms compensates for whatever
 *	is wrong here :-)
 *
d66 49
@

