head	1.19;
access;
symbols
	core-8-5-9:1.11
	core-8-5-8:1.11
	macosx-cocoa-merge:1.14
	macosx-cocoa-premerge:1.14
	macosx-carbon-freeze:1.14
	core-8-5-7:1.11
	core-8-5-6:1.11
	core-8-6-b1:1.13
	core-8-6-a3:1.12
	core-8-5-5:1.11
	core-8-6-a2:1.12
	core-8-5-4:1.11
	core-8-5-3:1.11
	core-8-6-a1:1.12
	core-8-4-19:1.6.2.1
	core-8-5-branch:1.11.0.2
	core-8-5-2:1.11
	core-8-4-18:1.6.2.1
	core-8-5-1:1.11
	core-8-4-17:1.6.2.1
	core-8-5-0:1.11
	core-8-5-b3:1.10
	core-8-5-b2:1.10
	core-8-4-16:1.6.2.1
	core-8-5-b1:1.10
	core-stablilizer-merge:1.9
	core-stabilizer-branch:1.9.0.2
	core-stabilizer-merge:1.11
	core-8-4-15:1.6.2.1
	core-8-5-a6:1.9
	core-8-5-a5:1.9
	core-8-4-14:1.6.2.1
	core-8-5-a4:1.9
	core-8-4-13:1.6.2.1
	core-8-4-12:1.6.2.1
	core-8-4-11:1.6.2.1
	core-8-5-a3:1.8
	core-8-4-10:1.6.2.1
	core-8-4-9-branch:1.6.2.1.0.2
	core-8-5-a2:1.8
	core-8-4-9:1.6.2.1
	core-8-4-8:1.6.2.1
	core-8-4-7:1.6
	core-8-5-a1:1.7
	core-8-4-6:1.6
	core-8-4-5:1.6
	mistachkin-dev-branch:1.6.0.4
	core-8-4-4:1.6
	core-8-4-3:1.6
	core-8-4-branch:1.6.0.2
	core-8-4-2:1.6
	core-8-4-1:1.5
	core-8-3-5:1.4
	core-8-4-0:1.5
	macosx-8-4-merge-2002-08-31-trunk:1.5
	macosx-8-4-premerge-2002-08-31-branch:1.4.8.1
	macosx-8-4-premerge-2002-08-31-trunk:1.5
	macosx-8-4-merge-2002-08-30-branch:1.4.8.1
	macosx-8-4-merge-2002-08-30-trunk:1.5
	macosx-8-4-merge-2002-08-20-branch:1.4.8.1
	macosx-8-4-merge-2002-08-20-trunk:1.5
	core-8-4-b2:1.5
	core-8-4-b1:1.4
	macosx-premerge-6-9-02:1.4
	core-8-4-a4:1.4
	core-8-3-4:1.4
	macosx-8-4-branch:1.4.0.8
	macosx-8-4-branchpoint:1.4
	core-8-4-a3:1.4
	core-8-3-3:1.4
	dgp-privates-into-namespace:1.4.0.6
	tclpro-1-5-0:1.4
	core-8-4-win-speedup:1.4.0.4
	core-8-4-a2:1.4
	tclpro-1-4-1:1.4
	tclpro-1-4-0:1.4
	core-8-3-2:1.4
	ajuba-ajuba2-2-1-base:1.4
	ajuba-ajuba2-2-0:1.4
	core-8-4-a1:1.4
	core-8-3-1-branch:1.4.0.2
	core-8-3-1:1.4
	scriptics-sc-2-0-b5:1.4
	scriptics-sc-2-0-fixed:1.4
	scriptics-sc-2-0-b2:1.4
	scriptics-sc-2-0-b1:1.4
	core-8-3-0:1.4
	core-8-3-b2:1.4
	core-8-3-b1:1.4
	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.10
	scriptics-sc-1-1-base:1.3
	scriptics-sc-1-0:1.3
	scriptics-sc-1-0-branch:1.3.0.8
	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.6
	scriptics-tclpro-1-3-0:1.3
	core-8-2-0:1.3
	core-8-2-b3-branch:1.3.0.4
	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.2
	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.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.2
	core-8-1-b2:1.1.4.2
	dev-8-1-stubs-branch:1.1.4.2.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.2
	core-8-0-4:1.2
	core-8-1-a2:1.1.4.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@ * @;


1.19
date	2010.11.19.14.48.00;	author nijtmans;	state Exp;
branches;
next	1.18;

1.18
date	2010.06.15.11.16.03;	author nijtmans;	state Exp;
branches;
next	1.17;

1.17
date	2010.02.17.19.21.16;	author nijtmans;	state Exp;
branches;
next	1.16;

1.16
date	2010.01.18.20.43.38;	author nijtmans;	state Exp;
branches;
next	1.15;

1.15
date	2010.01.02.22.52.38;	author dkf;	state Exp;
branches;
next	1.14;

1.14
date	2009.02.03.23.55.47;	author nijtmans;	state Exp;
branches;
next	1.13;

1.13
date	2008.11.09.20.51.28;	author nijtmans;	state Exp;
branches;
next	1.12;

1.12
date	2008.04.27.22.38.55;	author dkf;	state Exp;
branches;
next	1.11;

1.11
date	2007.12.13.15.24.13;	author dgp;	state Exp;
branches;
next	1.10;

1.10
date	2007.09.07.00.34.51;	author dgp;	state Exp;
branches;
next	1.9;

1.9
date	2005.11.04.15.23.05;	author dkf;	state Exp;
branches
	1.9.2.1;
next	1.8;

1.8
date	2004.11.17.22.17.11;	author hobbs;	state Exp;
branches;
next	1.7;

1.7
date	2004.01.13.02.06.00;	author davygrvy;	state Exp;
branches;
next	1.6;

1.6
date	2003.02.09.07.48.22;	author hobbs;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2002.08.05.04.30.38;	author dgp;	state Exp;
branches;
next	1.4;

1.4
date	99.12.14.06.52.25;	author hobbs;	state Exp;
branches
	1.4.8.1;
next	1.3;

1.3
date	99.04.16.01.51.11;	author stanton;	state Exp;
branches;
next	1.2;

1.2
date	98.09.14.18.23.05;	author stanton;	state Exp;
branches;
next	1.1;

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

1.1.4.1
date	98.09.29.00.25.13;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	98.09.30.02.16.43;	author stanton;	state Exp;
branches;
next	;

1.4.8.1
date	2002.08.20.20.27.01;	author das;	state Exp;
branches;
next	;

1.6.2.1
date	2004.11.17.22.18.50;	author hobbs;	state Exp;
branches;
next	;

1.9.2.1
date	2007.09.07.01.25.34;	author dgp;	state Exp;
branches;
next	;


desc
@@


1.19
log
@Revise Tcl_Panic() calls ending with a newline removing the newline, because Tcl_Panic() outputs a final newline already
@
text
@/*
 * tkCanvImg.c --
 *
 *	This file implements image items for canvas widgets.
 *
 * Copyright (c) 1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 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: tkCanvImg.c,v 1.18 2010/06/15 11:16:03 nijtmans Exp $
 */

#include "tkInt.h"
#include "tkCanvas.h"

/*
 * The structure below defines the record for each image item.
 */

typedef struct ImageItem  {
    Tk_Item header;		/* Generic stuff that's the same for all
				 * types. MUST BE FIRST IN STRUCTURE. */
    Tk_Canvas canvas;		/* Canvas containing the image. */
    double x, y;		/* Coordinates of positioning point for
				 * image. */
    Tk_Anchor anchor;		/* Where to anchor image relative to (x,y). */
    char *imageString;		/* String describing -image option
				 * (malloc-ed). NULL means no image right
				 * now. */
    char *activeImageString;	/* String describing -activeimage option.
				 * NULL means no image right now. */
    char *disabledImageString;	/* String describing -disabledimage option.
				 * NULL means no image right now. */
    Tk_Image image;		/* Image to display in window, or NULL if no
				 * image at present. */
    Tk_Image activeImage;	/* Image to display in window, or NULL if no
				 * image at present. */
    Tk_Image disabledImage;	/* Image to display in window, or NULL if no
				 * image at present. */
} ImageItem;

/*
 * Information used for parsing configuration specs:
 */

