int TkPixelParseProc( ClientData clientData, /* If non-NULL, negative values are allowed as * well */ Tcl_Interp *interp, /* Interpreter to send results back to */ Tk_Window tkwin, /* Window on same display as tile */ const char *value, /* Name of image */ char *widgRec, /* Widget structure record */ int offset) /* Offset of tile in record */ { double *doublePtr = (double *) (widgRec + offset); int result; result = TkGetDoublePixels(interp, tkwin, value, doublePtr); if ((result == TCL_OK) && (clientData == NULL) && (*doublePtr < 0.0)) { Tcl_AppendResult(interp, "bad screen distance \"", value, "\"", NULL); return TCL_ERROR; } return result; }
int Tk_GetPixels( Tcl_Interp *interp, /* Use this for error reporting. */ Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ const char *string, /* String describing a number of pixels. */ int *intPtr) /* Place to store converted result. */ { double d; if (TkGetDoublePixels(interp, tkwin, string, &d) != TCL_OK) { return TCL_ERROR; } if (d < 0) { *intPtr = (int) (d - 0.5); } else { *intPtr = (int) (d + 0.5); } return TCL_OK; }