| 1 |
|
| 2 |
<!-- manual page source format generated by PolyglotMan v3.0.9, --> |
| 3 |
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z --> |
| 4 |
|
| 5 |
<HTML> |
| 6 |
<HEAD> |
| 7 |
<TITLE>winop(n) manual page</TITLE><!--#include virtual="/man/maninc.html"--> |
| 8 |
</HEAD> |
| 9 |
<BODY bgcolor=white> |
| 10 |
<A HREF="#toc">Table of Contents</A><P> |
| 11 |
|
| 12 |
<H2><A NAME="sect0" HREF="#toc0">Name</A></H2> |
| 13 |
winop - Perform assorted window |
| 14 |
and image operations |
| 15 |
<H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2> |
| 16 |
<P> |
| 17 |
<B>winop changes</B> <I>window</I> <P> |
| 18 |
<B>winop image</B> <I>subcommand</I> |
| 19 |
... <blockquote><P> |
| 20 |
<B>winop image colors</B> ?-alpha? <I>srcImage</I> <P> |
| 21 |
<B>winop image convolve</B> <I>srcImage</I> <I>destImage</I> |
| 22 |
<I>filter</I> <P> |
| 23 |
<B>winop image gradient</B> <I>image</I> <I>leftcolor</I> <I>rightcolor</I> ?<B>lines|normal|rectangular|linear|radial|sine|halfsine|blank</B>? |
| 24 |
?<I>skew</I>? <P> |
| 25 |
<B>winop image merge</B> <I>srcImage1</I> <I>srcImage2</I> <I>destImage</I> ?<I>alpha</I>? <P> |
| 26 |
<B>winop image |
| 27 |
mirror</B> <I>srcImage1</I> <I>destImage</I> ?<I>x|y|xy|tile</I>? <P> |
| 28 |
<B>winop image quantize</B> <I>srcImage</I> <I>destImage</I> |
| 29 |
?<I>nColors</I>? <P> |
| 30 |
<B>winop image readjpeg</B> <I>filename</I> <I>photoname</I> <P> |
| 31 |
<B>winop image resample</B> |
| 32 |
<I>srcImage</I> <I>destImage</I> ?<I>horizFilter</I>? ?<I>vertFilter</I>? <P> |
| 33 |
<B>winop image rotate</B> <I>srcImage</I> |
| 34 |
<I>destImage</I> <I>angle</I> <P> |
| 35 |
<B>winop image subsample</B> <I>srcImage</I> <I>destImage</I> <I>x</I> <I>y</I> <I>width</I> <I>height</I> |
| 36 |
?<I>horizFilter</I>? ?<I>vertFilter</I>? <P> |
| 37 |
<B>winop image snap <I>window photoName</I></B> <P> |
| 38 |
<B>winop image |
| 39 |
transparent</B> <I>srcImage</I> <I>destImage</I> <I>color</I> </blockquote> |
| 40 |
<P> |
| 41 |
<P> |
| 42 |
<B>winop lower</B> ?<I>window</I>?... <P> |
| 43 |
<B>winop map</B> ?<I>window</I>?... |
| 44 |
<P> |
| 45 |
<B>winop move <I>window x y</I></B> <P> |
| 46 |
<B>winop query</B> <P> |
| 47 |
<B>winop raise</B> ?<I>window</I>?... <P> |
| 48 |
<B>winop unmap</B> ?<I>window</I>?... |
| 49 |
<P> |
| 50 |
<B>winop warpto</B> ?<I>window</I>? |
| 51 |
<H2><A NAME="sect2" HREF="#toc2">Description</A></H2> |
| 52 |
The <B>winop</B> command performs various window |
| 53 |
and image operations on Tk windows using low-level Xlib function calls to |
| 54 |
work around window manager pecularities. |
| 55 |
<H2><A NAME="sect3" HREF="#toc3">Introduction</A></H2> |
| 56 |
Tk has several commands |
| 57 |
for manipulating its windows: <B>raise</B>, <B>lower</B>, <B>wm</B>, etc. These commands ask |
| 58 |
the window manager to perform operations on Tk windows. In some cases, |
| 59 |
a particular window manager won't perform the operation as expected. <P> |
| 60 |
For |
| 61 |
example, if you positioned a toplevel window using <B>wm geometry</B>, the window |
| 62 |
may not actually be at those particular coordinates. The position of the |
| 63 |
window may be offset by dimensions of the title bar added by the window |
| 64 |
manager. <P> |
| 65 |
In situations like these, the <B>winop</B> command can be used to workaround |
| 66 |
these difficulties. Instead, it makes low-level Xlib (such <B>XRaiseWindow</B> |
| 67 |
and <B>XMapWindow</B>) calls to perform these operations. <BR> |
| 68 |
<CODE>toplevel .top<BR> |
| 69 |
wm withdraw .top<BR> |
| 70 |
<P> |
| 71 |
# Set the geometry to make the window manager <BR> |
| 72 |
# place the window.<BR> |
| 73 |
wm geometry .top +100+100<BR> |
| 74 |
<P> |
| 75 |
# Move the window to the desired location<BR> |
| 76 |
# and "update" to force the window manager<BR> |
| 77 |
# to recognize it.<BR> |
| 78 |
winop move .top 100 100<BR> |
| 79 |
update <BR> |
| 80 |
<P> |
| 81 |
wm deiconify .top<BR> |
| 82 |
winop move .top 100 100<BR> |
| 83 |
|
| 84 |
<H2><A NAME="sect4" HREF="#toc4"></CODE>Operations</A></H2> |
| 85 |
The following operations are available for the <B>winop</B> command: |
| 86 |
|
| 87 |
<DL> |
| 88 |
|
| 89 |
<DT><B>winop changes</B> <I>window</I> </DT> |
| 90 |
<DD>Realize window. </DD> |
| 91 |
|
| 92 |
<DT><B>winop image</B> <I>subcommand</I> ... </DT> |
| 93 |
<DD>Image sub-commands. |
| 94 |
<blockquote></DD> |
| 95 |
|
| 96 |
<DT><B>winop image alpha </B> <I>srcImage</I> <I>destImage</I> <I>color</I> ?<I>alpha</I>? </DT> |
| 97 |
<DD>Set image pixels of |
| 98 |
the given color to transparent. If an alpha value is not given, it defaults |
| 99 |
to <B>0</B> (meaning transparent). An alpha of 255 is used for solid. The <I>srcImage</I> |
| 100 |
and <I>destImage</I> may be the same. </DD> |
| 101 |
|
| 102 |
<DT><B>winop image colors</B> ?<B>-alpha</B>? ?<B>-count</B>? <I>srcImage</I> |
| 103 |
</DT> |
| 104 |
<DD>Return list of distinct colors. If -alpha is given, the alpha is appended |
| 105 |
to each color after a colon, eg <I>#FF0000:00</I>. If <B>-count</B> is given, returns |
| 106 |
color/count pairs. </DD> |
| 107 |
|
| 108 |
<DT><B>winop image convolve</B> <I>srcImage</I> <I>destImage</I> <I>filter</I> </DT> |
| 109 |
<DD>Convolve |
| 110 |
an image: filter is a list of numbers. The <I>srcImage</I> and <I>destImage</I> may be |
| 111 |
the same. </DD> |
| 112 |
|
| 113 |
<DT><B>winop image gradient</B> <I>image</I> <I>leftcolor</I> <I>rightcolor</I> ... </DT> |
| 114 |
<DD>Generate a gradient |
| 115 |
into <I>image</I>. <blockquote></DD> |
| 116 |
|
| 117 |
<DT>-type halfsine|sine|linear|rectangular|radial|blank </DT> |
| 118 |
<DD>Set the type |
| 119 |
of gradient. The default is <B>sine</B>. </DD> |
| 120 |
|
| 121 |
<DT>-skew N </DT> |
| 122 |
<DD>The <I>skew</I> determines the initial |
| 123 |
fraction of the image that the gradient occupies, after which only rightcolor |
| 124 |
is used. The skew must be > 0 and <= 1.0 and has a default value of <I>1.0</I> (ie. |
| 125 |
not skewed). </DD> |
| 126 |
|
| 127 |
<DT>-slant N </DT> |
| 128 |
<DD>Make the gradient slant where a value of 1.0 slants |
| 129 |
at 45 degrees. The value must be between -100.0 and 100.0. </DD> |
| 130 |
|
| 131 |
<DT>-curve N </DT> |
| 132 |
<DD>Curve the |
| 133 |
gradient by passing the <I>Y</I> position to a function (see <I>-func</I>) scaled with |
| 134 |
the given value. The value must be between -100.0 and 100.0 (typically 1.0). |
| 135 |
</DD> |
| 136 |
|
| 137 |
<DT>-func X </DT> |
| 138 |
<DD>Function to use with <I>-curve</I>. The default value is <B>sin</B>. The value |
| 139 |
must be one of: <B>sin cos tan sinh cosh tanh asin acos atan log log10 exp |
| 140 |
sqrt rand circle</B>. </DD> |
| 141 |
|
| 142 |
<DT>-rand N </DT> |
| 143 |
<DD>Add small random purturbations to gradient to |
| 144 |
avoid striation lines. The value must be between 0.0 and 0.1. </DD> |
| 145 |
</DL> |
| 146 |
</blockquote> |
| 147 |
|
| 148 |
<DL> |
| 149 |
|
| 150 |
<DT><B>winop image merge</B> |
| 151 |
<I>srcImage1</I> <I>srcImage2</I> <I>destImage</I> ?<I>alpha</I>? </DT> |
| 152 |
<DD>Merge two images with alpha blending. |
| 153 |
The default alpha is 128. </DD> |
| 154 |
|
| 155 |
<DT><B>winop image mirror</B> <I>srcImage1</I> <I>destImage</I> ?<I>x|y|xy|tile</I>? |
| 156 |
</DT> |
| 157 |
<DD>Flips an image on axis x, y or xy. The <I>tile</I> option results in a double |
| 158 |
size image with mirror copies appended to generate a tile-able image. The |
| 159 |
<I>srcImage1</I> and <I>destImage</I> must not be the same if using <I>tile</I>. The default |
| 160 |
is <B>xy</B>. </DD> |
| 161 |
|
| 162 |
<DT><B>winop image quantize</B> <I>srcImage</I> <I>destImage</I> ?<I>nColors</I>? </DT> |
| 163 |
<DD>Limit number of |
| 164 |
colors in image. Default 1. The <I>srcImage</I> and <I>destImage</I> may be the same. </DD> |
| 165 |
|
| 166 |
<DT><B>winop |
| 167 |
image readjpeg</B> <I>filename</I> <I>photoname</I> </DT> |
| 168 |
<DD>Read a jpeg image using libjpeg. IMG |
| 169 |
makes this obsolete (and thus probably not builtin). </DD> |
| 170 |
|
| 171 |
<DT><B>winop image recolor</B> |
| 172 |
<I>srcImage</I> <I>destImage</I> <I>oldColor</I> <I>newColor</I> ?<I>alpha</I>? </DT> |
| 173 |
<DD>Change pixels from <I>oldColor</I> |
| 174 |
to <I>newColor</I>. If ?<I>alpha</I>? is not given it defaults to 255 (opaque). The <I>srcImage</I> |
| 175 |
and <I>destImage</I> may be the same. </DD> |
| 176 |
|
| 177 |
<DT><B>winop image resample</B> <I>srcImage</I> <I>destImage</I> ?<I>horizFilter</I>? |
| 178 |
?<I>vertFilter</I>? </DT> |
| 179 |
<DD>Resample an image. If <I>srcImage</I> and <I>destImage</I> are the same |
| 180 |
size, just makes a copy. Otherwise the image is resized to the size of |
| 181 |
<I>destImage</I>, possibly wih filtering. Filters are one of: <B>bell bessel box bspline |
| 182 |
catrom default dummy gauss8 gaussian gi lanczos3 mitchell none sinc triangle</B>. |
| 183 |
The <I>destImage</I> must be greater than 1x1. </DD> |
| 184 |
|
| 185 |
<DT><B>winop image rotate</B> <I>srcImage</I> <I>destImage</I> |
| 186 |
<I>angle</I> </DT> |
| 187 |
<DD>Rotate an image. The <I>srcImage</I> and <I>destImage</I> may be the same. </DD> |
| 188 |
|
| 189 |
<DT><B>winop |
| 190 |
image subsample</B> <I>srcImage</I> <I>destImage</I> <I>x</I> <I>y</I> <I>width</I> <I>height</I> ?<I>horizFilter</I>? ?<I>vertFilter</I>? |
| 191 |
</DT> |
| 192 |
<DD>Resample area of an image. See resample. </DD> |
| 193 |
|
| 194 |
<DT><B>winop image snap <I>window photoName</I></B> |
| 195 |
</DT> |
| 196 |
<DD>Takes a snapshot of the <I>window</I> and stores the contents in the photo image |
| 197 |
<I>photoName</I>. <I>Window</I> is the valid path name of a Tk window which must be totally |
| 198 |
visible (unobscured). <I>PhotoName</I> is the name of a Tk photo image which must |
| 199 |
already exist. This command can fail if the window is obscured in any fashion, |
| 200 |
such as covered by another window or partially offscreen. In that case, |
| 201 |
an error message is returned. </DD> |
| 202 |
</DL> |
| 203 |
</blockquote> |
| 204 |
|
| 205 |
<DL> |
| 206 |
|
| 207 |
<DT><B>winop lower</B> ?<I>window</I>?... </DT> |
| 208 |
<DD>Lowers <I>window</I> to the |
| 209 |
bottom of the X window stack. <I>Window</I> is the path name of a Tk window. |
| 210 |
</DD> |
| 211 |
|
| 212 |
<DT><B>winop map</B> ?<I>window</I>?... </DT> |
| 213 |
<DD>Maps <I>window</I> on the screen. <I>Window</I> is the path name of |
| 214 |
a Tk window. If <I>window</I> is already mapped, this command has no effect. </DD> |
| 215 |
|
| 216 |
<DT><B>winop |
| 217 |
move <I>window x y</I></B> </DT> |
| 218 |
<DD>Move <I>window</I> to the screen location specified by <I>x</I> and <I>y</I>. |
| 219 |
<I>Window</I> is the path name of a Tk window, while <I>x</I> and <I>y</I> are screen coordinates. |
| 220 |
This command returns the empty string. </DD> |
| 221 |
|
| 222 |
<DT><B>winop query</B> </DT> |
| 223 |
<DD>Query pointer position. |
| 224 |
Returns @X,Y. </DD> |
| 225 |
|
| 226 |
<DT><B>winop raise</B> ?<I>window</I>?... </DT> |
| 227 |
<DD>Raises <I>window</I> to the top of the X window |
| 228 |
stack. <I>Window</I> must be a valid path name of a Tk window. This command returns |
| 229 |
the empty string. </DD> |
| 230 |
|
| 231 |
<DT><B>winop unmap</B> ?<I>window</I>?... </DT> |
| 232 |
<DD>Unmaps <I>window</I> from the screen. <I>Window</I> |
| 233 |
is the path name of a Tk window. </DD> |
| 234 |
|
| 235 |
<DT><B>winop warpto</B> ?<I>window</I>? </DT> |
| 236 |
<DD>Warps the pointer |
| 237 |
to <I>window</I>. <I>Window</I> is the path name of a Tk window which must be mapped. If |
| 238 |
<I>window</I> is in the form <I>@x,y</I>, where <I>x</I> and <I>y</I> are root screen coordinates, |
| 239 |
the pointer is warped to that location on the screen. <P> |
| 240 |
[<I>I've never heard a |
| 241 |
good case for warping the pointer in an application. It can be useful for |
| 242 |
testing, but in applications, it's always a bad idea. Simply stated, the |
| 243 |
user owns the pointer, not the application. If you have an application |
| 244 |
that needs it, I'd like to hear about it.</I>] <P> |
| 245 |
If no <I>window</I> argument is present |
| 246 |
the current location of the pointer is returned. The location is returned |
| 247 |
as a list in the form "<I>x y</I>", where <I>x</I> and <I>y</I> are the current coordinates |
| 248 |
of the pointer. </DD> |
| 249 |
</DL> |
| 250 |
|
| 251 |
<H2><A NAME="sect5" HREF="#toc5">Keywords</A></H2> |
| 252 |
window, map, raise, lower, pointer, warp <P> |
| 253 |
<P> |
| 254 |
|
| 255 |
<HR><P> |
| 256 |
<A NAME="toc"><B>Table of Contents</B></A><P> |
| 257 |
<UL> |
| 258 |
<LI><A NAME="toc0" HREF="#sect0">Name</A></LI> |
| 259 |
<LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI> |
| 260 |
<LI><A NAME="toc2" HREF="#sect2">Description</A></LI> |
| 261 |
<LI><A NAME="toc3" HREF="#sect3">Introduction</A></LI> |
| 262 |
<LI><A NAME="toc4" HREF="#sect4">Operations</A></LI> |
| 263 |
<LI><A NAME="toc5" HREF="#sect5">Keywords</A></LI> |
| 264 |
</UL> |
| 265 |
</BODY></HTML> |