static const Tk_CustomOption stateOption = {
    TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
static const Tk_CustomOption tagsOption = {
    Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
};

static const Tk_ConfigSpec configSpecs[] = {
    {TK_CONFIG_STRING, "-activeimage", NULL, NULL,
	NULL, Tk_Offset(ImageItem, activeImageString), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
	"center", Tk_Offset(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL},
    {TK_CONFIG_STRING, "-disabledimage", NULL, NULL,
	NULL, Tk_Offset(ImageItem, disabledImageString), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_STRING, "-image", NULL, NULL,
	NULL, Tk_Offset(ImageItem, imageString), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
	NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
    {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
	NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
    {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};

/*
 * Prototypes for functions defined in this file:
 */

static void		ImageChangedProc(ClientData clientData,
			    int x, int y, int width, int height, int imgWidth,
			    int imgHeight);
static int		ImageCoords(Tcl_Interp *interp,
			    Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
			    Tcl_Obj *const argv[]);
static int		ImageToArea(Tk_Canvas canvas,
			    Tk_Item *itemPtr, double *rectPtr);
static double		ImageToPoint(Tk_Canvas canvas,
			    Tk_Item *itemPtr, double *coordPtr);
static int		ImageToPostscript(Tcl_Interp *interp,
			    Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
static void		ComputeImageBbox(Tk_Canvas canvas, ImageItem *imgPtr);
static int		ConfigureImage(Tcl_Interp *interp,
			    Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
			    Tcl_Obj *const argv[], int flags);
static int		CreateImage(Tcl_Interp *interp,
			    Tk_Canvas canvas, struct Tk_Item *itemPtr,
			    int argc, Tcl_Obj *const argv[]);
static void		DeleteImage(Tk_Canvas canvas,
			    Tk_Item *itemPtr, Display *display);
static void		DisplayImage(Tk_Canvas canvas,
			    Tk_Item *itemPtr, Display *display, Drawable dst,
			    int x, int y, int width, int height);
static void		ScaleImage(Tk_Canvas canvas,
			    Tk_Item *itemPtr, double originX, double originY,
			    double scaleX, double scaleY);
static void		TranslateImage(Tk_Canvas canvas,
			    Tk_Item *itemPtr, double deltaX, double deltaY);

/*
 * The structures below defines the image item type in terms of functions that
 * can be invoked by generic item code.
 */

Tk_ItemType tkImageType = {
    "image",			/* name */
    sizeof(ImageItem),		/* itemSize */
    CreateImage,		/* createProc */
    configSpecs,		/* configSpecs */
    ConfigureImage,		/* configureProc */
    ImageCoords,		/* coordProc */
    DeleteImage,		/* deleteProc */
    DisplayImage,		/* displayProc */
    TK_CONFIG_OBJS,		/* flags */
    ImageToPoint,		/* pointProc */
    ImageToArea,		/* areaProc */
    ImageToPostscript,		/* postscriptProc */
    ScaleImage,			/* scaleProc */
    TranslateImage,		/* translateProc */
    NULL,			/* indexProc */
    NULL,			/* icursorProc */
    NULL,			/* selectionProc */
    NULL,			/* insertProc */
    NULL,			/* dTextProc */
    NULL,			/* nextPtr */
    NULL, 0, NULL, NULL
};

/*
 *--------------------------------------------------------------
 *
 * CreateImage --
 *
 *	This function is invoked to create a new image item in a canvas.
 *
 * Results:
 *	A standard Tcl return value. If an error occurred in creating the
 *	item, then an error message is left in the interp's result; in this
 *	case itemPtr is left uninitialized, so it can be safely freed by the
 *	caller.
 *
 * Side effects:
 *	A new image item is created.
 *
 *--------------------------------------------------------------
 */

static int
CreateImage(
    Tcl_Interp *interp,		/* Interpreter for error reporting. */
    Tk_Canvas canvas,		/* Canvas to hold new item. */
    Tk_Item *itemPtr,		/* Record to hold new item; header has been
				 * initialized by caller. */
    int objc,			/* Number of arguments in objv. */
    Tcl_Obj *const objv[])	/* Arguments describing rectangle. */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;
    int i;

    if (objc == 0) {
	Tcl_Panic("canvas did not pass any coords");
    }

    /*
     * Initialize item's record.
     */

    imgPtr->canvas = canvas;
    imgPtr->anchor = TK_ANCHOR_CENTER;
    imgPtr->imageString = NULL;
    imgPtr->activeImageString = NULL;
    imgPtr->disabledImageString = NULL;
    imgPtr->image = NULL;
    imgPtr->activeImage = NULL;
    imgPtr->disabledImage = NULL;

    /*
     * Process the arguments to fill in the item record. Only 1 (list) or 2 (x
     * y) coords are allowed.
     */

    if (objc == 1) {
	i = 1;
    } else {
	const char *arg = Tcl_GetString(objv[1]);
	i = 2;
	if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
	    i = 1;
	}
    }
    if ((ImageCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) {
	goto error;
    }
    if (ConfigureImage(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) {
	return TCL_OK;
    }

  error:
    DeleteImage(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
    return TCL_ERROR;
}

/*
 *--------------------------------------------------------------
 *
 * ImageCoords --
 *
 *	This function is invoked to process the "coords" widget command on
 *	image items. See the user documentation for details on what it does.
 *
 * Results:
 *	Returns TCL_OK or TCL_ERROR, and sets the interp's result.
 *
 * Side effects:
 *	The coordinates for the given item may be changed.
 *
 *--------------------------------------------------------------
 */

static int
ImageCoords(
    Tcl_Interp *interp,		/* Used for error reporting. */
    Tk_Canvas canvas,		/* Canvas containing item. */
    Tk_Item *itemPtr,		/* Item whose coordinates are to be read or
				 * modified. */
    int objc,			/* Number of coordinates supplied in objv. */
    Tcl_Obj *const objv[])	/* Array of coordinates: x1, y1, x2, y2, ... */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;

    if (objc == 0) {
	Tcl_Obj *obj = Tcl_NewObj();

	Tcl_Obj *subobj = Tcl_NewDoubleObj(imgPtr->x);
	Tcl_ListObjAppendElement(interp, obj, subobj);
	subobj = Tcl_NewDoubleObj(imgPtr->y);
	Tcl_ListObjAppendElement(interp, obj, subobj);
	Tcl_SetObjResult(interp, obj);
    } else if (objc < 3) {
	if (objc==1) {
	    if (Tcl_ListObjGetElements(interp, objv[0], &objc,
		    (Tcl_Obj ***) &objv) != TCL_OK) {
		return TCL_ERROR;
	    } else if (objc != 2) {
		char buf[64];

		sprintf(buf, "wrong # coordinates: expected 2, got %d", objc);
		Tcl_SetResult(interp, buf, TCL_VOLATILE);
		return TCL_ERROR;
	    }
	}
	if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &imgPtr->x) != TCL_OK)
		|| (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1],
  		    &imgPtr->y) != TCL_OK)) {
	    return TCL_ERROR;
	}
	ComputeImageBbox(canvas, imgPtr);
    } else {
	char buf[64];

	sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc);
	Tcl_SetResult(interp, buf, TCL_VOLATILE);
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*
 *--------------------------------------------------------------
 *
 * ConfigureImage --
 *
 *	This function is invoked to configure various aspects of an image
 *	item, such as its anchor position.
 *
 * Results:
 *	A standard Tcl result code. If an error occurs, then an error message
 *	is left in the interp's result.
 *
 * Side effects:
 *	Configuration information may be set for itemPtr.
 *
 *--------------------------------------------------------------
 */

static int
ConfigureImage(
    Tcl_Interp *interp,		/* Used for error reporting. */
    Tk_Canvas canvas,		/* Canvas containing itemPtr. */
    Tk_Item *itemPtr,		/* Image item to reconfigure. */
    int objc,			/* Number of elements in objv.  */
    Tcl_Obj *const objv[],	/* Arguments describing things to configure. */
    int flags)			/* Flags to pass to Tk_ConfigureWidget. */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;
    Tk_Window tkwin;
    Tk_Image image;

    tkwin = Tk_CanvasTkwin(canvas);
    if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
	    (const char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) {
	return TCL_ERROR;
    }

    /*
     * Create the image. Save the old image around and don't free it until
     * after the new one is allocated. This keeps the reference count from
     * going to zero so the image doesn't have to be recreated if it hasn't
     * changed.
     */

    if (imgPtr->activeImageString != NULL) {
	itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT;
    } else {
	itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT;
    }
    if (imgPtr->imageString != NULL) {
	image = Tk_GetImage(interp, tkwin, imgPtr->imageString,
		ImageChangedProc, imgPtr);
	if (image == NULL) {
	    return TCL_ERROR;
	}
    } else {
	image = NULL;
    }
    if (imgPtr->image != NULL) {
	Tk_FreeImage(imgPtr->image);
    }
    imgPtr->image = image;
    if (imgPtr->activeImageString != NULL) {
	image = Tk_GetImage(interp, tkwin, imgPtr->activeImageString,
		ImageChangedProc, imgPtr);
	if (image == NULL) {
	    return TCL_ERROR;
	}
    } else {
	image = NULL;
    }
    if (imgPtr->activeImage != NULL) {
	Tk_FreeImage(imgPtr->activeImage);
    }
    imgPtr->activeImage = image;
    if (imgPtr->disabledImageString != NULL) {
	image = Tk_GetImage(interp, tkwin, imgPtr->disabledImageString,
		ImageChangedProc, imgPtr);
	if (image == NULL) {
	    return TCL_ERROR;
	}
    } else {
	image = NULL;
    }
    if (imgPtr->disabledImage != NULL) {
	Tk_FreeImage(imgPtr->disabledImage);
    }
    imgPtr->disabledImage = image;
    ComputeImageBbox(canvas, imgPtr);
    return TCL_OK;
}

/*
 *--------------------------------------------------------------
 *
 * DeleteImage --
 *
 *	This function is called to clean up the data structure associated with
 *	a image item.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Resources associated with itemPtr are released.
 *
 *--------------------------------------------------------------
 */

static void
DeleteImage(
    Tk_Canvas canvas,		/* Info about overall canvas widget. */
    Tk_Item *itemPtr,		/* Item that is being deleted. */
    Display *display)		/* Display containing window for canvas. */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;

    if (imgPtr->imageString != NULL) {
	ckfree(imgPtr->imageString);
    }
    if (imgPtr->activeImageString != NULL) {
	ckfree(imgPtr->activeImageString);
    }
    if (imgPtr->disabledImageString != NULL) {
	ckfree(imgPtr->disabledImageString);
    }
    if (imgPtr->image != NULL) {
	Tk_FreeImage(imgPtr->image);
    }
    if (imgPtr->activeImage != NULL) {
	Tk_FreeImage(imgPtr->activeImage);
    }
    if (imgPtr->disabledImage != NULL) {
	Tk_FreeImage(imgPtr->disabledImage);
    }
}

