1Tk_CanvasPs(3) Tk Library Procedures Tk_CanvasPs(3)
2
3
4
5______________________________________________________________________________
6
8 Tk_CanvasPsY, Tk_CanvasPsBitmap, Tk_CanvasPsColor, Tk_CanvasPsFont,
9 Tk_CanvasPsPath, Tk_CanvasPsStipple - utility procedures for generating
10 Postscript for canvases
11
13 #include <tk.h>
14
15 double
16 Tk_CanvasPsY(canvas, canvasY)
17
18 int
19 Tk_CanvasPsBitmap(interp, canvas, bitmap, x, y, width, height)
20
21 int
22 Tk_CanvasPsColor(interp, canvas, colorPtr)
23
24 int
25 Tk_CanvasPsFont(interp, canvas, tkFont)
26
27 Tk_CanvasPsPath(interp, canvas, coordPtr, numPoints)
28
29 int
30 Tk_CanvasPsStipple(interp, canvas, bitmap)
31
33 Tk_Canvas canvas (in) A token that identifies a canvas
34 widget for which Postscript is be‐
35 ing generated.
36
37 double canvasY (in) Y-coordinate in the space of the
38 canvas.
39
40 Tcl_Interp *interp (in/out) A Tcl interpreter; Postscript is
41 appended to its result, or the re‐
42 sult may be replaced with an error
43 message.
44
45 Pixmap bitmap (in) Bitmap to use for generating Post‐
46 script.
47
48 int x (in) X-coordinate within bitmap of left
49 edge of region to output.
50
51 int y (in) Y-coordinate within bitmap of top
52 edge of region to output.
53
54 int width (in) Width of region of bitmap to out‐
55 put, in pixels.
56
57 int height (in) Height of region of bitmap to out‐
58 put, in pixels.
59
60 XColor *colorPtr (in) Information about color value to
61 set in Postscript.
62
63 Tk_Font tkFont (in) Font for which Postscript is to be
64 generated.
65
66 double *coordPtr (in) Pointer to an array of coordinates
67 for one or more points specified
68 in canvas coordinates. The order
69 of values in coordPtr is x1, y1,
70 x2, y2, x3, y3, and so on.
71
72 int numPoints (in) Number of points at coordPtr.
73______________________________________________________________________________
74
76 These procedures are called by canvas type managers to carry out common
77 functions related to generating Postscript. Most of the procedures
78 take a canvas argument, which refers to a canvas widget for which Post‐
79 script is being generated.
80
81 Tk_CanvasPsY takes as argument a y-coordinate in the space of a canvas
82 and returns the value that should be used for that point in the Post‐
83 script currently being generated for canvas. Y coordinates require
84 transformation because Postscript uses an origin at the lower-left cor‐
85 ner whereas X uses an origin at the upper-left corner. Canvas x coor‐
86 dinates can be used directly in Postscript without transformation.
87
88 Tk_CanvasPsBitmap generates Postscript to describe a region of a bit‐
89 map. The Postscript is generated in proper image data format for Post‐
90 script, i.e., as data between angle brackets, one bit per pixel. The
91 Postscript is appended to the result of interpreter interp and TCL_OK
92 is returned unless an error occurs, in which case TCL_ERROR is returned
93 and the interpreter result is overwritten with an error message.
94
95 Tk_CanvasPsColor generates Postscript to set the current color to cor‐
96 respond to its colorPtr argument, taking into account any color map
97 specified in the postscript command. It appends the Postscript to the
98 interpreter interp's result and returns TCL_OK unless an error occurs,
99 in which case TCL_ERROR is returned and the interpreter's result is
100 overwritten with an error message.
101
102 Tk_CanvasPsFont generates Postscript that sets the current font to
103 match tkFont as closely as possible. Tk_CanvasPsFont takes into ac‐
104 count any font map specified in the postscript command, and it does the
105 best it can at mapping X fonts to Postscript fonts. It appends the
106 Postscript to interpreter interp's result and returns TCL_OK unless an
107 error occurs, in which case TCL_ERROR is returned and the interpreter's
108 result is overwritten with an error message.
109
110 Tk_CanvasPsPath generates Postscript to set the current path to the set
111 of points given by coordPtr and numPoints. It appends the resulting
112 Postscript to the result of interpreter interp.
113
114 Tk_CanvasPsStipple generates Postscript that will fill the current path
115 in stippled fashion. It uses bitmap as the stipple pattern and the
116 current Postscript color; ones in the stipple bitmap are drawn in the
117 current color, and zeroes are not drawn at all. The Postscript is ap‐
118 pended to interpreter interp's result and TCL_OK is returned, unless an
119 error occurs, in which case TCL_ERROR is returned and the interpreter's
120 result is overwritten with an error message.
121
123 bitmap, canvas, color, font, path, Postscript, stipple
124
125
126
127Tk 4.0 Tk_CanvasPs(3)