diff options
Diffstat (limited to 'generic/tkCanvPoly.c')
-rw-r--r-- | generic/tkCanvPoly.c | 514 |
1 files changed, 260 insertions, 254 deletions
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 1e61367..b043aad 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -10,10 +10,9 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvPoly.c,v 1.18 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvPoly.c,v 1.28 2010/11/19 14:48:00 nijtmans Exp $ */ -#include <stdio.h> #include "tkInt.h" #include "tkCanvas.h" @@ -46,7 +45,7 @@ typedef struct PolygonItem { Pixmap disabledFillStipple; /* Stipple bitmap for filling polygon if state * is disabled. */ GC fillGC; /* Graphics context for filling polygon. */ - Tk_SmoothMethod *smooth; /* Non-zero means draw shape smoothed (i.e. + const Tk_SmoothMethod *smooth; /* Non-zero means draw shape smoothed (i.e. * with Bezier splines). */ int splineSteps; /* Number of steps in each spline segment. */ int autoClosed; /* Zero means the given polygon was closed, @@ -57,45 +56,39 @@ typedef struct PolygonItem { * Information used for parsing configuration specs: */ -static Tk_CustomOption smoothOption = { - (Tk_OptionParseProc *) TkSmoothParseProc, - TkSmoothPrintProc, (ClientData) NULL +static const Tk_CustomOption smoothOption = { + TkSmoothParseProc, TkSmoothPrintProc, NULL }; -static Tk_CustomOption stateOption = { - (Tk_OptionParseProc *) TkStateParseProc, - TkStatePrintProc, (ClientData) 2 +static const Tk_CustomOption stateOption = { + TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; -static Tk_CustomOption tagsOption = { - (Tk_OptionParseProc *) Tk_CanvasTagsParseProc, - Tk_CanvasTagsPrintProc, (ClientData) NULL +static const Tk_CustomOption tagsOption = { + Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; -static Tk_CustomOption dashOption = { - (Tk_OptionParseProc *) TkCanvasDashParseProc, - TkCanvasDashPrintProc, (ClientData) NULL +static const Tk_CustomOption dashOption = { + TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL }; -static Tk_CustomOption offsetOption = { - (Tk_OptionParseProc *) TkOffsetParseProc, - TkOffsetPrintProc, - (ClientData) (TK_OFFSET_RELATIVE|TK_OFFSET_INDEX) +static const Tk_CustomOption offsetOption = { + TkOffsetParseProc, TkOffsetPrintProc, + INT2PTR(TK_OFFSET_RELATIVE|TK_OFFSET_INDEX) }; -static Tk_CustomOption pixelOption = { - (Tk_OptionParseProc *) TkPixelParseProc, - TkPixelPrintProc, (ClientData) NULL +static const Tk_CustomOption pixelOption = { + TkPixelParseProc, TkPixelPrintProc, NULL }; -static Tk_ConfigSpec configSpecs[] = { +static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, Tk_Offset(PolygonItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, - NULL, Tk_Offset(PolygonItem, activeFillColor), TK_CONFIG_NULL_OK}, + NULL, Tk_Offset(PolygonItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.activeColor), TK_CONFIG_NULL_OK}, + NULL, Tk_Offset(PolygonItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL, NULL, Tk_Offset(PolygonItem, outline.activeStipple), - TK_CONFIG_NULL_OK}, + TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, activeFillStipple), TK_CONFIG_NULL_OK}, + NULL, Tk_Offset(PolygonItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, "0.0", Tk_Offset(PolygonItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, @@ -104,52 +97,52 @@ static Tk_ConfigSpec configSpecs[] = { TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, "0", Tk_Offset(PolygonItem, outline.offset), - TK_CONFIG_DONT_SET_DEFAULT}, + TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, NULL, Tk_Offset(PolygonItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, - NULL, Tk_Offset(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK}, + NULL, Tk_Offset(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL, NULL, Tk_Offset(PolygonItem, outline.disabledColor), - TK_CONFIG_NULL_OK}, + TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, NULL, Tk_Offset(PolygonItem, outline.disabledStipple), - TK_CONFIG_NULL_OK}, + TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, disabledFillStipple), TK_CONFIG_NULL_OK}, + NULL, Tk_Offset(PolygonItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL, "0.0", Tk_Offset(PolygonItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, - "black", Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK}, + "black", Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL, - "round", Tk_Offset(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT}, + "round", Tk_Offset(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, "0,0", Tk_Offset(PolygonItem, tsoffset), TK_CONFIG_NULL_OK, &offsetOption}, {TK_CONFIG_COLOR, "-outline", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.color), TK_CONFIG_NULL_OK}, + NULL, Tk_Offset(PolygonItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL, "0,0", Tk_Offset(PolygonItem, outline.tsoffset), TK_CONFIG_NULL_OK, &offsetOption}, {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.stipple), TK_CONFIG_NULL_OK}, + NULL, Tk_Offset(PolygonItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-smooth", NULL, NULL, "0", Tk_Offset(PolygonItem, smooth), TK_CONFIG_DONT_SET_DEFAULT, &smoothOption}, {TK_CONFIG_INT, "-splinesteps", NULL, NULL, - "12", Tk_Offset(PolygonItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT}, + "12", Tk_Offset(PolygonItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, fillStipple), TK_CONFIG_NULL_OK}, + NULL, Tk_Offset(PolygonItem, fillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, "1.0", Tk_Offset(PolygonItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, - {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0} + {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* @@ -160,10 +153,10 @@ static void ComputePolygonBbox(Tk_Canvas canvas, PolygonItem *polyPtr); static int ConfigurePolygon(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, - Tcl_Obj *CONST objv[], int flags); + Tcl_Obj *const objv[], int flags); static int CreatePolygon(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DeletePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayPolygon(Tk_Canvas canvas, @@ -174,7 +167,7 @@ static int GetPolygonIndex(Tcl_Interp *interp, Tcl_Obj *obj, int *indexPtr); static int PolygonCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void PolygonDeleteCoords(Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last); static void PolygonInsert(Tk_Canvas canvas, @@ -205,18 +198,19 @@ Tk_ItemType tkPolygonType = { PolygonCoords, /* coordProc */ DeletePolygon, /* deleteProc */ DisplayPolygon, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */ PolygonToPoint, /* pointProc */ PolygonToArea, /* areaProc */ PolygonToPostscript, /* postscriptProc */ ScalePolygon, /* scaleProc */ TranslatePolygon, /* translateProc */ - (Tk_ItemIndexProc *) GetPolygonIndex,/* indexProc */ + GetPolygonIndex, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ - (Tk_ItemInsertProc *) PolygonInsert,/* insertProc */ + PolygonInsert, /* insertProc */ PolygonDeleteCoords, /* dTextProc */ NULL, /* nextPtr */ + NULL, 0, NULL, NULL }; /* @@ -253,13 +247,13 @@ CreatePolygon( 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 polygon. */ + Tcl_Obj *const objv[]) /* Arguments describing polygon. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int i; if (objc == 0) { - Tcl_Panic("canvas did not pass any coords\n"); + Tcl_Panic("canvas did not pass any coords"); } /* @@ -267,7 +261,7 @@ CreatePolygon( * errors during the the remainder of this function. */ - Tk_CreateOutline(&(polyPtr->outline)); + Tk_CreateOutline(&polyPtr->outline); polyPtr->numPoints = 0; polyPtr->pointsAllocated = 0; polyPtr->coordPtr = NULL; @@ -293,7 +287,8 @@ CreatePolygon( */ for (i = 0; i < objc; i++) { - char *arg = Tcl_GetString(objv[i]); + const char *arg = Tcl_GetString(objv[i]); + if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { break; } @@ -336,7 +331,7 @@ PolygonCoords( 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, ... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int i, numPoints; @@ -363,50 +358,48 @@ PolygonCoords( } } if (objc & 1) { - char buf[64 + TCL_INTEGER_SPACE]; - - sprintf(buf, "wrong # coordinates: expected an even number, got %d", - objc); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "wrong # coordinates: expected an even number, got %d", + objc)); return TCL_ERROR; - } else { - numPoints = objc/2; - if (polyPtr->pointsAllocated <= numPoints) { - if (polyPtr->coordPtr != NULL) { - ckfree((char *) polyPtr->coordPtr); - } - - /* - * One extra point gets allocated here, because we always add - * another point to close the polygon. - */ + } - polyPtr->coordPtr = (double *) ckalloc((unsigned) - (sizeof(double) * (objc+2))); - polyPtr->pointsAllocated = numPoints+1; - } - for (i = objc-1; i >= 0; i--) { - if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[i], - &polyPtr->coordPtr[i]) != TCL_OK) { - return TCL_ERROR; - } + numPoints = objc/2; + if (polyPtr->pointsAllocated <= numPoints) { + if (polyPtr->coordPtr != NULL) { + ckfree(polyPtr->coordPtr); } - polyPtr->numPoints = numPoints; - polyPtr->autoClosed = 0; /* - * Close the polygon if it isn't already closed. + * One extra point gets allocated here, because we always add + * another point to close the polygon. */ - if (objc>2 && ((polyPtr->coordPtr[objc-2] != polyPtr->coordPtr[0]) - || (polyPtr->coordPtr[objc-1] != polyPtr->coordPtr[1]))) { - polyPtr->autoClosed = 1; - polyPtr->numPoints++; - polyPtr->coordPtr[objc] = polyPtr->coordPtr[0]; - polyPtr->coordPtr[objc+1] = polyPtr->coordPtr[1]; + polyPtr->coordPtr = ckalloc(sizeof(double) * (objc+2)); + polyPtr->pointsAllocated = numPoints+1; + } + for (i = objc-1; i >= 0; i--) { + if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[i], + &polyPtr->coordPtr[i]) != TCL_OK) { + return TCL_ERROR; } - ComputePolygonBbox(canvas, polyPtr); } + polyPtr->numPoints = numPoints; + polyPtr->autoClosed = 0; + + /* + * Close the polygon if it isn't already closed. + */ + + if (objc>2 && ((polyPtr->coordPtr[objc-2] != polyPtr->coordPtr[0]) + || (polyPtr->coordPtr[objc-1] != polyPtr->coordPtr[1]))) { + polyPtr->autoClosed = 1; + polyPtr->numPoints++; + polyPtr->coordPtr[objc] = polyPtr->coordPtr[0]; + polyPtr->coordPtr[objc+1] = polyPtr->coordPtr[1]; + } + + ComputePolygonBbox(canvas, polyPtr); return TCL_OK; } @@ -435,7 +428,7 @@ ConfigurePolygon( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Polygon item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; @@ -449,7 +442,7 @@ ConfigurePolygon( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (CONST char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS)) { + (const char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } @@ -471,15 +464,15 @@ ConfigurePolygon( itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; } - if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + if (state == TK_STATE_NULL) { + state = Canvas(canvas)->canvas_state; } - if (state==TK_STATE_HIDDEN) { + if (state == TK_STATE_HIDDEN) { ComputePolygonBbox(canvas, polyPtr); return TCL_OK; } - mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(polyPtr->outline)); + mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &polyPtr->outline); if (mask) { gcValues.cap_style = CapRound; gcValues.join_style = polyPtr->joinStyle; @@ -495,18 +488,18 @@ ConfigurePolygon( color = polyPtr->fillColor; stipple = polyPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (polyPtr->activeFillColor!=NULL) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { + if (polyPtr->activeFillColor != NULL) { color = polyPtr->activeFillColor; } - if (polyPtr->activeFillStipple!=None) { + if (polyPtr->activeFillStipple != None) { stipple = polyPtr->activeFillStipple; } - } else if (state==TK_STATE_DISABLED) { - if (polyPtr->disabledFillColor!=NULL) { + } else if (state == TK_STATE_DISABLED) { + if (polyPtr->disabledFillColor != NULL) { color = polyPtr->disabledFillColor; } - if (polyPtr->disabledFillStipple!=None) { + if (polyPtr->disabledFillStipple != None) { stipple = polyPtr->disabledFillStipple; } } @@ -526,7 +519,7 @@ ConfigurePolygon( * Mac OS X CG drawing needs access to the outline linewidth * even for fills (as linewidth controls antialiasing). */ - gcValues.line_width = polyPtr->outline.gc != None ? + gcValues.line_width = polyPtr->outline.gc != None ? polyPtr->outline.gc->line_width : 0; mask |= GCLineWidth; #endif @@ -576,9 +569,9 @@ DeletePolygon( { PolygonItem *polyPtr = (PolygonItem *) itemPtr; - Tk_DeleteOutline(display,&(polyPtr->outline)); + Tk_DeleteOutline(display, &polyPtr->outline); if (polyPtr->coordPtr != NULL) { - ckfree((char *) polyPtr->coordPtr); + ckfree(polyPtr->coordPtr); } if (polyPtr->fillColor != NULL) { Tk_FreeColor(polyPtr->fillColor); @@ -631,21 +624,22 @@ ComputePolygonBbox( Tk_State state = polyPtr->header.state; Tk_TSOffset *tsoffset; - if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + if (state == TK_STATE_NULL) { + state = Canvas(canvas)->canvas_state; } width = polyPtr->outline.width; - if (polyPtr->coordPtr == NULL || (polyPtr->numPoints < 1) || (state==TK_STATE_HIDDEN)) { + if (polyPtr->coordPtr == NULL || (polyPtr->numPoints < 1) + || (state == TK_STATE_HIDDEN)) { polyPtr->header.x1 = polyPtr->header.x2 = - polyPtr->header.y1 = polyPtr->header.y2 = -1; + polyPtr->header.y1 = polyPtr->header.y2 = -1; return; } - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)polyPtr) { - if (polyPtr->outline.activeWidth>width) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *) polyPtr) { + if (polyPtr->outline.activeWidth > width) { width = polyPtr->outline.activeWidth; } - } else if (state==TK_STATE_DISABLED) { - if (polyPtr->outline.disabledWidth>0.0) { + } else if (state == TK_STATE_DISABLED) { + if (polyPtr->outline.disabledWidth > 0.0) { width = polyPtr->outline.disabledWidth; } } @@ -671,6 +665,7 @@ ComputePolygonBbox( tsoffset = &polyPtr->tsoffset; if (tsoffset->flags & TK_OFFSET_INDEX) { int index = tsoffset->flags & ~TK_OFFSET_INDEX; + if (tsoffset->flags == INT_MAX) { index = (polyPtr->numPoints - polyPtr->autoClosed) * 2; if (index < 0) { @@ -678,7 +673,7 @@ ComputePolygonBbox( } } index %= (polyPtr->numPoints - polyPtr->autoClosed) * 2; - if (index <0) { + if (index < 0) { index += (polyPtr->numPoints - polyPtr->autoClosed) * 2; } tsoffset->xoffset = (int) (polyPtr->coordPtr[index] + 0.5); @@ -710,7 +705,7 @@ ComputePolygonBbox( index = (polyPtr->numPoints - 1) * 2; } index %= (polyPtr->numPoints - 1) * 2; - if (index <0) { + if (index < 0) { index += (polyPtr->numPoints - 1) * 2; } tsoffset->xoffset = (int) (polyPtr->coordPtr[index] + 0.5); @@ -719,21 +714,23 @@ ComputePolygonBbox( if (tsoffset->flags & TK_OFFSET_LEFT) { tsoffset->xoffset = polyPtr->header.x1; } else if (tsoffset->flags & TK_OFFSET_CENTER) { - tsoffset->xoffset = (polyPtr->header.x1 + polyPtr->header.x2)/2; + tsoffset->xoffset = + (polyPtr->header.x1 + polyPtr->header.x2) / 2; } else if (tsoffset->flags & TK_OFFSET_RIGHT) { tsoffset->xoffset = polyPtr->header.x2; } if (tsoffset->flags & TK_OFFSET_TOP) { tsoffset->yoffset = polyPtr->header.y1; } else if (tsoffset->flags & TK_OFFSET_MIDDLE) { - tsoffset->yoffset = (polyPtr->header.y1 + polyPtr->header.y2)/2; + tsoffset->yoffset = + (polyPtr->header.y1 + polyPtr->header.y2) / 2; } else if (tsoffset->flags & TK_OFFSET_BOTTOM) { tsoffset->yoffset = polyPtr->header.y2; } } } - i = (int) ((width+1.5)/2.0); + i = (int) ((width+1.5) / 2.0); polyPtr->header.x1 -= i; polyPtr->header.x2 += i; polyPtr->header.y1 -= i; @@ -750,19 +747,17 @@ ComputePolygonBbox( int j; coordPtr = polyPtr->coordPtr; - if (polyPtr->numPoints>3) { + if (polyPtr->numPoints > 3) { if (TkGetMiterPoints(coordPtr+2*(polyPtr->numPoints-2), - coordPtr, coordPtr+2, width, - miter, miter+2)) { + coordPtr, coordPtr+2, width, miter, miter+2)) { for (j = 0; j < 4; j += 2) { TkIncludePoint((Tk_Item *) polyPtr, miter+j); } } - } + } for (i = polyPtr->numPoints ; i >= 3; i--, coordPtr += 2) { - - if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4, - width, miter, miter+2)) { + if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4, width, + miter, miter+2)) { for (j = 0; j < 4; j += 2) { TkIncludePoint((Tk_Item *) polyPtr, miter+j); } @@ -829,7 +824,7 @@ TkFillPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = (XPoint *) ckalloc((unsigned) (numPoints * sizeof(XPoint))); + pointPtr = ckalloc(numPoints * sizeof(XPoint)); } for (i=0, pPtr=pointPtr ; i<numPoints; i+=1, coordPtr+=2, pPtr++) { @@ -842,16 +837,16 @@ TkFillPolygon( * allocated. */ - if (gc != None && numPoints>3) { + if (gc != None && numPoints > 3) { XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex, CoordModeOrigin); } if (outlineGC != None) { - XDrawLines(display, drawable, outlineGC, pointPtr, - numPoints, CoordModeOrigin); + XDrawLines(display, drawable, outlineGC, pointPtr, numPoints, + CoordModeOrigin); } if (pointPtr != staticPoints) { - ckfree((char *) pointPtr); + ckfree(pointPtr); } } @@ -894,17 +889,17 @@ DisplayPolygon( } if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (polyPtr->outline.activeWidth>linewidth) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { + if (polyPtr->outline.activeWidth > linewidth) { linewidth = polyPtr->outline.activeWidth; } if (polyPtr->activeFillStipple != None) { stipple = polyPtr->activeFillStipple; } - } else if (state==TK_STATE_DISABLED) { - if (polyPtr->outline.disabledWidth>0.0) { + } else if (state == TK_STATE_DISABLED) { + if (polyPtr->outline.disabledWidth > 0.0) { linewidth = polyPtr->outline.disabledWidth; } if (polyPtr->disabledFillStipple != None) { @@ -919,10 +914,11 @@ DisplayPolygon( if ((stipple != None) && (polyPtr->fillGC != None)) { Tk_TSOffset *tsoffset = &polyPtr->tsoffset; - int w=0; int h=0; + int w = 0, h = 0; int flags = tsoffset->flags; - if (!(flags & TK_OFFSET_INDEX) && (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) { + if (!(flags & TK_OFFSET_INDEX) + && (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) { Tk_SizeOfBitmap(display, stipple, &w, &h); if (flags & TK_OFFSET_CENTER) { w /= 2; @@ -941,20 +937,20 @@ DisplayPolygon( tsoffset->xoffset += w; tsoffset->yoffset += h; } - Tk_ChangeOutlineGC(canvas, itemPtr, &(polyPtr->outline)); + Tk_ChangeOutlineGC(canvas, itemPtr, &polyPtr->outline); - if(polyPtr->numPoints < 3) { - short x,y; + if (polyPtr->numPoints < 3) { + short x, y; int intLineWidth = (int) (linewidth + 0.5); if (intLineWidth < 1) { intLineWidth = 1; } Tk_CanvasDrawableCoords(canvas, polyPtr->coordPtr[0], - polyPtr->coordPtr[1], &x,&y); + polyPtr->coordPtr[1], &x, &y); XFillArc(display, drawable, polyPtr->outline.gc, x - intLineWidth/2, y - intLineWidth/2, - (unsigned int)intLineWidth+1, (unsigned int)intLineWidth+1, + (unsigned) intLineWidth+1, (unsigned) intLineWidth+1, 0, 64*360); } else if (!polyPtr->smooth || polyPtr->numPoints < 4) { TkFillPolygon(canvas, polyPtr->coordPtr, polyPtr->numPoints, @@ -974,8 +970,7 @@ DisplayPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = (XPoint *) ckalloc((unsigned) - (numPoints * sizeof(XPoint))); + pointPtr = ckalloc(numPoints * sizeof(XPoint)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL); @@ -988,10 +983,10 @@ DisplayPolygon( numPoints, CoordModeOrigin); } if (pointPtr != staticPoints) { - ckfree((char *) pointPtr); + ckfree(pointPtr); } } - Tk_ResetOutlineGC(canvas, itemPtr, &(polyPtr->outline)); + Tk_ResetOutlineGC(canvas, itemPtr, &polyPtr->outline); if ((stipple != None) && (polyPtr->fillGC != None)) { XSetTSOrigin(display, polyPtr->fillGC, 0, 0); } @@ -1028,7 +1023,7 @@ PolygonInsert( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK) @@ -1036,21 +1031,20 @@ PolygonInsert( return; } length = 2*(polyPtr->numPoints - polyPtr->autoClosed); - while (beforeThis>length) { + while (beforeThis > length) { beforeThis -= length; } - while (beforeThis<0) { + while (beforeThis < 0) { beforeThis += length; } - newCoordPtr = (double *) - ckalloc(sizeof(double) * (unsigned)(length + 2 + objc)); + newCoordPtr = ckalloc(sizeof(double) * (length + 2 + objc)); for (i=0; i<beforeThis; i++) { newCoordPtr[i] = polyPtr->coordPtr[i]; } for (i=0; i<objc; i++) { if (Tcl_GetDoubleFromObj(NULL, objv[i], &newCoordPtr[i+beforeThis]) != TCL_OK){ - ckfree((char *) newCoordPtr); + ckfree(newCoordPtr); return; } } @@ -1059,7 +1053,7 @@ PolygonInsert( newCoordPtr[i+objc] = polyPtr->coordPtr[i]; } if (polyPtr->coordPtr) { - ckfree((char *) polyPtr->coordPtr); + ckfree(polyPtr->coordPtr); } length += objc; polyPtr->coordPtr = newCoordPtr; @@ -1086,7 +1080,7 @@ PolygonInsert( newCoordPtr[length] = newCoordPtr[0]; newCoordPtr[length+1] = newCoordPtr[1]; - if (((length-objc)>3) && (state != TK_STATE_HIDDEN)) { + if ((length-objc > 3) && (state != TK_STATE_HIDDEN)) { /* * This is some optimizing code that will result that only the part of * the polygon that changed (and the objects that are overlapping with @@ -1098,6 +1092,7 @@ PolygonInsert( double width; int j; + itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW; /* @@ -1109,10 +1104,11 @@ PolygonInsert( itemPtr->x1 = itemPtr->x2 = (int) polyPtr->coordPtr[beforeThis]; itemPtr->y1 = itemPtr->y2 = (int) polyPtr->coordPtr[beforeThis+1]; - beforeThis-=2; objc+=4; + beforeThis -= 2; + objc += 4; if (polyPtr->smooth) { - beforeThis-=2; - objc+=4; + beforeThis -= 2; + objc += 4; } /* @@ -1121,25 +1117,27 @@ PolygonInsert( for (i=beforeThis; i<beforeThis+objc; i+=2) { j = i; - if (j<0) { + if (j < 0) { j += length; - } else if (j>=length) { + } else if (j >= length) { j -= length; } TkIncludePoint(itemPtr, polyPtr->coordPtr+j); } width = polyPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (polyPtr->outline.activeWidth > width) { width = polyPtr->outline.activeWidth; } - } else if (state==TK_STATE_DISABLED) { + } else if (state == TK_STATE_DISABLED) { if (polyPtr->outline.disabledWidth > 0.0) { width = polyPtr->outline.disabledWidth; } } - itemPtr->x1 -= (int) width; itemPtr->y1 -= (int) width; - itemPtr->x2 += (int) width; itemPtr->y2 += (int) width; + itemPtr->x1 -= (int) width; + itemPtr->y1 -= (int) width; + itemPtr->x2 += (int) width; + itemPtr->y2 += (int) width; Tk_CanvasEventuallyRedraw(canvas, itemPtr->x1, itemPtr->y1, itemPtr->x2, itemPtr->y2); } @@ -1175,16 +1173,16 @@ PolygonDeleteCoords( int count, i; int length = 2*(polyPtr->numPoints - polyPtr->autoClosed); - while (first>=length) { + while (first >= length) { first -= length; } - while (first<0) { + while (first < 0) { first += length; } - while (last>=length) { + while (last >= length) { last -= length; } - while (last<0) { + while (last < 0) { last += length; } @@ -1192,25 +1190,25 @@ PolygonDeleteCoords( last &= -2; count = last + 2 - first; - if (count<=0) { + if (count <= 0) { count += length; } if (count >= length) { polyPtr->numPoints = 0; if (polyPtr->coordPtr != NULL) { - ckfree((char *) polyPtr->coordPtr); + ckfree(polyPtr->coordPtr); } ComputePolygonBbox(canvas, polyPtr); return; } - if (last>=first) { - for(i=last+2; i<length; i++) { + if (last >= first) { + for (i=last+2; i<length; i++) { polyPtr->coordPtr[i-count] = polyPtr->coordPtr[i]; } } else { - for(i=last; i<=first; i++) { + for (i=last; i<=first; i++) { polyPtr->coordPtr[i-last] = polyPtr->coordPtr[i]; } } @@ -1263,15 +1261,15 @@ PolygonToPoint( bestDist = 1.0e36; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = polyPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (polyPtr->outline.activeWidth>width) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { + if (polyPtr->outline.activeWidth > width) { width = polyPtr->outline.activeWidth; } - } else if (state==TK_STATE_DISABLED) { - if (polyPtr->outline.disabledWidth>0.0) { + } else if (state == TK_STATE_DISABLED) { + if (polyPtr->outline.disabledWidth > 0.0) { width = polyPtr->outline.disabledWidth; } } @@ -1282,26 +1280,23 @@ PolygonToPoint( * against which to do the check. */ - if ((polyPtr->smooth) && (polyPtr->numPoints>2)) { + if ((polyPtr->smooth) && (polyPtr->numPoints > 2)) { numPoints = polyPtr->smooth->coordProc(canvas, NULL, - polyPtr->numPoints, polyPtr->splineSteps, NULL, - NULL); + polyPtr->numPoints, polyPtr->splineSteps, NULL, NULL); if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = (double *) ckalloc((unsigned) - (2*numPoints*sizeof(double))); + polyPoints = ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, - polyPtr->numPoints, polyPtr->splineSteps, NULL, - polyPoints); + polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); } else { numPoints = polyPtr->numPoints; polyPoints = polyPtr->coordPtr; } bestDist = TkPolygonToPoint(polyPoints, numPoints, pointPtr); - if (bestDist<=0.0) { + if (bestDist <= 0.0) { goto donepoint; } if ((polyPtr->outline.gc != None) && (polyPtr->joinStyle == JoinRound)) { @@ -1351,16 +1346,16 @@ PolygonToPoint( */ if (count == numPoints) { - TkGetButtPoints(coordPtr+2, coordPtr, (double) width, - 0, poly, poly+2); + TkGetButtPoints(coordPtr+2, coordPtr, (double) width, 0, poly, + poly+2); } else if ((polyPtr->joinStyle == JoinMiter) && !changedMiterToBevel) { poly[0] = poly[6]; poly[1] = poly[7]; poly[2] = poly[4]; poly[3] = poly[5]; } else { - TkGetButtPoints(coordPtr+2, coordPtr, (double) width, 0, - poly, poly+2); + TkGetButtPoints(coordPtr+2, coordPtr, (double) width, 0, poly, + poly+2); /* * If this line uses beveled joints, then check the distance to a @@ -1383,8 +1378,8 @@ PolygonToPoint( } } if (count == 2) { - TkGetButtPoints(coordPtr, coordPtr+2, (double) width, - 0, poly+4, poly+6); + TkGetButtPoints(coordPtr, coordPtr+2, (double) width, 0, poly+4, + poly+6); } else if (polyPtr->joinStyle == JoinMiter) { if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4, (double) width, poly+4, poly+6) == 0) { @@ -1393,8 +1388,8 @@ PolygonToPoint( poly+4, poly+6); } } else { - TkGetButtPoints(coordPtr, coordPtr+2, (double) width, 0, - poly+4, poly+6); + TkGetButtPoints(coordPtr, coordPtr+2, (double) width, 0, poly+4, + poly+6); } poly[8] = poly[0]; poly[9] = poly[1]; @@ -1408,8 +1403,8 @@ PolygonToPoint( } donepoint: - if ((polyPoints != staticSpace) && polyPoints != polyPtr->coordPtr) { - ckfree((char *) polyPoints); + if (polyPoints != staticSpace && polyPoints != polyPtr->coordPtr) { + ckfree(polyPoints); } return bestDist; } @@ -1460,16 +1455,16 @@ PolygonToArea( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = polyPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (polyPtr->outline.activeWidth>width) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { + if (polyPtr->outline.activeWidth > width) { width = polyPtr->outline.activeWidth; } - } else if (state==TK_STATE_DISABLED) { - if (polyPtr->outline.disabledWidth>0.0) { + } else if (state == TK_STATE_DISABLED) { + if (polyPtr->outline.disabledWidth > 0.0) { width = polyPtr->outline.disabledWidth; } } @@ -1477,9 +1472,9 @@ PolygonToArea( radius = width/2.0; inside = -1; - if ((state==TK_STATE_HIDDEN) || polyPtr->numPoints<2) { + if ((state == TK_STATE_HIDDEN) || polyPtr->numPoints < 2) { return -1; - } else if (polyPtr->numPoints <3) { + } else if (polyPtr->numPoints < 3) { double oval[4]; oval[0] = polyPtr->coordPtr[0]-radius; @@ -1500,8 +1495,7 @@ PolygonToArea( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = (double *) - ckalloc((unsigned) (2*numPoints*sizeof(double))); + polyPoints = ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1517,7 +1511,7 @@ PolygonToArea( */ inside = TkPolygonToArea(polyPoints, numPoints, rectPtr); - if (inside==0) { + if (inside == 0) { goto donearea; } @@ -1586,8 +1580,8 @@ PolygonToArea( if (count == 2) { TkGetButtPoints(coordPtr, coordPtr+2, width, 0, poly+4, poly+6); } else if (polyPtr->joinStyle == JoinMiter) { - if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4, - width, poly+4, poly+6) == 0) { + if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4, width, + poly+4, poly+6) == 0) { changedMiterToBevel = 1; TkGetButtPoints(coordPtr, coordPtr+2, width,0, poly+4, poly+6); } @@ -1604,7 +1598,7 @@ PolygonToArea( donearea: if ((polyPoints != staticSpace) && (polyPoints != polyPtr->coordPtr)) { - ckfree((char *) polyPoints); + ckfree(polyPoints); } return inside; } @@ -1680,26 +1674,18 @@ GetPolygonIndex( { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int length; - char *string = Tcl_GetStringFromObj(obj, &length); + const char *string = Tcl_GetStringFromObj(obj, &length); if (string[0] == 'e') { - if (strncmp(string, "end", (unsigned)length) == 0) { - *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed); - } else { - /* - * Some of the paths here leave messages in interp->result, so we - * have to clear it out before storing our own message. - */ - - badIndex: - Tcl_SetResult(interp, NULL, TCL_STATIC); - Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL); - return TCL_ERROR; + if (strncmp(string, "end", (unsigned)length) != 0) { + goto badIndex; } + *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed); } else if (string[0] == '@') { int i; - double x ,y, bestDist, dist, *coordPtr; - char *end, *p; + double x, y, bestDist, dist, *coordPtr; + char *end; + const char *p; p = string+1; x = strtod(p, &end); @@ -1714,9 +1700,9 @@ GetPolygonIndex( bestDist = 1.0e36; coordPtr = polyPtr->coordPtr; *indexPtr = 0; - for(i=0; i<(polyPtr->numPoints-1); i++) { + for (i=0; i<polyPtr->numPoints-1; i++) { dist = hypot(coordPtr[0] - x, coordPtr[1] - y); - if (dist<bestDist) { + if (dist < bestDist) { bestDist = dist; *indexPtr = 2*i; } @@ -1729,17 +1715,24 @@ GetPolygonIndex( goto badIndex; } *indexPtr &= -2; /* if odd, make it even */ - if (count) { - if (*indexPtr > 0) { - *indexPtr = ((*indexPtr - 2) % count) + 2; - } else { - *indexPtr = -((-(*indexPtr)) % count); - } - } else { + if (!count) { *indexPtr = 0; + } else if (*indexPtr > 0) { + *indexPtr = ((*indexPtr - 2) % count) + 2; + } else { + *indexPtr = -((-(*indexPtr)) % count); } } return TCL_OK; + + /* + * Some of the paths here leave messages in interp->result, so we have to + * clear it out before storing our own message. + */ + + badIndex: + Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string)); + return TCL_ERROR; } /* @@ -1807,7 +1800,7 @@ PolygonToPostscript( * being created. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; - char *style; + const char *style; XColor *color; XColor *fillColor; Pixmap stipple; @@ -1815,62 +1808,76 @@ PolygonToPostscript( Tk_State state = itemPtr->state; double width; - if (polyPtr->numPoints<2 || polyPtr->coordPtr==NULL) { + if (polyPtr->numPoints < 2 || polyPtr->coordPtr == NULL) { return TCL_OK; } - if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + if (state == TK_STATE_NULL) { + state = Canvas(canvas)->canvas_state; } width = polyPtr->outline.width; color = polyPtr->outline.color; stipple = polyPtr->fillStipple; fillColor = polyPtr->fillColor; fillStipple = polyPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (polyPtr->outline.activeWidth>width) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { + if (polyPtr->outline.activeWidth > width) { width = polyPtr->outline.activeWidth; } - if (polyPtr->outline.activeColor!=NULL) { + if (polyPtr->outline.activeColor != NULL) { color = polyPtr->outline.activeColor; } - if (polyPtr->outline.activeStipple!=None) { + if (polyPtr->outline.activeStipple != None) { stipple = polyPtr->outline.activeStipple; } - if (polyPtr->activeFillColor!=NULL) { + if (polyPtr->activeFillColor != NULL) { fillColor = polyPtr->activeFillColor; } - if (polyPtr->activeFillStipple!=None) { + if (polyPtr->activeFillStipple != None) { fillStipple = polyPtr->activeFillStipple; } - } else if (state==TK_STATE_DISABLED) { - if (polyPtr->outline.disabledWidth>0.0) { + } else if (state == TK_STATE_DISABLED) { + if (polyPtr->outline.disabledWidth > 0.0) { width = polyPtr->outline.disabledWidth; } - if (polyPtr->outline.disabledColor!=NULL) { + if (polyPtr->outline.disabledColor != NULL) { color = polyPtr->outline.disabledColor; } - if (polyPtr->outline.disabledStipple!=None) { + if (polyPtr->outline.disabledStipple != None) { stipple = polyPtr->outline.disabledStipple; } - if (polyPtr->disabledFillColor!=NULL) { + if (polyPtr->disabledFillColor != NULL) { fillColor = polyPtr->disabledFillColor; } - if (polyPtr->disabledFillStipple!=None) { + if (polyPtr->disabledFillStipple != None) { fillStipple = polyPtr->disabledFillStipple; } } - if (polyPtr->numPoints==2) { - char string[128]; + if (polyPtr->numPoints == 2) { if (color == NULL) { return TCL_OK; } - sprintf(string, "%.15g %.15g translate %.15g %.15g", - polyPtr->coordPtr[0], Tk_CanvasPsY(canvas, polyPtr->coordPtr[1]), - width/2.0, width/2.0); - Tcl_AppendResult(interp, "matrix currentmatrix\n",string, - " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", NULL); + /* + * Create a point by using a small circle. (Printer pixels are too + * tiny to be used directly...) + */ + + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "matrix currentmatrix\n" /* save state */ + "%.15g %.15g translate " /* go to drawing location */ + "%.15g %.15g scale " /* scale the drawing */ + "1 0 moveto " /* correct for origin */ + "0 0 1 0 360 arc\n" /* make the circle */ + "setmatrix\n", /* restore state */ + polyPtr->coordPtr[0], + Tk_CanvasPsY(canvas, polyPtr->coordPtr[1]), + width/2.0, width/2.0)); + + /* + * Color it in. + */ + if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } @@ -1889,7 +1896,7 @@ PolygonToPostscript( * Fill the area of the polygon. */ - if (fillColor != NULL && polyPtr->numPoints>3) { + if (fillColor != NULL && polyPtr->numPoints > 3) { if (!polyPtr->smooth || !polyPtr->smooth->postscriptProc) { Tk_CanvasPsPath(interp, canvas, polyPtr->coordPtr, polyPtr->numPoints); @@ -1933,9 +1940,8 @@ PolygonToPostscript( } else { style = "0"; } - Tcl_AppendResult(interp, style," setlinejoin 1 setlinecap\n", NULL); - if (Tk_CanvasPsOutline(canvas, itemPtr, - &(polyPtr->outline)) != TCL_OK) { + Tcl_AppendResult(interp, style, " setlinejoin 1 setlinecap\n", NULL); + if (Tk_CanvasPsOutline(canvas, itemPtr, &polyPtr->outline) != TCL_OK){ return TCL_ERROR; } } |