/*
 *--------------------------------------------------------------
 *
 * ComputeImageBbox --
 *
 *	This function is invoked to compute the bounding box of all the pixels
 *	that may be drawn as part of a image item. This function is where the
 *	child image's placement is computed.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The fields x1, y1, x2, and y2 are updated in the header for itemPtr.
 *
 *--------------------------------------------------------------
 */

	/* ARGSUSED */
static void
ComputeImageBbox(
    Tk_Canvas canvas,		/* Canvas that contains item. */
    ImageItem *imgPtr)		/* Item whose bbox is to be recomputed. */
{
    int width, height;
    int x, y;
    Tk_Image image;
    Tk_State state = imgPtr->header.state;

    if(state == TK_STATE_NULL) {
	state = Canvas(canvas)->canvas_state;
    }
    image = imgPtr->image;
    if (Canvas(canvas)->currentItemPtr == (Tk_Item *)imgPtr) {
	if (imgPtr->activeImage != NULL) {
	    image = imgPtr->activeImage;
	}
    } else if (state == TK_STATE_DISABLED) {
	if (imgPtr->disabledImage != NULL) {
	    image = imgPtr->disabledImage;
	}
    }

    x = (int) (imgPtr->x + ((imgPtr->x >= 0) ? 0.5 : - 0.5));
    y = (int) (imgPtr->y + ((imgPtr->y >= 0) ? 0.5 : - 0.5));

    if ((state == TK_STATE_HIDDEN) || (image == None)) {
	imgPtr->header.x1 = imgPtr->header.x2 = x;
	imgPtr->header.y1 = imgPtr->header.y2 = y;
	return;
    }

    /*
     * Compute location and size of image, using anchor information.
     */

    Tk_SizeOfImage(image, &width, &height);
    switch (imgPtr->anchor) {
    case TK_ANCHOR_N:
	x -= width/2;
	break;
    case TK_ANCHOR_NE:
	x -= width;
	break;
    case TK_ANCHOR_E:
	x -= width;
	y -= height/2;
	break;
    case TK_ANCHOR_SE:
	x -= width;
	y -= height;
	break;
    case TK_ANCHOR_S:
	x -= width/2;
	y -= height;
	break;
    case TK_ANCHOR_SW:
	y -= height;
	break;
    case TK_ANCHOR_W:
	y -= height/2;
	break;
    case TK_ANCHOR_NW:
	break;
    case TK_ANCHOR_CENTER:
	x -= width/2;
	y -= height/2;
	break;
    }

    /*
     * Store the information in the item header.
     */

    imgPtr->header.x1 = x;
    imgPtr->header.y1 = y;
    imgPtr->header.x2 = x + width;
    imgPtr->header.y2 = y + height;
}

/*
 *--------------------------------------------------------------
 *
 * DisplayImage --
 *
 *	This function is invoked to draw a image item in a given drawable.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	ItemPtr is drawn in drawable using the transformation information in
 *	canvas.
 *
 *--------------------------------------------------------------
 */

static void
DisplayImage(
    Tk_Canvas canvas,		/* Canvas that contains item. */
    Tk_Item *itemPtr,		/* Item to be displayed. */
    Display *display,		/* Display on which to draw item. */
    Drawable drawable,		/* Pixmap or window in which to draw item. */
    int x, int y, int width, int height)
				/* Describes region of canvas that must be
				 * redisplayed (not used). */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;
    short drawableX, drawableY;
    Tk_Image image;
    Tk_State state = itemPtr->state;

    if (state == TK_STATE_NULL) {
	state = Canvas(canvas)->canvas_state;
    }

    image = imgPtr->image;
    if (Canvas(canvas)->currentItemPtr == itemPtr) {
	if (imgPtr->activeImage != NULL) {
	    image = imgPtr->activeImage;
	}
    } else if (state == TK_STATE_DISABLED) {
	if (imgPtr->disabledImage != NULL) {
	    image = imgPtr->disabledImage;
	}
    }

    if (image == NULL) {
	return;
    }

    /*
     * Translate the coordinates to those of the image, then redisplay it.
     */

    Tk_CanvasDrawableCoords(canvas, (double) x, (double) y,
	    &drawableX, &drawableY);
    Tk_RedrawImage(image, x - imgPtr->header.x1, y - imgPtr->header.y1,
	    width, height, drawable, drawableX, drawableY);
}

/*
 *--------------------------------------------------------------
 *
 * ImageToPoint --
 *
 *	Computes the distance from a given point to a given rectangle, in
 *	canvas units.
 *
 * Results:
 *	The return value is 0 if the point whose x and y coordinates are
 *	coordPtr[0] and coordPtr[1] is inside the image. If the point isn't
 *	inside the image then the return value is the distance from the point
 *	to the image.
 *
 * Side effects:
 *	None.
 *
 *--------------------------------------------------------------
 */

static double
ImageToPoint(
    Tk_Canvas canvas,		/* Canvas containing item. */
    Tk_Item *itemPtr,		/* Item to check against point. */
    double *coordPtr)		/* Pointer to x and y coordinates. */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;
    double x1, x2, y1, y2, xDiff, yDiff;

    x1 = imgPtr->header.x1;
    y1 = imgPtr->header.y1;
    x2 = imgPtr->header.x2;
    y2 = imgPtr->header.y2;

    /*
     * Point is outside rectangle.
     */

    if (coordPtr[0] < x1) {
	xDiff = x1 - coordPtr[0];
    } else if (coordPtr[0] > x2)  {
	xDiff = coordPtr[0] - x2;
    } else {
	xDiff = 0;
    }

    if (coordPtr[1] < y1) {
	yDiff = y1 - coordPtr[1];
    } else if (coordPtr[1] > y2)  {
	yDiff = coordPtr[1] - y2;
    } else {
	yDiff = 0;
    }

    return hypot(xDiff, yDiff);
}

/*
 *--------------------------------------------------------------
 *
 * ImageToArea --
 *
 *	This function is called to determine whether an item lies entirely
 *	inside, entirely outside, or overlapping a given rectangle.
 *
 * Results:
 *	-1 is returned if the item is entirely outside the area given by
 *	rectPtr, 0 if it overlaps, and 1 if it is entirely inside the given
 *	area.
 *
 * Side effects:
 *	None.
 *
 *--------------------------------------------------------------
 */

