Tk_GetPixelsFromObj(3) Tk Library Procedures Tk_GetPixelsFromObj(3) ______________________________________________________________________________ NAME Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM - translate between strings and screen units(1,7) SYNOPSIS #include <tk.h> int | Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr) | int Tk_GetPixels(interp, tkwin, string(3,n), intPtr) int | Tk_GetMMFromObj(interp, tkwin, objPtr, doublePtr) | int Tk_GetScreenMM(interp, tkwin, string(3,n), doublePtr) ARGUMENTS Tcl_Interp *interp (in(1,8)) Interpreter to use for error(8,n) report- ing. Tk_Window tkwin (in(1,8)) Window whose screen geometry deter- mines the conversion between absolute units(1,7) and pixels. Tcl_Obj *objPtr (in(1,8)/out) || String value specifies a distance on | the screen; internal rep will be mod- | ified to cache converted distance. | CONST | char *string(3,n) (in(1,8)) | | Same as objPtr except specification | of distance is passed as a string. int *intPtr (out) Pointer to location in(1,8) which to store converted distance in(1,8) pixels. double *doublePtr (out) Pointer to location in(1,8) which to store converted distance in(1,8) millimeters. _________________________________________________________________ DESCRIPTION These procedures take as argument a specification of distance on the | screen (objPtr or string(3,n)) and compute the corresponding distance either in(1,8) integer pixels or floating-point millimeters. In either case, | objPtr or string(3,n) specifies a screen distance as a floating-point number followed by one of the following characters that indicates units: <none> The number specifies a distance in(1,8) pixels. c The number specifies a distance in(1,8) centimeters on the screen. i The number specifies a distance in(1,8) inches on the screen. m The number specifies a distance in(1,8) millimeters on the screen. p The number specifies a distance in(1,8) printer's points (1/72 inch) on the screen. Tk_GetPixelsFromObj converts the value of objPtr to the nearest even | number of pixels and stores that value at *intPtr. It returns TCL_OK | under normal circumstances. If an error(8,n) occurs (e.g. objPtr contains a | number followed by a character that isn't one of the ones above) then | TCL_ERROR is returned and an error(8,n) message is left in(1,8) interp's result | if(3,n) interp isn't NULL. Tk_GetPixelsFromObj caches information about the | return value in(1,8) objPtr, which speeds up future calls to Tk_GetPixels- | FromObj with the same objPtr. | Tk_GetPixels is identical to Tk_GetPixelsFromObj except that the screen | distance is specified with a string(3,n) instead of an object. This pre- | vents Tk_GetPixels from caching the return value, so Tk_GetAnchor is | less(1,3) efficient than Tk_GetPixelsFromObj. | Tk_GetMMFromObj and Tk_GetScreenMM are similar to Tk_GetPixelsFromObj | and Tk_GetPixels (respectively) except that they convert the screen | distance to millimeters and store a double-precision floating-point | result at *doublePtr. KEYWORDS centimeters, convert, inches, millimeters, pixels, points, screen units(1,7) Tk 8.1 Tk_GetPixelsFromObj(3)