CanvTkwin.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:6k
源码类别:

通讯编程

开发平台:

Visual C++

  1. '"
  2. '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
  3. '"
  4. '" See the file "license.terms" for information on usage and redistribution
  5. '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  6. '" 
  7. '" RCS: @(#) $Id: CanvTkwin.3,v 1.3 2002/01/25 21:09:36 dgp Exp $
  8. '" 
  9. .so man.macros
  10. .TH Tk_CanvasTkwin 3 4.1 Tk "Tk Library Procedures"
  11. .BS
  12. .SH NAME
  13. Tk_CanvasTkwin, Tk_CanvasGetCoord, Tk_CanvasDrawableCoords, Tk_CanvasSetStippleOrigin, Tk_CanvasWindowCoords, Tk_CanvasEventuallyRedraw, Tk_CanvasTagsOption - utility procedures for canvas type managers
  14. .SH SYNOPSIS
  15. .nf
  16. fB#include <tk.h>fR
  17. .sp
  18. Tk_Window
  19. fBTk_CanvasTkwinfR(fIcanvasfR)
  20. .sp
  21. int
  22. fBTk_CanvasGetCoordfR(fIinterp, canvas, string, doublePtrfR)
  23. .sp
  24. fBTk_CanvasDrawableCoordsfR(fIcanvas, x, y, drawableXPtr, drawableYPtrfR)
  25. .sp
  26. fBTk_CanvasSetStippleOriginfR(fIcanvas, gcfR)
  27. .sp
  28. fBTk_CanvasWindowCoordsfR(fIcanvas, x, y, screenXPtr, screenYPtrfR)
  29. .sp
  30. fBTk_CanvasEventuallyRedrawfR(fIcanvas, x1, y1, x2, y2fR)
  31. .sp
  32. Tk_OptionParseProc *fBTk_CanvasTagsParseProcfR;
  33. .sp
  34. Tk_OptionPrintProc *fBTk_CanvasTagsPrintProcfR;
  35. .SH ARGUMENTS
  36. .AS Tk_ItemType *drawableXPtr
  37. .AP Tk_Canvas canvas in
  38. A token that identifies a canvas widget.
  39. .AP Tcl_Interp *interp in/out
  40. Interpreter to use for error reporting.
  41. .AP "CONST char" *string in
  42. Textual description of a canvas coordinate.
  43. .AP double *doublePtr out
  44. Points to place to store a converted coordinate.
  45. .AP double x in
  46. An x coordinate in the space of the canvas.
  47. .AP double y in
  48. A y coordinate in the space of the canvas.
  49. .AP short *drawableXPtr out
  50. Pointer to a location in which to store an x coordinate in the space
  51. of the drawable currently being used to redisplay the canvas.
  52. .AP short *drawableYPtr out
  53. Pointer to a location in which to store a y coordinate in the space
  54. of the drawable currently being used to redisplay the canvas.
  55. .AP GC gc out
  56. Graphics context to modify.
  57. .AP short *screenXPtr out
  58. Points to a location in which to store the screen coordinate in the
  59. canvas window that corresponds to fIxfR.
  60. .AP short *screenYPtr out
  61. Points to a location in which to store the screen coordinate in the
  62. canvas window that corresponds to fIyfR.
  63. .AP int x1 in
  64. Left edge of the region that needs redisplay.  Only pixels at or to
  65. the right of this coordinate need to be redisplayed.
  66. .AP int y1 in
  67. Top edge of the region that needs redisplay.  Only pixels at or below
  68. this coordinate need to be redisplayed.
  69. .AP int x2 in
  70. Right edge of the region that needs redisplay.  Only pixels to
  71. the left of this coordinate need to be redisplayed.
  72. .AP int y2 in
  73. Bottom edge of the region that needs redisplay.  Only pixels above
  74. this coordinate need to be redisplayed.
  75. .BE
  76. .SH DESCRIPTION
  77. .PP
  78. These procedures are called by canvas type managers to perform various
  79. utility functions.
  80. .PP
  81. fBTk_CanvasTkwinfR returns the Tk_Window associated with a particular
  82. canvas.
  83. .PP
  84. fBTk_CanvasGetCoordfR translates a string specification of a
  85. coordinate (such as fB2pfR or fB1.6cfR) into a double-precision
  86. canvas coordinate.
  87. If fIstringfR is a valid coordinate description then fBTk_CanvasGetCoordfR
  88. stores the corresponding canvas coordinate at *fIdoublePtrfR
  89. and returns TCL_OK.
  90. Otherwise it stores an error message in fIinterp->resultfR and
  91. returns TCL_ERROR.
  92. .PP
  93. fBTk_CanvasDrawableCoordsfR is called by type managers during
  94. redisplay to compute where to draw things.
  95. Given fIxfR and fIyfR coordinates in the space of the
  96. canvas, fBTk_CanvasDrawableCoordsfR computes the corresponding
  97. pixel in the drawable that is currently being used for redisplay;
  98. it returns those coordinates in *fIdrawableXPtrfR and *fIdrawableYPtrfR.
  99. This procedure should not be invoked except during redisplay.
  100. .PP
  101. fBTk_CanvasSetStippleOriginfR is also used during redisplay.
  102. It sets the stipple origin in fIgcfR so that stipples drawn
  103. with fIgcfR in the current offscreen pixmap will line up
  104. with stipples drawn with origin (0,0) in the canvas's actual
  105. window.
  106. fBTk_CanvasSetStippleOriginfR is needed in order to guarantee
  107. that stipple patterns line up properly when the canvas is
  108. redisplayed in small pieces.
  109. Redisplays are carried out in double-buffered fashion where a
  110. piece of the canvas is redrawn in an offscreen pixmap and then
  111. copied back onto the screen.
  112. In this approach the stipple origins in graphics contexts need to
  113. be adjusted during each redisplay to compensate for the position
  114. of the off-screen pixmap relative to the window.
  115. If an item is being drawn with stipples, its type manager typically
  116. calls fBTk_CanvasSetStippleOriginfR just before using fIgcfR
  117. to draw something;  after it is finished drawing, the type manager
  118. calls fBXSetTSOriginfR to restore the origin in fIgcfR back to (0,0)
  119. (the restore is needed because graphics contexts are shared, so
  120. they cannot be modified permanently).
  121. .PP
  122. fBTk_CanvasWindowCoordsfR is similar to fBTk_CanvasDrawableCoordsfR
  123. except that it returns coordinates in the canvas's window on the
  124. screen, instead of coordinates in an off-screen pixmap.
  125. .PP
  126. fBTk_CanvasEventuallyRedrawfR may be invoked by a type manager
  127. to inform Tk that a portion of a canvas needs to be redrawn.
  128. The fIx1fR, fIy1fR, fIx2fR, and fIy2fR arguments
  129. specify the region that needs to be redrawn, in canvas coordinates.
  130. Type managers rarely need to invoke fBTk_CanvasEventuallyRedrawfR,
  131. since Tk can normally figure out when an item has changed and make
  132. the redisplay request on its behalf (this happens, for example
  133. whenever Tk calls a fIconfigureProcfR or fIscaleProcfR).
  134. The only time that a type manager needs to call
  135. fBTk_CanvasEventuallyRedrawfR is if an item has changed on its own
  136. without being invoked through one of the procedures in its Tk_ItemType;
  137. this could happen, for example, in an image item if the image is
  138. modified using image commands.
  139. .PP
  140. fBTk_CanvasTagsParseProcfR and fBTk_CanvasTagsPrintProcfR are
  141. procedures that handle the fB-tagsfR option for canvas items.
  142. The code of a canvas type manager won't call these procedures
  143. directly, but will use their addresses to create a fBTk_CustomOptionfR
  144. structure for the fB-tagsfR option.   The code typically looks
  145. like this:
  146. .CS
  147. static Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
  148. Tk_CanvasTagsPrintProc, (ClientData) NULL
  149. };
  150. static Tk_ConfigSpec configSpecs[] = {
  151. ...
  152. {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
  153. (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
  154. ...
  155. };
  156. .CE
  157. .SH KEYWORDS
  158. canvas, focus, item type, redisplay, selection, type manager