static int
ImageToArea(
    Tk_Canvas canvas,		/* Canvas containing item. */
    Tk_Item *itemPtr,		/* Item to check against rectangle. */
    double *rectPtr)		/* Pointer to array of four coordinates
				 * (x1,y1,x2,y2) describing rectangular
				 * area. */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;

    if ((rectPtr[2] <= imgPtr->header.x1)
	    || (rectPtr[0] >= imgPtr->header.x2)
	    || (rectPtr[3] <= imgPtr->header.y1)
	    || (rectPtr[1] >= imgPtr->header.y2)) {
	return -1;
    }
    if ((rectPtr[0] <= imgPtr->header.x1)
	    && (rectPtr[1] <= imgPtr->header.y1)
	    && (rectPtr[2] >= imgPtr->header.x2)
	    && (rectPtr[3] >= imgPtr->header.y2)) {
	return 1;
    }
    return 0;
}

/*
 *--------------------------------------------------------------
 *
 * ImageToPostscript --
 *
 *	This function is called to generate Postscript for image items.
 *
 * Results:
 *	The return value is a standard Tcl result. If an error occurs in
 *	generating Postscript then an error message is left in interp->result,
 *	replacing whatever used to be there. If no error occurs, then
 *	Postscript for the item is appended to the result.
 *
 * Side effects:
 *	None.
 *
 *--------------------------------------------------------------
 */

static int
ImageToPostscript(
    Tcl_Interp *interp,		/* Leave Postscript or error message here. */
    Tk_Canvas canvas,		/* Information about overall canvas. */
    Tk_Item *itemPtr,		/* Item for which Postscript is wanted. */
    int prepass)		/* 1 means this is a prepass to collect font
				 * information; 0 means final Postscript is
				 * being created.*/
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;
    Tk_Window canvasWin = Tk_CanvasTkwin(canvas);

    char buffer[256];
    double x, y;
    int width, height;
    Tk_Image image;
    Tk_State state = itemPtr->state;

    if(state == TK_STATE_NULL) {
	state = Canvas(canvas)->canvas_state;
    }

    image = imgPtr->image;
    if (Canvas(canvas)->currentItemPtr == itemPtr) {
	if (imgPtr->activeImage != NULL) {
	    image = imgPtr->activeImage;
	}
    } else if (state == TK_STATE_DISABLED) {
	if (imgPtr->disabledImage != NULL) {
	    image = imgPtr->disabledImage;
	}
    }
    if (image == NULL) {
	/*
	 * Image item without actual image specified.
	 */

        return TCL_OK;
    }
    Tk_SizeOfImage(image, &width, &height);

    /*
     * Compute the coordinates of the lower-left corner of the image, taking
     * into account the anchor position for the image.
     */

    x = imgPtr->x;
    y = Tk_CanvasPsY(canvas, imgPtr->y);

    switch (imgPtr->anchor) {
    case TK_ANCHOR_NW:			   y -= height;		break;
    case TK_ANCHOR_N:	   x -= width/2.0; y -= height;		break;
    case TK_ANCHOR_NE:	   x -= width;	   y -= height;		break;
    case TK_ANCHOR_E:	   x -= width;	   y -= height/2.0;	break;
    case TK_ANCHOR_SE:	   x -= width;				break;
    case TK_ANCHOR_S:	   x -= width/2.0;			break;
    case TK_ANCHOR_SW:						break;
    case TK_ANCHOR_W:			   y -= height/2.0;	break;
    case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0;	break;
    }

    if (!prepass) {
	sprintf(buffer, "%.15g %.15g", x, y);
	Tcl_AppendResult(interp, buffer, " translate\n", NULL);
    }

    return Tk_PostscriptImage(image, interp, canvasWin,
	    ((TkCanvas *) canvas)->psInfo, 0, 0, width, height, prepass);
}

/*
 *--------------------------------------------------------------
 *
 * ScaleImage --
 *
 *	This function is invoked to rescale an item.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The item referred to by itemPtr is rescaled so that the following
 *	transformation is applied to all point coordinates:
 *		x' = originX + scaleX*(x-originX)
 *		y' = originY + scaleY*(y-originY)
 *
 *--------------------------------------------------------------
 */

static void
ScaleImage(
    Tk_Canvas canvas,		/* Canvas containing rectangle. */
    Tk_Item *itemPtr,		/* Rectangle to be scaled. */
    double originX, double originY,
				/* Origin about which to scale rect. */
    double scaleX,		/* Amount to scale in X direction. */
    double scaleY)		/* Amount to scale in Y direction. */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;

    imgPtr->x = originX + scaleX*(imgPtr->x - originX);
    imgPtr->y = originY + scaleY*(imgPtr->y - originY);
    ComputeImageBbox(canvas, imgPtr);
}

/*
 *--------------------------------------------------------------
 *
 * TranslateImage --
 *
 *	This function is called to move an item by a given amount.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The position of the item is offset by (xDelta, yDelta), and the
 *	bounding box is updated in the generic part of the item structure.
 *
 *--------------------------------------------------------------
 */

static void
TranslateImage(
    Tk_Canvas canvas,		/* Canvas containing item. */
    Tk_Item *itemPtr,		/* Item that is being moved. */
    double deltaX, double deltaY)
				/* Amount by which item is to be moved. */
{
    ImageItem *imgPtr = (ImageItem *) itemPtr;

    imgPtr->x += deltaX;
    imgPtr->y += deltaY;
    ComputeImageBbox(canvas, imgPtr);
}

/*
 *----------------------------------------------------------------------
 *
 * ImageChangedProc --
 *
 *	This function is invoked by the image code whenever the manager for an
 *	image does something that affects the image's size or how it is
 *	displayed.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Arranges for the canvas to get redisplayed.
 *
 *----------------------------------------------------------------------
 */

static void
ImageChangedProc(
    ClientData clientData,	/* Pointer to canvas item for image. */
    int x, int y,		/* Upper left pixel (within image) that must
				 * be redisplayed. */
    int width, int height,	/* Dimensions of area to redisplay (may be <=
				 * 0). */
    int imgWidth, int imgHeight)/* New dimensions of image. */
{
    ImageItem *imgPtr = clientData;

    /*
     * If the image's size changed and it's not anchored at its northwest
     * corner then just redisplay the entire area of the image. This is a bit
     * over-conservative, but we need to do something because a size change
     * also means a position change.
     */

    if (((imgPtr->header.x2 - imgPtr->header.x1) != imgWidth)
	    || ((imgPtr->header.y2 - imgPtr->header.y1) != imgHeight)) {
	x = y = 0;
	width = imgWidth;
	height = imgHeight;
	Tk_CanvasEventuallyRedraw(imgPtr->canvas, imgPtr->header.x1,
		imgPtr->header.y1, imgPtr->header.x2, imgPtr->header.y2);
    }
    ComputeImageBbox(imgPtr->canvas, imgPtr);
    Tk_CanvasEventuallyRedraw(imgPtr->canvas, imgPtr->header.x1 + x,
	    imgPtr->header.y1 + y, (int) (imgPtr->header.x1 + x + width),
	    (int) (imgPtr->header.y1 + y + height));
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
@


1.18
log
@Eliminate many unnecessary (ClientData) type casts.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.17 2010/02/17 19:21:16 nijtmans Exp $
d166 1
a166 1
	Tcl_Panic("canvas did not pass any coords\n");
@


1.17
log
@CONSTify everything related to Tk_ConfigSpec
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.16 2010/01/18 20:43:38 nijtmans Exp $
d49 1
a49 1
    TkStateParseProc, TkStatePrintProc, (ClientData) 2
d52 1
a52 1
    Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
@


1.16
log
@fix more gcc warnings: missing initializer
Apply patch [#2932808]: Canvas items
not updating on widget state change
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.15 2010/01/02 22:52:38 dkf Exp $
d55 1
a55 1
static Tk_ConfigSpec configSpecs[] = {
@


1.15
log
@SMALL FIX: Remove useless explicit casts now that we require C89 or later.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.14 2009/02/03 23:55:47 nijtmans Exp $
a14 1
#include <stdio.h>
d57 1
a57 1
	NULL, Tk_Offset(ImageItem, activeImageString), TK_CONFIG_NULL_OK},
d59 1
a59 1
	"center", Tk_Offset(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT},
d61 1
a61 1
	NULL, Tk_Offset(ImageItem, disabledImageString), TK_CONFIG_NULL_OK},
d63 1
a63 1
	NULL, Tk_Offset(ImageItem, imageString), TK_CONFIG_NULL_OK},
