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
35 being 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
42 result may be replaced with an
43 error 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
75
77 These procedures are called by canvas type managers to carry out common
78 functions related to generating Postscript. Most of the procedures
79 take a canvas argument, which refers to a canvas widget for which Post‐
80 script is being generated.
81
82 Tk_CanvasPsY takes as argument a y-coordinate in the space of a canvas
83 and returns the value that should be used for that point in the Post‐
84 script currently being generated for canvas. Y coordinates require
85 transformation because Postscript uses an origin at the lower-left cor‐
86 ner whereas X uses an origin at the upper-left corner. Canvas x coor‐
87 dinates can be used directly in Postscript without transformation.
88
89 Tk_CanvasPsBitmap generates Postscript to describe a region of a bit‐
90 map. The Postscript is generated in proper image data format for Post‐
91 script, i.e., as data between angle brackets, one bit per pixel. The
92 Postscript is appended to interp->result and TCL_OK is returned unless
93 an error occurs, in which case TCL_ERROR is returned and interp->result
94 is overwritten with an error message.
95
96 Tk_CanvasPsColor generates Postscript to set the current color to cor‐
97 respond to its colorPtr argument, taking into account any color map
98 specified in the postscript command. It appends the Postscript to
99 interp->result and returns TCL_OK unless an error occurs, in which case
100 TCL_ERROR is returned and interp->result is overwritten with an error
101 message.
102
103 Tk_CanvasPsFont generates Postscript that sets the current font to
104 match tkFont as closely as possible. Tk_CanvasPsFont takes into
105 account any font map specified in the postscript command, and it does
106 the best it can at mapping X fonts to Postscript fonts. It appends the
107 Postscript to interp->result and returns TCL_OK unless an error occurs,
108 in which case TCL_ERROR is returned and interp->result is overwritten
109 with an error message.
110
111 Tk_CanvasPsPath generates Postscript to set the current path to the set
112 of points given by coordPtr and numPoints. It appends the resulting
113 Postscript to interp->result.
114
115 Tk_CanvasPsStipple generates Postscript that will fill the current path
116 in stippled fashion. It uses bitmap as the stipple pattern and the
117 current Postscript color; ones in the stipple bitmap are drawn in the
118 current color, and zeroes are not drawn at all. The Postscript is
119 appended to interp->result and TCL_OK is returned, unless an error
120 occurs, in which case TCL_ERROR is returned and interp->result is over‐
121 written with an error message.
122
123
125 bitmap, canvas, color, font, path, Postscript, stipple
126
127
128
129Tk 4.0 Tk_CanvasPs(3)