## Tcl8.6.17/Tk8.6.17 Documentation > Tk C API > GetPixels

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

  NAME
    Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM — 文字列と画面単位の間の翻訳　 translate between strings and screen units
  SYNOPSIS
    #include <tk.h>
    int
    Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr)
    int
    Tk_GetPixels(interp, tkwin, string, intPtr)
    int
    Tk_GetMMFromObj(interp, tkwin, objPtr, doublePtr)
    int
    Tk_GetScreenMM(interp, tkwin, string, doublePtr)
  引数 ARGUMENTS
    Tcl_Interp *interp (入力in)
    Tk_Window tkwin (入力in)
    Tcl_Obj *objPtr (入出力in/out)
    const char *string (入力in)
    int *intPtr (出力out)
    double *doublePtr (出力out)
  説明 DESCRIPTION
    <none>
    c
    i
    m
    p
  KEYWORDS

### NAME

Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM — 文字列と画面単位の間の翻訳　 translate between strings and screen units

### SYNOPSIS

#include <tk.h>
int
Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr)
int
Tk_GetPixels(interp, tkwin, string, intPtr)
int
Tk_GetMMFromObj(interp, tkwin, objPtr, doublePtr)
int
Tk_GetScreenMM(interp, tkwin, string, doublePtr)

### 引数 ARGUMENTS

Tcl_Interp *interp (入力in)
  不都合の報告に使う為の解釈実行機能｡ Interpreter to use for error reporting.

Tk_Window tkwin (入力in)
  その画面幾何が絶対単位と画素数の間の変換を定める､窓｡　 Window whose screen geometry determines the conversion between absolute units and pixels.

Tcl_Obj *objPtr (入出力in/out)
  画面上の距離を指定する文字列; 内部代表は対応する 変換された距離への高速記憶域への指示子を修正する｡　　 String value specifies a distance on the screen; internal rep will be modified to cache converted distance.

const char *string (入力in)
  objPtr と同一､但し､距離の指定は文字列として手渡される｡　 Same as objPtr except specification of distance is passed as a string.

int *intPtr (出力out)
  変換された画素単位の距離が保存される場所への指示子｡　 Pointer to location in which to store converted distance in pixels.

double *doublePtr (出力out)
  変換された粍メートル単位の距離が保存される場所への指示子｡　 Pointer to location in which to store converted distance in millimeters.

### 説明 DESCRIPTION

これ等の手続函数は引数として画面上の距離の指定を取り( objPtr 又は文字列)､対応する距離を整数画素か浮動小数ミリで計算する｡どちらの場合も objPtr か string は画面の距離を単位を指示する次の文字を続けた浮動小数点数として指し示す: These procedures take as argument a specification of distance on the screen (objPtr or string) and compute the corresponding distance either in integer pixels or floating-point millimeters. In either case, objPtr or string 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 pixels.

c
  数は画面上の糎単位の距離を指定する｡ The number specifies a distance in centimeters on the screen.

i
  数は画面上の吋単位の距離を指定する｡ The number specifies a distance in inches on the screen.

m
  数は画面上の粍単位の距離を指定する｡ The number specifies a distance in millimeters on the screen.

p
  数は画面上の印刷機のポイント(1/72 吋)単位の距離を指定する｡ The number specifies a distance in printer's points (1/72 inch) on the screen.

Tk_GetPixelsFromObj は objPtr の値を最も近い画素の偶数の数に変換しその値を *intPtr の箇所に保存する｡それは通常の状況下では TCL_OK を返す｡もし不都合が生じると(譬えば､ objPtr に上記の文字以外の文字を伴う数字が続く) TCL_ERROR が返され､もし解釈実行機能が NULL でなければ､不都合伝言文が解釈実行機能の結果内に残される｡ Tk_GetPixelsFromObj は objPtr 内の返り値に関する情報を高速記憶する､それは将来の同じ objPtr を伴う Tk_GetPixelsFromObj への呼出しを加速する｡ 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 occurs (e.g. objPtr contains a number followed by a character that is not one of the ones above) then TCL_ERROR is returned and an error message is left in interp's result if interp is not NULL. Tk_GetPixelsFromObj caches information about the return value in objPtr, which speeds up future calls to Tk_GetPixelsFromObj with the same objPtr.

Tk_GetPixels は画面距離が対象の代りに文字で指定されることを除き Tk_GetPixelsFromObj と同じである｡これは返り値を高速記憶から Tk_GetPixels を保護しているので､ Tk_GetPixels はTk_GetPixelsFromObj より効率は見劣りする｡ Tk_GetPixels is identical to Tk_GetPixelsFromObj except that the screen distance is specified with a string instead of an object. This prevents Tk_GetPixels from caching the return value, so Tk_GetPixels is less efficient than Tk_GetPixelsFromObj.

Tk_GetMMFromObj と Tk_GetScreenMM は画面距離から粍に変換し倍精度浮動小数結果を *doublePtr の箇所に保存する処を除き Tk_GetPixelsFromObj と Tk_GetPixels (それぞれ)と同じである｡ 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
Copyright © 1990 The Regents of the University of California.
Copyright © 1994-1998 Sun Microsystems, Inc.