d68 1
a68 1
    {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
d131 1
@


1.14
log
@- eliminate some unnessary type casts
- some internal const decorations
- spacing
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.13 2008/11/09 20:51:28 nijtmans Exp $
d324 1
a324 1
		ImageChangedProc, (ClientData) imgPtr);
d337 1
a337 1
		ImageChangedProc, (ClientData) imgPtr);
d350 1
a350 1
		ImageChangedProc, (ClientData) imgPtr);
d854 1
a854 1
    ImageItem *imgPtr = (ImageItem *) clientData;
@


1.13
log
@make all Tk_CustomOption tables const and
remove unnecessary type cast
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.12 2008/04/27 22:38:55 dkf Exp $
d190 1
a190 1
	char *arg = Tcl_GetString(objv[1]);
@


1.12
log
@Get rid of pre-C89-isms (esp. CONST vs const).
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.11 2007/12/13 15:24:13 dgp Exp $
d49 2
a50 3
static Tk_CustomOption stateOption = {
    (Tk_OptionParseProc *) TkStateParseProc,
    TkStatePrintProc, (ClientData) 2
d52 2
a53 3
static Tk_CustomOption tagsOption = {
    (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
    Tk_CanvasTagsPrintProc, (ClientData) NULL
@


1.11
log
@merge stable branch onto HEAD
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.9.2.1 2007/09/07 01:25:34 dgp Exp $
d83 1
a83 1
			    Tcl_Obj *CONST argv[]);
d93 1
a93 1
			    Tcl_Obj *CONST argv[], int flags);
d96 1
a96 1
			    int argc, Tcl_Obj *CONST argv[]);
d162 1
a162 1
    Tcl_Obj *CONST objv[])	/* Arguments describing rectangle. */
d234 1
a234 1
    Tcl_Obj *CONST objv[])	/* Array of coordinates: x1, y1, x2, y2, ... */
d299 1
a299 1
    Tcl_Obj *CONST objv[],	/* Arguments describing things to configure. */
