| 1 |
# Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 2 |
# See the file "license.terms" for information on usage and redistribution |
| 3 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 4 |
# |
| 5 |
# |
| 6 |
|
| 7 |
=head1 NAME |
| 8 |
|
| 9 |
Tk_CanvasPsY, Tk_CanvasPsBitmap, Tk_CanvasPsColor, Tk_CanvasPsFont, Tk_CanvasPsPath, Tk_CanvasPsStipple - utility procedures for generating Postscript for canvases |
| 10 |
|
| 11 |
=for category C Programming |
| 12 |
|
| 13 |
=head1 SYNOPSIS |
| 14 |
|
| 15 |
B<#include E<lt>tk.hE<gt>> |
| 16 |
|
| 17 |
double |
| 18 |
B<Tk_CanvasPsY>(I<canvas, canvasY>) |
| 19 |
|
| 20 |
int |
| 21 |
B<Tk_CanvasPsBitmap>(I<interp, canvas, bitmap, x, y, width, height>) |
| 22 |
|
| 23 |
int |
| 24 |
B<Tk_CanvasPsColor>(I<interp, canvas, colorPtr>) |
| 25 |
|
| 26 |
int |
| 27 |
B<Tk_CanvasPsFont>(I<interp, canvas, fontStructPtr>) |
| 28 |
|
| 29 |
B<Tk_CanvasPsPath>(I<interp, canvas, coordPtr, numPoints>) |
| 30 |
|
| 31 |
int |
| 32 |
B<Tk_CanvasPsStipple>(I<interp, canvas, bitmap>) |
| 33 |
|
| 34 |
=head1 ARGUMENTS |
| 35 |
|
| 36 |
=over 4 |
| 37 |
|
| 38 |
=item Tk_Canvas canvas (in) |
| 39 |
|
| 40 |
A token that identifies a canvas widget for which Postscript is |
| 41 |
being generated. |
| 42 |
|
| 43 |
=item double canvasY (in) |
| 44 |
|
| 45 |
Y-coordinate in the space of the canvas. |
| 46 |
|
| 47 |
=item Tcl_Interp *interp (in/out) |
| 48 |
|
| 49 |
A Tcl interpreter; Postscript is appended to its result, or the |
| 50 |
result may be replaced with an error message. |
| 51 |
|
| 52 |
=item Pixmap bitmap (in) |
| 53 |
|
| 54 |
Bitmap to use for generating Postscript. |
| 55 |
|
| 56 |
=item int x (in) |
| 57 |
|
| 58 |
X-coordinate within I<bitmap> of left edge of region to output. |
| 59 |
|
| 60 |
=item int y (in) |
| 61 |
|
| 62 |
Y-coordinate within I<bitmap> of top edge of region to output. |
| 63 |
|
| 64 |
=item "int" width (in) |
| 65 |
|
| 66 |
Width of region of bitmap to output, in pixels. |
| 67 |
|
| 68 |
=item "int" height (in) |
| 69 |
|
| 70 |
Height of region of bitmap to output, in pixels. |
| 71 |
|
| 72 |
=item XColor *colorPtr (in) |
| 73 |
|
| 74 |
Information about color value to set in Postscript. |
| 75 |
|
| 76 |
=item XFontStruct *fontStructPtr (in) |
| 77 |
|
| 78 |
Font for which Postscript is to be generated. |
| 79 |
|
| 80 |
=item double *coordPtr (in) |
| 81 |
|
| 82 |
Pointer to an array of coordinates for one or more |
| 83 |
points specified in canvas coordinates. |
| 84 |
The order of values in I<coordPtr> is x1, y1, x2, y2, x3, y3, |
| 85 |
and so on. |
| 86 |
|
| 87 |
=item int numPoints (in) |
| 88 |
|
| 89 |
Number of points at I<coordPtr>. |
| 90 |
|
| 91 |
=back |
| 92 |
|
| 93 |
=head1 DESCRIPTION |
| 94 |
|
| 95 |
These procedures are called by canvas type managers to carry out |
| 96 |
common functions related to generating Postscript. |
| 97 |
Most of the procedures take a I<canvas> argument, which |
| 98 |
refers to a canvas widget for which Postscript is being |
| 99 |
generated. |
| 100 |
|
| 101 |
B<Tk_CanvasY> takes as argument a y-coordinate in the space of |
| 102 |
a canvas and returns the value that should be used for that point |
| 103 |
in the Postscript currently being generated for I<canvas>. |
| 104 |
Y coordinates require transformation because Postscript uses an |
| 105 |
origin at the lower-left corner whereas X uses an origin at the |
| 106 |
upper-left corner. |
| 107 |
Canvas x coordinates can be used directly in Postscript without |
| 108 |
transformation. |
| 109 |
|
| 110 |
B<Tk_CanvasPsBitmap> generates Postscript to describe a region |
| 111 |
of a bitmap. |
| 112 |
The Postscript is generated in proper image data format for Postscript, |
| 113 |
i.e., as data between angle brackets, one bit per pixel. |
| 114 |
The Postscript is appended to I<interp-E<gt>result> and TCL_OK is returned |
| 115 |
unless an error occurs, in which case TCL_ERROR is returned and |
| 116 |
I<interp-E<gt>result> is overwritten with an error message. |
| 117 |
|
| 118 |
B<Tk_CanvasPsColor> generates Postscript to set the current color |
| 119 |
to correspond to its I<colorPtr> argument, taking into account any |
| 120 |
color map specified in the B<postscript> command. |
| 121 |
It appends the Postscript to I<interp-E<gt>result> and returns |
| 122 |
TCL_OK unless an error occurs, in which case TCL_ERROR is returned and |
| 123 |
I<interp-E<gt>result> is overwritten with an error message. |
| 124 |
|
| 125 |
B<Tk_CanvasPsFont> generates Postscript that sets the current font |
| 126 |
to match I<fontStructPtr> as closely as possible. |
| 127 |
B<Tk_CanvasPsFont> takes into account any font map specified |
| 128 |
in the B<postscript> command, and it does |
| 129 |
the best it can at mapping X fonts to Postscript fonts. |
| 130 |
It appends the Postscript to I<interp-E<gt>result> and returns TCL_OK |
| 131 |
unless an error occurs, in which case TCL_ERROR is returned and |
| 132 |
I<interp-E<gt>result> is overwritten with an error message. |
| 133 |
|
| 134 |
B<Tk_CanvasPsPath> generates Postscript to set the current path |
| 135 |
to the set of points given by I<coordPtr> and I<numPoints>. |
| 136 |
It appends the resulting Postscript to I<interp-E<gt>result>. |
| 137 |
|
| 138 |
B<Tk_CanvasPsStipple> generates Postscript that will fill the |
| 139 |
current path in stippled fashion. |
| 140 |
It uses I<bitmap> as the stipple pattern and the current Postscript |
| 141 |
color; ones in the stipple bitmap are drawn in the current color, and |
| 142 |
zeroes are not drawn at all. |
| 143 |
The Postscript is appended to I<interp-E<gt>result> and TCL_OK is |
| 144 |
returned, unless an error occurs, in which case TCL_ERROR is returned and |
| 145 |
I<interp-E<gt>result> is overwritten with an error message. |
| 146 |
|
| 147 |
=head1 KEYWORDS |
| 148 |
|
| 149 |
bitmap, canvas, color, font, path, Postscript, stipple |