| 1 |
'\" |
| 2 |
'\" Copyright 1991-1997 by Bell Labs Innovations for Lucent Technologies. |
| 3 |
'\" |
| 4 |
'\" Permission to use, copy, modify, and distribute this software and its |
| 5 |
'\" documentation for any purpose and without fee is hereby granted, provided |
| 6 |
'\" that the above copyright notice appear in all copies and that both that the |
| 7 |
'\" copyright notice and warranty disclaimer appear in supporting documentation, |
| 8 |
'\" and that the names of Lucent Technologies any of their entities not be used |
| 9 |
'\" in advertising or publicity pertaining to distribution of the software |
| 10 |
'\" without specific, written prior permission. |
| 11 |
'\" |
| 12 |
'\" Lucent Technologies disclaims all warranties with regard to this software, |
| 13 |
'\" including all implied warranties of merchantability and fitness. In no event |
| 14 |
'\" shall Lucent Technologies be liable for any special, indirect or |
| 15 |
'\" consequential damages or any damages whatsoever resulting from loss of use, |
| 16 |
'\" data or profits, whether in an action of contract, negligence or other |
| 17 |
'\" tortuous action, arising out of or in connection with the use or performance |
| 18 |
'\" of this software. |
| 19 |
'\" |
| 20 |
'\" Window command created by George Howlett. |
| 21 |
'\" |
| 22 |
.so man.macros |
| 23 |
.TH winop n BLT_VERSION BLT "BLT Built-In Commands" |
| 24 |
.BS |
| 25 |
'\" Note: do not modify the .SH NAME line immediately below! |
| 26 |
.SH NAME |
| 27 |
winop \- Perform assorted window and image operations |
| 28 |
.SH SYNOPSIS |
| 29 |
.sp |
| 30 |
\fBwinop changes\fR \fIwindow\fR |
| 31 |
.sp |
| 32 |
\fBwinop gradients\fR \fIleftcolor\fR \fIrightcolor\fR \fIgradients\fR |
| 33 |
.sp |
| 34 |
\fBwinop image\fR \fIsubcommand\fR ... |
| 35 |
.RS |
| 36 |
.sp |
| 37 |
\fBwinop image alpha\fR \fIsrcImage\fR \fIdestImage\fR \fIcolor\fR |
| 38 |
.sp |
| 39 |
\fBwinop image colors\fR ?-alpha? \fIsrcImage\fR |
| 40 |
.sp |
| 41 |
\fBwinop image convolve\fR \fIsrcImage\fR \fIdestImage\fR \fIfilter\fR |
| 42 |
.sp |
| 43 |
\fBwinop image gradient\fR \fIimage\fR \fIleftcolor\fR \fIrightcolor\fR ... |
| 44 |
.sp |
| 45 |
\fBwinop image merge\fR \fIsrcImage1\fR \fIsrcImage2\fR \fIdestImage\fR ?\fIalpha\fR? ?...? |
| 46 |
.sp |
| 47 |
\fBwinop image mirror\fR \fIsrcImage1\fR \fIdestImage\fR ?\fIx|y|xy|tile|outer|inner\fR? |
| 48 |
.sp |
| 49 |
\fBwinop image quantize\fR \fIsrcImage\fR \fIdestImage\fR ?\fInColors\fR? |
| 50 |
.sp |
| 51 |
\fBwinop image readjpeg\fR \fIfilename\fR \fIphotoname\fR |
| 52 |
.sp |
| 53 |
\fBwinop image resample\fR \fIsrcImage\fR \fIdestImage\fR ?\fIhorizFilter\fR? ?\fIvertFilter\fR? |
| 54 |
.sp |
| 55 |
\fBwinop image rotate\fR \fIsrcImage\fR \fIdestImage\fR \fIangle\fR |
| 56 |
.sp |
| 57 |
\fBwinop image subsample\fR \fIsrcImage\fR \fIdestImage\fR \fIx\fR \fIy\fR \fIwidth\fR \fIheight\fR ?\fIhorizFilter\fR? ?\fIvertFilter\fR? |
| 58 |
.RE |
| 59 |
|
| 60 |
.sp |
| 61 |
\fBwinop lower\fR ?\fIwindow\fR?... |
| 62 |
.sp |
| 63 |
\fBwinop map\fR ?\fIwindow\fR?... |
| 64 |
.sp |
| 65 |
\fBwinop move \fIwindow x y\fR |
| 66 |
.sp |
| 67 |
\fBwinop query\fR |
| 68 |
.sp |
| 69 |
\fBwinop raise\fR ?\fIwindow\fR?... |
| 70 |
.sp |
| 71 |
\fBwinop snap \fIwindow photoName\fR ?\fIwidth height\fR ? |
| 72 |
.sp |
| 73 |
\fBwinop unmap\fR ?\fIwindow\fR?... |
| 74 |
.sp |
| 75 |
\fBwinop warpto\fR ?\fIwindow\fR? |
| 76 |
.BE |
| 77 |
.SH DESCRIPTION |
| 78 |
The \fBwinop\fR command performs various window and image operations on Tk |
| 79 |
windows using low-level Xlib function calls to work around window |
| 80 |
manager pecularities. |
| 81 |
.SH INTRODUCTION |
| 82 |
Tk has several commands for manipulating its windows: \fBraise\fR, |
| 83 |
\fBlower\fR, \fBwm\fR, etc. These commands ask the window manager to |
| 84 |
perform operations on Tk windows. In some cases, a particular window |
| 85 |
manager won't perform the operation as expected. |
| 86 |
.PP |
| 87 |
For example, if you positioned a toplevel window using \fBwm geometry\fR, |
| 88 |
the window may not actually be at those particular coordinates. The |
| 89 |
position of the window may be offset by dimensions of the title bar added |
| 90 |
by the window manager. |
| 91 |
.PP |
| 92 |
In situations like these, the \fBwinop\fR command can be used to |
| 93 |
workaround these difficulties. Instead, it makes low-level Xlib |
| 94 |
(such \fBXRaiseWindow\fR and \fBXMapWindow\fR) calls to perform these |
| 95 |
operations. |
| 96 |
.CS |
| 97 |
toplevel .top |
| 98 |
wm withdraw .top |
| 99 |
|
| 100 |
# Set the geometry to make the window manager |
| 101 |
# place the window. |
| 102 |
wm geometry .top +100+100 |
| 103 |
|
| 104 |
# Move the window to the desired location |
| 105 |
# and "update" to force the window manager |
| 106 |
# to recognize it. |
| 107 |
winop move .top 100 100 |
| 108 |
update |
| 109 |
|
| 110 |
wm deiconify .top |
| 111 |
winop move .top 100 100 |
| 112 |
.CE |
| 113 |
.SH OPERATIONS |
| 114 |
The following operations are available for the \fBwinop\fR command: |
| 115 |
.TP |
| 116 |
\fBwinop changes\fR \fIwindow\fR |
| 117 |
Realize window. |
| 118 |
.TP |
| 119 |
\fBwinop image\fR \fIsubcommand\fR ... |
| 120 |
Image sub-commands. |
| 121 |
.RS |
| 122 |
.TP |
| 123 |
\fBwinop image alpha \fR ?\fb-shift\fR? \fIsrcImage\fR \fIdestImage\fR \fIcolor\fR ?\fIalpha\fR? ?\fIwithalpha\fR? |
| 124 |
Set image pixels of the given color to transparent. |
| 125 |
If an alpha value is not given, it defaults to \fB0\fR |
| 126 |
(meaning transparent). An alpha of 255 is used for solid. |
| 127 |
The \fIsrcImage\fR and \fIdestImage\fR may be the same. |
| 128 |
If the \fIcolor\fR is \fB*\fR any color is matched. |
| 129 |
If \fIcolor\fR is prefixed with \fB!\fR match is inverted. |
| 130 |
.TP |
| 131 |
\fBwinop gradients\fR \fIleftcolor\fR \fIrightcolor\fR \fIwidth\fR |
| 132 |
Return a list of \fIwidth\fR colors that graduate from |
| 133 |
\fIleftcolor\fR to the color just before \fIrightcolor\fR. |
| 134 |
Note that the last color in the returned list is not \fIrightcolor\fR. |
| 135 |
A typical use for this is calculating shadow colors. |
| 136 |
.TP |
| 137 |
\fBwinop image blur\fR \fIsrcImage dstImage\fR ?\fIradius\fR? |
| 138 |
Blur an image using gaussian blur. |
| 139 |
.TP |
| 140 |
\fBwinop image colors\fR ?\fB-alpha\fR? ?\fB-count\fR? \fIsrcImage\fR |
| 141 |
Return list of distinct colors. If -alpha is given, the alpha is appended |
| 142 |
to each color after a colon, eg \fI#FF0000:00\fR. If \fB-count\fR is |
| 143 |
given, returns color/count pairs. |
| 144 |
.TP |
| 145 |
\fBwinop image convolve\fR \fIsrcImage\fR \fIdestImage\fR \fIfilter\fR |
| 146 |
Convolve an image: filter is a list of numbers. |
| 147 |
The \fIsrcImage\fR and \fIdestImage\fR may be the same. |
| 148 |
.TP |
| 149 |
\fBwinop image gradient\fR \fIimage\fR \fIleftcolor\fR \fIrightcolor\fR ... |
| 150 |
Generate a gradient from left to right into \fIimage\fR. |
| 151 |
The following options are available: |
| 152 |
.RS |
| 153 |
.TP 5 |
| 154 |
\fB-type halfsine|sine|linear|rectangular|radial|split|blank\fR |
| 155 |
Set the type of gradient. The default is \fBsine\fR. |
| 156 |
.TP 5 |
| 157 |
\fB-skew N\fR |
| 158 |
The \fIskew\fR determines the initial fraction of |
| 159 |
the image that the gradient occupies, after which only rightcolor is used. |
| 160 |
The skew must be > 0 and <= 1.0. The default value is \fI1.0\fR, |
| 161 |
meaning not skewed. |
| 162 |
.TP 5 |
| 163 |
\fB-slant N\fR |
| 164 |
Make the gradient slant where a value of 1.0 slants at 45 degrees. |
| 165 |
The value must be between -100.0 and 100.0. |
| 166 |
.TP 5 |
| 167 |
\fB-mathval N\fR |
| 168 |
Curve the gradient by passing the \fIY\fR position |
| 169 |
to the function \fI-mathfunc\fR. |
| 170 |
The value must be between -100.0 and 100.0 (typically 1.0). |
| 171 |
The default is \fB0.0\fR, which means disabled. |
| 172 |
.TP 5 |
| 173 |
\fB-mathfunc X\fR |
| 174 |
Function to use with \fI-mathval\fR. |
| 175 |
The default value is \fBsin\fR. |
| 176 |
The value must be one of: |
| 177 |
\fBsin cos tan sinh cosh tanh asin acos atan log log10 exp sqrt rand circle\fR. |
| 178 |
.TP 5 |
| 179 |
\fB-rand N\fR |
| 180 |
Add small random purturbations to gradient to avoid striation lines. |
| 181 |
The value must be between 0.0 and 0.1. |
| 182 |
.TP 5 |
| 183 |
\fB-height N\fR |
| 184 |
Change the image height. |
| 185 |
.TP 5 |
| 186 |
\fB-width N\fR |
| 187 |
Change the image width. |
| 188 |
.RE |
| 189 |
.TP |
| 190 |
\fBwinop image merge\fR \fIsrcImage1\fR \fIsrcImage2\fR \fIdestImage\fR ?\fIopacity\fR? ?\fIopacity2\fR? |
| 191 |
Merge two images with alpha blending. The default ?\fIopacity\fR? is 0.5, |
| 192 |
and the default for ?\fIopacity2\fR? is 1.0 - ?\fIopacity\fR?. |
| 193 |
.TP |
| 194 |
\fBwinop image mirror\fR \fIsrcImage1\fR \fIdestImage\fR ?\fIx|y|xy|tile|outer|inner\fR? ?halo? |
| 195 |
Flips an image on axis x, y or xy. The \fItile\fR option results in a double |
| 196 |
size image with mirror copies appended to generate a tile-able image. |
| 197 |
The \fIouter\fR option is used to resize an image while preserving |
| 198 |
the outside border by \fIhalo\fR pixels (default is 16). |
| 199 |
The \fIinner\fR option copies from the center of source keeping it centered. |
| 200 |
These last 2 are used implicitly by \fBblt::tile::button -bdtile\fR, etc. |
| 201 |
The \fIsrcImage1\fR and \fIdestImage\fR |
| 202 |
must not be the same if using \fItile\fR, \fIinner\fR or \fIouter\fR. |
| 203 |
The default is \fBxy\fR. |
| 204 |
.TP |
| 205 |
\fBwinop image quantize\fR \fIsrcImage\fR \fIdestImage\fR ?\fInColors\fR? |
| 206 |
Limit number of colors in image. Default 1. |
| 207 |
The \fIsrcImage\fR and \fIdestImage\fR may be the same. |
| 208 |
.TP |
| 209 |
\fBwinop image readjpeg\fR \fIfilename\fR \fIphotoname\fR |
| 210 |
Read a jpeg image using libjpeg. IMG makes this obsolete |
| 211 |
(and thus probably not builtin). |
| 212 |
.TP |
| 213 |
\fBwinop image recolor\fR \fIsrcImage\fR \fIdestImage\fR \fIoldColor\fR \fInewColor\fR ?\fIalpha\fR? |
| 214 |
Change pixels from \fIoldColor\fR to \fInewColor\fR. |
| 215 |
If ?\fIalpha\fR? is not given it defaults to 255 (opaque). |
| 216 |
The \fIsrcImage\fR and \fIdestImage\fR may be the same. |
| 217 |
.TP |
| 218 |
\fBwinop image resample\fR \fIsrcImage\fR \fIdestImage\fR ?\fIhorizFilter\fR? ?\fIvertFilter\fR? |
| 219 |
Resample an image. If \fIsrcImage\fR and \fIdestImage\fR are the same |
| 220 |
size, just makes a copy. Otherwise the image is resized |
| 221 |
to the size of \fIdestImage\fR, possibly wih filtering. |
| 222 |
Filters are one of: \fBbell bessel box bspline catrom default dummy gauss8 |
| 223 |
gaussian gi lanczos3 mitchell none sinc triangle\fR. |
| 224 |
The \fIdestImage\fR must be greater than 1x1. |
| 225 |
.TP |
| 226 |
\fBwinop image rotate\fR \fIsrcImage\fR \fIdestImage\fR \fIangle\fR |
| 227 |
Rotate an image. The \fIsrcImage\fR and \fIdestImage\fR |
| 228 |
may be the same. |
| 229 |
.TP |
| 230 |
\fBwinop image subsample\fR \fIsrcImage\fR \fIdestImage\fR \fIx\fR \fIy\fR \fIwidth\fR \fIheight\fR ?\fIhorizFilter\fR? ?\fIvertFilter\fR? |
| 231 |
Resample area of an image. See resample. |
| 232 |
.TP |
| 233 |
\fBwinop image trans\fR \fIimage x y\fR ?\fIalpha\fR? |
| 234 |
Get or set the integer alpha value within an image. |
| 235 |
.RE |
| 236 |
.TP |
| 237 |
\fBwinop lower\fR ?\fIwindow\fR?... |
| 238 |
Lowers \fIwindow\fR to the bottom of the X window stack. \fIWindow\fR is |
| 239 |
the path name of a Tk window. |
| 240 |
.TP |
| 241 |
\fBwinop map\fR ?\fIwindow\fR?... |
| 242 |
Maps \fIwindow\fR on the screen. \fIWindow\fR |
| 243 |
is the path name of a Tk window. If \fIwindow\fR is already mapped, |
| 244 |
this command has no effect. |
| 245 |
.TP |
| 246 |
\fBwinop move \fIwindow x y\fR |
| 247 |
Move \fIwindow\fR to the screen location specified by \fIx\fR |
| 248 |
and \fIy\fR. \fIWindow\fR is the path name of a Tk window, while |
| 249 |
\fIx\fR and \fIy\fR are screen coordinates. This command returns |
| 250 |
the empty string. |
| 251 |
.TP |
| 252 |
\fBwinop query\fR |
| 253 |
Query pointer position. Returns @X,Y. |
| 254 |
.TP |
| 255 |
\fBwinop raise\fR ?\fIwindow\fR?... |
| 256 |
Raises \fIwindow\fR to the top of the X window stack. \fIWindow\fR must be |
| 257 |
a valid path name of a Tk window. This command returns the empty string. |
| 258 |
.TP |
| 259 |
\fBwinop snap \fIwindow photoName\fR ?\fIwidth height\fR? |
| 260 |
Takes a snapshot of the \fIwindow\fR and stores the contents in the |
| 261 |
photo image \fIphotoName\fR. \fIWindow\fR is the valid path name of a |
| 262 |
Tk window which must be totally visible (unobscured). \fIPhotoName\fR |
| 263 |
is the name of a Tk photo image which must already exist. This command |
| 264 |
can fail if the window is obscured in any fashion, such as covered by |
| 265 |
another window or partially offscreen. In that case, an error message |
| 266 |
is returned. If \fIwidth\fR or \fIheight\fR is given, the image is |
| 267 |
resampled to the given size. |
| 268 |
.TP |
| 269 |
\fBwinop unmap\fR ?\fIwindow\fR?... |
| 270 |
Unmaps \fIwindow\fR from the screen. \fIWindow\fR is the path name of a Tk |
| 271 |
window. |
| 272 |
.TP |
| 273 |
\fBwinop warpto\fR ?\fIwindow\fR? |
| 274 |
Warps the pointer to \fIwindow\fR. \fIWindow\fR is the path name of a Tk window |
| 275 |
which must be mapped. If \fIwindow\fR is in the form \fI@x,y\fR, where |
| 276 |
\fIx\fR and \fIy\fR are root screen coordinates, the pointer is warped to |
| 277 |
that location on the screen. |
| 278 |
.sp |
| 279 |
[\fII've never heard a good case for warping the pointer in an |
| 280 |
application. It can be useful for testing, but in applications, it's |
| 281 |
always a bad idea. Simply stated, the user owns the pointer, not the |
| 282 |
application. If you have an application that needs it, I'd like to |
| 283 |
hear about it.\fR] |
| 284 |
.sp |
| 285 |
If no \fIwindow\fR argument is present the current location of the |
| 286 |
pointer is returned. The location is returned as a list in the form |
| 287 |
"\fIx y\fR", where \fIx\fR and \fIy\fR are the current coordinates of |
| 288 |
the pointer. |
| 289 |
.SH KEYWORDS |
| 290 |
window, map, raise, lower, pointer, warp |
| 291 |
|