d308 1
a308 1
	    (CONST char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) {
d442 1
a442 1
	state = ((TkCanvas *)canvas)->canvas_state;
d445 1
a445 1
    if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)imgPtr) {
d545 1
a545 1
	state = ((TkCanvas *)canvas)->canvas_state;
d549 1
a549 1
    if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
d702 1
a702 1
    ImageItem *imgPtr = (ImageItem *)itemPtr;
d712 1
a712 1
	state = ((TkCanvas *)canvas)->canvas_state;
d716 1
a716 1
    if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
@


1.10
log
@header cleanup
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.9 2005/11/04 15:23:05 dkf Exp $
@


1.9
log
@ANSIfy
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.8 2004/11/17 22:17:11 hobbs Exp $
a16 1
#include "tkPort.h"
@


1.9.2.1
log
@merge updates from HEAD
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.9 2005/11/04 15:23:05 dkf Exp $
d17 1
@


1.8
log
@	* generic/tkCanvImg.c (ImageToPostscript): don't try ps generation
	of canvas image item without image specified. [Bug 1032300]
@
text
@d1 1
a1 1
/* 
d9 2
a10 2
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.7 2004/01/13 02:06:00 davygrvy Exp $
d26 1
a26 1
				 * types.  MUST BE FIRST IN STRUCTURE. */
d30 4
a33 4
    Tk_Anchor anchor;		/* Where to anchor image relative to
				 * (x,y). */
    char *imageString;		/* String describing -image option (malloc-ed).
				 * NULL means no image right now. */
d38 6
a43 6
    Tk_Image image;		/* Image to display in window, or NULL if
				 * no image at present. */
    Tk_Image activeImage;	/* Image to display in window, or NULL if
				 * no image at present. */
    Tk_Image disabledImage;	/* Image to display in window, or NULL if
				 * no image at present. */
d60 3
a62 4
    {TK_CONFIG_STRING, "-activeimage", (char *) NULL, (char *) NULL,
	(char *) NULL, Tk_Offset(ImageItem, activeImageString),
	TK_CONFIG_NULL_OK},
    {TK_CONFIG_ANCHOR, "-anchor", (char *) NULL, (char *) NULL,
d64 9
a72 12
    {TK_CONFIG_STRING, "-disabledimage", (char *) NULL, (char *) NULL,
	(char *) NULL, Tk_Offset(ImageItem, disabledImageString),
	TK_CONFIG_NULL_OK},
    {TK_CONFIG_STRING, "-image", (char *) NULL, (char *) NULL,
	(char *) NULL, Tk_Offset(ImageItem, imageString), TK_CONFIG_NULL_OK},
    {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
	(char *) NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK,
	&stateOption},
    {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
	(char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
    {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
	(char *) NULL, 0, 0}
d76 1
a76 1
 * Prototypes for procedures defined in this file:
d79 1
a79 1
static void		ImageChangedProc _ANSI_ARGS_((ClientData clientData,
d81 2
a82 2
			    int imgHeight));
static int		ImageCoords _ANSI_ARGS_((Tcl_Interp *interp,
d84 9
a92 10
			    Tcl_Obj *CONST argv[]));
static int		ImageToArea _ANSI_ARGS_((Tk_Canvas canvas,
			    Tk_Item *itemPtr, double *rectPtr));
static double		ImageToPoint _ANSI_ARGS_((Tk_Canvas canvas,
			    Tk_Item *itemPtr, double *coordPtr));
static int		ImageToPostscript _ANSI_ARGS_((Tcl_Interp *interp,
			    Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
static void		ComputeImageBbox _ANSI_ARGS_((Tk_Canvas canvas,
			    ImageItem *imgPtr));
static int		ConfigureImage _ANSI_ARGS_((Tcl_Interp *interp,
d94 2
a95 2
			    Tcl_Obj *CONST argv[], int flags));
static int		CreateImage _ANSI_ARGS_((Tcl_Interp *interp,
d97 4
a100 4
			    int argc, Tcl_Obj *CONST argv[]));
static void		DeleteImage _ANSI_ARGS_((Tk_Canvas canvas,
			    Tk_Item *itemPtr, Display *display));
static void		DisplayImage _ANSI_ARGS_((Tk_Canvas canvas,
d102 2
a103 2
			    int x, int y, int width, int height));
static void		ScaleImage _ANSI_ARGS_((Tk_Canvas canvas,
d105 3
a107 3
			    double scaleX, double scaleY));
static void		TranslateImage _ANSI_ARGS_((Tk_Canvas canvas,
			    Tk_Item *itemPtr, double deltaX, double deltaY));
d110 2
a111 2
 * The structures below defines the image item type in terms of
 * procedures that can be invoked by generic item code.
d115 20
a134 20
    "image",				/* name */
    sizeof(ImageItem),			/* itemSize */
    CreateImage,			/* createProc */
    configSpecs,			/* configSpecs */
    ConfigureImage,			/* configureProc */
    ImageCoords,			/* coordProc */
    DeleteImage,			/* deleteProc */
    DisplayImage,			/* displayProc */
    TK_CONFIG_OBJS,			/* flags */
    ImageToPoint,			/* pointProc */
    ImageToArea,			/* areaProc */
    ImageToPostscript,	                /* postscriptProc */
    ScaleImage,				/* scaleProc */
    TranslateImage,			/* translateProc */
    (Tk_ItemIndexProc *) NULL,		/* indexProc */
    (Tk_ItemCursorProc *) NULL,		/* icursorProc */
    (Tk_ItemSelectionProc *) NULL,	/* selectionProc */
    (Tk_ItemInsertProc *) NULL,		/* insertProc */
    (Tk_ItemDCharsProc *) NULL,		/* dTextProc */
    (Tk_ItemType *) NULL,		/* nextPtr */
d142 1
a142 2
 *	This procedure is invoked to create a new image
 *	item in a canvas.
d145 4
a148 4
 *	A standard Tcl return value.  If an error occurred in
 *	creating the item, then an error message is left in
 *	the interp's result;  in this case itemPtr is left uninitialized,
 *	so it can be safely freed by the caller.
d157 7
a163 7
CreateImage(interp, canvas, itemPtr, objc, objv)
    Tcl_Interp *interp;			/* Interpreter for error reporting. */
    Tk_Canvas canvas;			/* Canvas to hold new item. */
    Tk_Item *itemPtr;			/* Record to hold new item;  header
					 * has been initialized by caller. */
    int objc;				/* Number of arguments in objv. */
    Tcl_Obj *CONST objv[];		/* Arguments describing rectangle. */
d186 2
a187 2
     * Process the arguments to fill in the item record.
     * Only 1 (list) or 2 (x y) coords are allowed.
d206 1
a206 1
    error:
d216 2
a217 3
 *	This procedure is invoked to process the "coords" widget
 *	command on image items.  See the user documentation for
 *	details on what it does.
d229 7
a235 9
ImageCoords(interp, canvas, itemPtr, objc, objv)
    Tcl_Interp *interp;			/* Used for error reporting. */
    Tk_Canvas canvas;			/* Canvas containing item. */
    Tk_Item *itemPtr;			/* Item whose coordinates are to be
					 * read or modified. */
    int objc;				/* Number of coordinates supplied in
					 * objv. */
    Tcl_Obj *CONST objv[];		/* Array of coordinates: x1, y1,
					 * x2, y2, ... */
d241 1
d268 1
a268 1
	
d281 2
a282 2
 *	This procedure is invoked to configure various aspects
 *	of an image item, such as its anchor position.
d285 2
a286 2
 *	A standard Tcl result code.  If an error occurs, then
 *	an error message is left in the interp's result.
d295 7
a301 7
ConfigureImage(interp, canvas, itemPtr, objc, objv, flags)
    Tcl_Interp *interp;		/* Used for error reporting. */
    Tk_Canvas canvas;		/* Canvas containing itemPtr. */
    Tk_Item *itemPtr;		/* Image item to reconfigure. */
    int objc;			/* Number of elements in objv.  */
    Tcl_Obj *CONST objv[];	/* Arguments describing things to configure. */
    int flags;			/* Flags to pass to Tk_ConfigureWidget. */
d314 4
a317 4
     * Create the image.  Save the old image around and don't free it
     * until after the new one is allocated.  This keeps the reference
     * count from going to zero so the image doesn't have to be recreated
     * if it hasn't changed.
d373 2
a374 2
 *	This procedure is called to clean up the data structure
 *	associated with a image item.
d386 4
a389 5
DeleteImage(canvas, itemPtr, display)
    Tk_Canvas canvas;			/* Info about overall canvas widget. */
    Tk_Item *itemPtr;			/* Item that is being deleted. */
    Display *display;			/* Display containing window for
					 * canvas. */
d418 3
a420 4
 *	This procedure is invoked to compute the bounding box of
 *	all the pixels that may be drawn as part of a image item.
 *	This procedure is where the child image's placement is
 *	computed.
d426 1
a426 2
 *	The fields x1, y1, x2, and y2 are updated in the header
 *	for itemPtr.
d433 3
a435 4
ComputeImageBbox(canvas, imgPtr)
    Tk_Canvas canvas;			/* Canvas that contains item. */
    ImageItem *imgPtr;			/* Item whose bbox is to be
					 * recomputed. */
d471 30
a500 30
	case TK_ANCHOR_N:
	    x -= width/2;
	    break;
	case TK_ANCHOR_NE:
	    x -= width;
	    break;
	case TK_ANCHOR_E:
	    x -= width;
	    y -= height/2;
	    break;
	case TK_ANCHOR_SE:
	    x -= width;
	    y -= height;
	    break;
	case TK_ANCHOR_S:
	    x -= width/2;
	    y -= height;
	    break;
	case TK_ANCHOR_SW:
	    y -= height;
	    break;
	case TK_ANCHOR_W:
	    y -= height/2;
	    break;
	case TK_ANCHOR_NW:
	    break;
	case TK_ANCHOR_CENTER:
	    x -= width/2;
	    y -= height/2;
	    break;
d518 1
a518 2
 *	This procedure is invoked to draw a image item in a given
 *	drawable.
d524 2
a525 2
 *	ItemPtr is drawn in drawable using the transformation
 *	information in canvas.
d531 8
a538 8
DisplayImage(canvas, itemPtr, display, drawable, x, y, width, height)
    Tk_Canvas canvas;			/* Canvas that contains item. */
    Tk_Item *itemPtr;			/* Item to be displayed. */
    Display *display;			/* Display on which to draw item. */
    Drawable drawable;			/* Pixmap or window in which to draw
					 * item. */
    int x, y, width, height;		/* Describes region of canvas that
					 * must be redisplayed (not used). */
d545 1
a545 1
    if(state == TK_STATE_NULL) {
d579 2
a580 2
 *	Computes the distance from a given point to a given
 *	rectangle, in canvas units.
d583 4
a586 4
 *	The return value is 0 if the point whose x and y coordinates
 *	are coordPtr[0] and coordPtr[1] is inside the image.  If the
 *	point isn't inside the image then the return value is the
 *	distance from the point to the image.
d595 4
a598 4
ImageToPoint(canvas, itemPtr, coordPtr)
    Tk_Canvas canvas;		/* Canvas containing item. */
    Tk_Item *itemPtr;		/* Item to check against point. */
    double *coordPtr;		/* Pointer to x and y coordinates. */
d636 2
a637 3
 *	This procedure is called to determine whether an item
 *	lies entirely inside, entirely outside, or overlapping
 *	a given rectangle.
d640 3
a642 3
 *	-1 is returned if the item is entirely outside the area
 *	given by rectPtr, 0 if it overlaps, and 1 if it is entirely
 *	inside the given area.
d651 6
a656 6
ImageToArea(canvas, itemPtr, rectPtr)
    Tk_Canvas canvas;		/* Canvas containing item. */
    Tk_Item *itemPtr;		/* Item to check against rectangle. */
    double *rectPtr;		/* Pointer to array of four coordinates
				 * (x1, y1, x2, y2) describing rectangular
				 * area.  */
d680 1
a680 2
 *	This procedure is called to generate Postscript for
 *	image items.
d683 4
a686 5
 *	The return value is a standard Tcl result.  If an error
 *	occurs in generating Postscript then an error message is
 *	left in interp->result, replacing whatever used to be there.
 *	If no error occurs, then Postscript for the item is appended
 *	to the result.
d695 7
a701 9
ImageToPostscript(interp, canvas, itemPtr, prepass)
    Tcl_Interp *interp;			/* Leave Postscript or error message
					 * here. */
    Tk_Canvas canvas;			/* Information about overall canvas. */
    Tk_Item *itemPtr;			/* Item for which Postscript is
					 * wanted. */
    int prepass;			/* 1 means this is a prepass to
					 * collect font information;  0 means
					 * final Postscript is being created.*/
d730 1
d736 2
a737 2
     * Compute the coordinates of the lower-left corner of the image,
     * taking into account the anchor position for the image.
d744 9
a752 9
	case TK_ANCHOR_NW:			y -= height;		break;
	case TK_ANCHOR_N:	x -= width/2.0; y -= height;		break;
	case TK_ANCHOR_NE:	x -= width;	y -= height;		break;
	case TK_ANCHOR_E:	x -= width;	y -= height/2.0;	break;
	case TK_ANCHOR_SE:	x -= width;				break;
	case TK_ANCHOR_S:	x -= width/2.0;				break;
	case TK_ANCHOR_SW:						break;
	case TK_ANCHOR_W:			y -= height/2.0;	break;
	case TK_ANCHOR_CENTER:	x -= width/2.0; y -= height/2.0;	break;
d757 1
a757 1
	Tcl_AppendResult(interp, buffer, " translate\n", (char *) NULL);
d769 1
a769 1
 *	This procedure is invoked to rescale an item.
d775 2
a776 2
 *	The item referred to by itemPtr is rescaled so that the
 *	following transformation is applied to all point coordinates:
d784 7
a790 6
ScaleImage(canvas, itemPtr, originX, originY, scaleX, scaleY)
    Tk_Canvas canvas;			/* Canvas containing rectangle. */
    Tk_Item *itemPtr;			/* Rectangle to be scaled. */
    double originX, originY;		/* Origin about which to scale rect. */
    double scaleX;			/* Amount to scale in X direction. */
    double scaleY;			/* Amount to scale in Y direction. */
d804 1
a804 1
 *	This procedure is called to move an item by a given amount.
d810 2
a811 3
 *	The position of the item is offset by (xDelta, yDelta), and
 *	the bounding box is updated in the generic part of the item
 *	structure.
d817 5
a821 5
TranslateImage(canvas, itemPtr, deltaX, deltaY)
    Tk_Canvas canvas;			/* Canvas containing item. */
    Tk_Item *itemPtr;			/* Item that is being moved. */
    double deltaX, deltaY;		/* Amount by which item is to be
					 * moved. */
d835 3
a837 3
 *	This procedure is invoked by the image code whenever the manager
 *	for an image does something that affects the image's size or
 *	how it is displayed.
d849 7
a855 7
ImageChangedProc(clientData, x, y, width, height, imgWidth, imgHeight)
    ClientData clientData;		/* Pointer to canvas item for image. */
    int x, y;				/* Upper left pixel (within image)
					 * that must be redisplayed. */
    int width, height;			/* Dimensions of area to redisplay
					 * (may be <= 0). */
    int imgWidth, imgHeight;		/* New dimensions of image. */
d860 4
a863 4
     * If the image's size changed and it's not anchored at its
     * northwest corner then just redisplay the entire area of the
     * image.  This is a bit over-conservative, but we need to do
     * something because a size change also means a position change.
d873 1
a873 1
    } 
d879 8
@


1.7
log
@	* generic/tk3d.c:	All uses of 'panic' (the macro) changed
	* generic/tkBind.c:	to 'Tcl_Panic' (the function).  The #define
	* generic/tkBitmap.c:	of panic in tcl.h clearly states it is
	* generic/tkCanvArc.c:	deprecated in the comments.
	* generic/tkCanvBmap.c: [Tcl Patch 865264]
	* generic/tkCanvImg.c:
	* generic/tkCanvLine.c:
	* generic/tkCanvPoly.c:
	* generic/tkCanvText.c:
	* generic/tkCanvWind.c:
	* generic/tkColor.c:
	* generic/tkConfig.c:
	* generic/tkCursor.c:
	* generic/tkError.c:
	* generic/tkEvent.c:
	* generic/tkFocus.c:
	* generic/tkFont.c:
	* generic/tkFrame.c:
	* generic/tkGC.c:
	* generic/tkGrid.c:
	* generic/tkImgBmap.c:
	* generic/tkImgPhoto.c:
	* generic/tkImgUtil.c:
	* generic/tkMenu.c:
	* generic/tkObj.c:
	* generic/tkPack.c:
	* generic/tkPlace.c:
	* generic/tkRectOval.c:
	* generic/tkSelect.c:
	* generic/tkText.c:
	* generic/tkTextBTree.c:
	* generic/tkTextDisp.c:
	* generic/tkTextImage.c:
	* generic/tkTextIndex.c:
	* generic/tkTextMark.c:
	* generic/tkTextWind.c:
	* generic/tkVisual.c:
	* generic/tkWindow.c:
	* mac/tkMacAppInit.c:
	* mac/tkMacAppearanceStubs.c:
	* mac/tkMacButton.c:
	* mac/tkMacDraw.c:
	* mac/tkMacEmbed.c:
	* mac/tkMacFont.c:
	* mac/tkMacInit.c:
	* mac/tkMacMenus.c:
	* mac/tkMacPort.h:
	* mac/tkMacSubwindows.c:
	* mac/tkMacWm.c:
	* mac/tkMacXStubs.c:
	* macosx/tkMacOSXEmbed.c:
	* macosx/tkMacOSXFont.c:
	* macosx/tkMacOSXMenus.c:
	* macosx/tkMacOSXNotify.c:
	* macosx/tkMacOSXPort.h:
	* macosx/tkMacOSXSubwindows.c:
	* macosx/tkMacOSXWm.c:
	* macosx/tkMacOSXXStubs.c:
	* unix/tkUnix3d.c:
	* unix/tkUnixColor.c:
	* unix/tkUnixEmbed.c:
	* unix/tkUnixEvent.c:
	* unix/tkUnixFocus.c:
	* unix/tkUnixFont.c:
	* unix/tkUnixSelect.c:
	* unix/tkUnixSend.c:
	* unix/tkUnixWm.c:
	* win/tkWin3d.c:
	* win/tkWinButton.c:
	* win/tkWinColor.c:
	* win/tkWinDialog.c:
	* win/tkWinDraw.c:
	* win/tkWinEmbed.c:
	* win/tkWinFont.c:
	* win/tkWinPixmap.c:
	* win/tkWinPointer.c:
	* win/tkWinScrlbr.c:
	* win/tkWinWm.c:
	* win/tkWinX.c:
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.6 2003/02/09 07:48:22 hobbs Exp $
d744 6
d759 1
a759 1
    
a771 4
    if (image == NULL) {
        return TCL_OK;
    }
    
@


1.6
log
@	* generic/tkCanvArc.c (CreateArc):       Rework canvas create item
	* generic/tkCanvBmap.c (CreateBitmap):   type coords handling to be
	* generic/tkCanvImg.c (CreateImage):     consistent across types
	* generic/tkCanvPoly.c (CreatePolygon):  and not pass empty coords
	* generic/tkCanvLine.c (CreateLine):     to item creation procs.
	* generic/tkCanvText.c (CreateText):
	* generic/tkCanvWind.c (CreateWinItem):
	* generic/tkCanvas.c (CanvasWidgetCmd CANV_CREATE):
	* generic/tkRectOval.c (CreateRectOval):
	* tests/canvRect.test:
	* tests/canvText.test:
	* tests/canvas.test:
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.5 2002/08/05 04:30:38 dgp Exp $
d175 1
a175 1
	panic("canvas did not pass any coords\n");
@


1.6.2.1
log
@	* generic/tkCanvImg.c (ImageToPostscript): don't try ps generation
	of canvas image item without image specified. [Bug 1032300]
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.6 2003/02/09 07:48:22 hobbs Exp $
d730 1
a730 1
    if (state == TK_STATE_NULL) {
a743 6
    if (image == NULL) {
	/*
	 * Image item without actual image specified.
	 */
	return TCL_OK;
    }
d753 1
a753 1

d766 4
@


1.5
log
@Applied companion patch for Tcl Patch 585105,
updating Tk to use Tcl 8.4's fully CONST-ified
interface, and fully CONSTifying Tk at the
same time.

This patch includes purging Tk of its last
direct access to interp->result.  [Bug 589853]

The substantial changes include copying
event sequence strings into Tcl_DStrings
in tkBind.c, and copying [text] indices into
Tcl_DStrings because parsing them involved
overwriting them.  If this causes performance
trouble, that can be resolved by further
converting them to Tcl_Obj's.

The #defines USE_NON_CONST and USE_COMPAT_CONST
have the same effect for Tk as they do for Tcl.
(They actually change tcl.h)
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.4 1999/12/14 06:52:25 hobbs Exp $
d163 1
a163 1
CreateImage(interp, canvas, itemPtr, argc, argv)
d168 2
a169 2
    int argc;				/* Number of arguments in argv. */
    Tcl_Obj *CONST argv[];		/* Arguments describing rectangle. */
d174 2
a175 18
    if (argc==1) {
	i = 1;
    } else {
	char *arg = Tcl_GetStringFromObj((Tcl_Obj *) argv[1], NULL);
	if (((argc>1) && (arg[0] == '-')
		&& (arg[1] >= 'a') && (arg[1] <= 'z'))) {
	    i = 1;
	} else {
	    i = 2;
	}
    }

    if (argc < i) {
	Tcl_AppendResult(interp, "wrong # args: should be \"",
		Tk_PathName(Tk_CanvasTkwin(canvas)), " create ",
		itemPtr->typePtr->name, " x y ?options?\"",
		(char *) NULL);
	return TCL_ERROR;
d193 1
d196 10
a205 1
    if ((ImageCoords(interp, canvas, itemPtr, i, argv) != TCL_OK)) {
d208 1
a208 1
    if (ConfigureImage(interp, canvas, itemPtr, argc-i, argv+i, 0) == TCL_OK) {
d236 1
a236 1
ImageCoords(interp, canvas, itemPtr, argc, argv)
d241 3
a243 3
    int argc;				/* Number of coordinates supplied in
					 * argv. */
    Tcl_Obj *CONST argv[];		/* Array of coordinates: x1, y1,
d248 1
a248 1
    if (argc == 0) {
d255 4
a258 4
    } else if (argc < 3) {
	if (argc==1) {
	    if (Tcl_ListObjGetElements(interp, argv[0], &argc,
		    (Tcl_Obj ***) &argv) != TCL_OK) {
d260 1
a260 1
	    } else if (argc != 2) {
d263 1
a263 1
		sprintf(buf, "wrong # coordinates: expected 2, got %d", argc);
d268 2
a269 2
	if ((Tk_CanvasGetCoordFromObj(interp, canvas, argv[0], &imgPtr->x) != TCL_OK)
		|| (Tk_CanvasGetCoordFromObj(interp, canvas, argv[1],
d277 1
a277 1
	sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", argc);
d303 1
a303 1
ConfigureImage(interp, canvas, itemPtr, argc, argv, flags)
d307 2
a308 2
    int argc;			/* Number of elements in argv.  */
    Tcl_Obj *CONST argv[];	/* Arguments describing things to configure. */
d316 2
a317 2
    if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, argc,
	    (CONST char **) argv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) {
@


1.4
log
@	* generic/tkStubInit.c:
	* generic/tkDecls.h:
	* generic/tkIntXlibDecls.h:
	* generic/tkInt.decls: added XSetDashes and XWarpPointer
	* generic/tk.decls: added Tk_CreateSmoothMethod, and reserved
	two spots
	* generic/tk.h: added Tk_SmoothMethod struct,
	state item to canvas record, #defines for item state,
	support for using old char*-based canvas item C creation
	procedures with -DUSE_OLD_CANVAS,
	Tk_Dash, Tk_TSOffset (-offsets) & Tk_Outline structs and #defs,
	decls for dash, outline and postscript routines
	* generic/tkBind.c: added support for Quadruple clicks, and added
	the -warp option to 'event' with pointer warping routines
	* xlib/xgc.c:
	* generic/tkRectOval.c:
	* generic/tkCanvArc.c:
	* generic/tkCanvBmap.c:
	* generic/tkCanvImg.c:
	* generic/tkCanvLine.c:
	* generic/tkCanvPoly.c:
	* generic/tkCanvPs.c:
	* generic/tkCanvText.c:
	* generic/tkCanvUtil.c:
	* generic/tkCanvWind.c:
	* generic/tkCanvas.c:
	* generic/tkCanvas.h: Canvas and items received overhaul to with
	the addition of the dash patch (Nijtmans, et al)  This includes
	objectification of the 'canvas' command, as well as support for
	(where appropriate) dashes in items, extended stipple support,
	state for all items, and postscript generation of images and
	windows.  See the new canvas man page for related docs.
	* generic/tkEntry.c: added entry widget validation, see entry.n
	* generic/tkEvent.c: on simulated events, ButtonPress should
	be matched with ButtonRelease to be correct
	* generic/tkFont.c: corrected possible null reference
	* generic/tkFrame.c: made frame a Tcl_Obj based command
	* generic/tkGet.c: added TkGetDoublePixels
	* generic/tkImage.c: bug fixes from Img patch and new
	Tk_PostscriptImage and Tk_SetTSOrigin functions
	* generic/tkImgBmap.c: new ImgBmapPostscript function
	* generic/tkImgPhoto.c: new Tk_CreatePhotoOption, Tk_DitherPhoto
	* generic/tkInt.h: declarations for some new functions
	* generic/tkMessage.c: reworked relief drawing
	* generic/tkOldConfig.c: added TK_CONFIG_OBJS so old style
	ConfigureWidget calls can pass in Tcl_Obj arrays
	* generic/tkScrollbar.c:
	* generic/tkScrollbar.h: made -orient use an option table
	* generic/tkText.c:
	* generic/tkText.h: made -wrap and -state use option tables
	* generic/tkTextBTree.c:
	* generic/tkTextDisp.c:
	* generic/tkTextImage.c:
	* generic/tkTextMark.c:
	* generic/tkTextTag.c:
	* generic/tkTextWind.c: added support for -elide and -state hidden
	* generic/tkTrig.c: changed TkMakeBezierCurve to support returning
	the upper limit of points needed for spline
	* generic/tkUtil.c: new option table parsing routines
	* generic/tkWindow.c: init'ing of warp stuff, mouseButtonState
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.3 1999/04/16 01:51:11 stanton Exp $
d322 2
a323 2
    if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc, (char **) argv,
	    (char *) imgPtr, flags|TK_CONFIG_OBJS) != TCL_OK) {
@


1.4.8.1
log
@merged with trunk at tag macosx-8-4-merge-2002-08-20-trunk
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id$
d322 2
a323 2
    if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, argc,
	    (CONST char **) argv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) {
@


1.3
log
@* Merged 8.1 branch into the main trunk
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id$
d34 4
d40 4
d50 6
a55 1
static Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
d60 3
d65 3
d70 3
d88 1
a88 1
			    char **argv));
d93 2
d99 1
a99 1
			    char **argv, int flags));
d102 1
a102 1
			    int argc, char **argv));
d128 1
a128 1
    0,					/* alwaysRedraw */
d131 1
a131 1
    (Tk_ItemPostscriptProc *) NULL,	/* postscriptProc */
d139 1
a139 1
    (Tk_ItemType *) NULL		/* nextPtr */
d169 1
a169 1
    char **argv;			/* Arguments describing rectangle. */
d172 1
d174 13
a186 1
    if (argc < 2) {
d201 2
d204 2
d211 5
a215 4
    if ((Tk_CanvasGetCoord(interp, canvas, argv[0], &imgPtr->x) != TCL_OK)
	    || (Tk_CanvasGetCoord(interp, canvas, argv[1], &imgPtr->y)
		!= TCL_OK)) {
	return TCL_ERROR;
d218 3
a220 5
    if (ConfigureImage(interp, canvas, itemPtr, argc-2, argv+2, 0) != TCL_OK) {
	DeleteImage(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
	return TCL_ERROR;
    }
    return TCL_OK;
d249 1
a249 1
    char **argv;			/* Array of coordinates: x1, y1,
a252 1
    char x[TCL_DOUBLE_SPACE], y[TCL_DOUBLE_SPACE];
d255 22
a276 7
	Tcl_PrintDouble(interp, imgPtr->x, x);
	Tcl_PrintDouble(interp, imgPtr->y, y);
	Tcl_AppendResult(interp, x, " ", y, (char *) NULL);
    } else if (argc == 2) {
	if ((Tk_CanvasGetCoord(interp, canvas, argv[0], &imgPtr->x) != TCL_OK)
		|| (Tk_CanvasGetCoord(interp, canvas, argv[1],
		    &imgPtr->y) != TCL_OK)) {
d314 1
a314 1
    char **argv;		/* Arguments describing things to configure. */
d322 2
a323 2
    if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc,
	    argv, (char *) imgPtr, flags) != TCL_OK) {
d334 5
d352 26
d411 6
d420 6
d457 16
d477 1
a477 1
    if (imgPtr->image == None) {
d487 1
a487 1
    Tk_SizeOfImage(imgPtr->image, &width, &height);
d561 6
d568 12
a579 1
    if (imgPtr->image == NULL) {
d589 1
a589 1
    Tk_RedrawImage(imgPtr->image, x - imgPtr->header.x1, y - imgPtr->header.y1,
d693 90
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d7 1
a7 1
 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
d129 1
a129 1
 *	interp->result;  in this case itemPtr is left uninitialized,
d193 1
a193 1
 *	Returns TCL_OK or TCL_ERROR, and sets interp->result.
d227 4
a230 2
	sprintf(interp->result,
		"wrong # coordinates: expected 0 or 2, got %d", argc);
d246 1
a246 1
 *	an error message is left in interp->result.
@


1.1
log
@Initial revision
@
text
@d12 1
a12 1
 * SCCS: @@(#) tkCanvImg.c 1.18 96/05/03 10:49:09
@


1.1.4.1
log
@initial tk8.1a2 version
@
text
@d7 1
a7 1
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
d12 1
a12 1
 * SCCS: @@(#) tkCanvImg.c 1.19 97/11/07 21:14:48
d129 1
a129 1
 *	the interp's result;  in this case itemPtr is left uninitialized,
d193 1
a193 1
 *	Returns TCL_OK or TCL_ERROR, and sets the interp's result.
d227 2
a228 4
	char buf[64];
	
	sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", argc);
	Tcl_SetResult(interp, buf, TCL_VOLATILE);
d244 1
a244 1
 *	an error message is left in the interp's result.
@


1.1.4.2
log
@Merged 8.0.3 changes into 8.1
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkCanvImg.c,v 1.2 1998/09/14 18:23:05 stanton Exp $
@


