blt::winop(3tcl)
β¨ NAME β¨
blt::winop β Perform assorted window and image operations π
Okay so this is the manual page for blt::winop(3tcl) from the BLT Built-In Commands squad. If you need to do window + image ops with low-level Xlib energy, bestie, you're in the right place. No cap. π¦
πΈ SYNOPSIS πΈ
winop changes window
winop gradients leftcolor rightcolor gradients
winop image subcommand ...
winop image alpha srcImage destImage color
winop image colors ?-alpha? srcImage
winop image convolve srcImage destImage filter
winop image gradient image leftcolor rightcolor ...
winop image merge srcImage1 srcImage2 destImage ?alpha? ?...?
winop image mirror srcImage1 destImage ?x|y|xy|tile|outer|inner?
winop image quantize srcImage destImage ?nColors?
winop image readjpeg filename photoname
winop image resample srcImage destImage ?horizFilter?
?vertFilter?
winop image rotate srcImage destImage angle
winop image subsample srcImage destImage x y width height
?horizFilter? ?vertFilter?
winop lower ?window?...
winop map ?window?...
winop move window x y
winop query
winop raise ?window?...
winop snap window photoName ?width height ?
winop unmap ?window?...
winop warpto ?window?
π DESCRIPTION π
The winop command does a whole bunch of window and image operations on Tk windows, and it does them by calling low-level Xlib functions directly β specifically to work around window manager pecularities. πβ¨
π INTRODUCTION π
Tk already has commands for messing with its windows: raise, lower, wm, etc. The thing is, those commands ask the window manager to do the operation on Tk windows. And sometimes a particular window manager just won't do it the way you expected. Rude. π
For example, if you positioned a toplevel window using wm geometry, the window may not actually be at those exact coordinates. The position may be offset by the dimensions of the title bar that the window manager adds. It's giving "I moved it but not really." π
In situations like these, winop can be used to workaround these difficulties. Instead, it makes low-level Xlib calls (like XRaiseWindow and XMapWindow) to perform these operations. Slay. π
toplevel .top
wm withdraw .top
# Set the geometry to make the window manager
# place the window.
wm geometry .top +100+100
# Move the window to the desired location
# and "update" to force the window manager
# to recognize it.
winop move .top 100 100
update
wm deiconify .top
winop move .top 100 100
π OPERATIONS π
Here are all the operations you can throw at the winop command:
winop changes windowβ Realizeswindow. Like, makes it exist for real. β¨winop image subcommand ...β The image sub-command zone. πwinop image alpha ?-shift? srcImage destImage color ?alpha? ?withalpha?β Sets image pixels of the given color to transparent. If you don't give an alpha value, it defaults to0(which means transparent). An alpha of255is solid. ThesrcImageanddestImagecan be the same. If the color is*, any color is matched. If color is prefixed with!, the match is inverted. Iconic. π₯winop gradients leftcolor rightcolor widthβ Returns a list ofwidthcolors that graduate fromleftcolorto the color just beforerightcolor. Heads up: the last color in the returned list is notrightcolor. A typical use for this is calculating shadow colors. πwinop image blur srcImage dstImage ?radius?β Blurs an image using gaussian blur. Soft focus moment. π¦winop image colors ?-alpha? ?-count? srcImageβ Returns a list of distinct colors. If-alphais given, the alpha is appended to each color after a colon, e.g.#FF0000:00. If-countis given, it returns color/count pairs. πwinop image convolve srcImage destImage filterβ Convolves an image:filteris a list of numbers. ThesrcImageanddestImagecan be the same. Math but make it aesthetic. β¨winop image gradient image leftcolor rightcolor ...β Generates a gradient from left to right intoimage. These options are available:-type halfsine|sine|linear|rectangular|radial|split|blankβ Sets the type of gradient. The default issine.-skew Nβ The skew determines the initial fraction of the image that the gradient occupies, after which onlyrightcoloris used. The skew must be> 0and<= 1.0. The default value is1.0, meaning not skewed.-slant Nβ Makes the gradient slant, where a value of1.0slants at 45 degrees. The value must be between-100.0and100.0.-mathval Nβ Curves the gradient by passing the Y position to the function-mathfunc. The value must be between-100.0and100.0(typically1.0). The default is0.0, which means disabled.-mathfunc Xβ Function to use with-mathval. The default value issin. The value must be one of:sincostansinhcoshtanhasinacosatanloglog10expsqrtrandcircle.-rand Nβ Adds small random purturbations to the gradient to avoid striation lines. The value must be between0.0and0.1.-height Nβ Changes the image height.-width Nβ Changes the image width.
winop image merge srcImage1 srcImage2 destImage ?opacity? ?opacity2?β Merges two images with alpha blending. The default?opacity?is0.5, and the default for?opacity2?is1.0 - ?opacity?.winop image mirror srcImage1 destImage ?x|y|xy|tile|outer|inner? ?halo?β Flips an image on axisx,yorxy. Thetileoption results in a double size image with mirror copies appended to generate a tile-able image. Theouteroption is used to resize an image while preserving the outside border byhalopixels (default is16). Theinneroption copies from the center of source keeping it centered. These last 2 are used implicitly byblt::tile::button -bdtile, etc. ThesrcImage1anddestImagemust not be the same if usingtile,innerorouter. The default isxy.winop image quantize srcImage destImage ?nColors?β Limits the number of colors in an image. Default1. ThesrcImageanddestImagecan be the same.winop image readjpeg filename photonameβ Reads a jpeg image using libjpeg. IMG makes this obsolete (and thus probably not builtin). πwinop image recolor srcImage destImage oldColor newColor ?alpha?β Changes pixels fromoldColortonewColor. If?alpha?is not given, it defaults to255(opaque). ThesrcImageanddestImagecan be the same.winop image resample srcImage destImage ?horizFilter? ?vertFilter?β Resamples an image. IfsrcImageanddestImageare the same size, it just makes a copy. Otherwise the image is resized to the size ofdestImage, possibly wih filtering. Filters are one of:bellbesselboxbsplinecatromdefaultdummygauss8gaussiangilanczos3mitchellnonesinctriangle. ThedestImagemust be greater than1x1.winop image rotate srcImage destImage angleβ Rotates an image. ThesrcImageanddestImagecan be the same.winop image subsample srcImage destImage x y width height ?horizFilter? ?vertFilter?β Resamples an area of an image. Seeresample.winop image trans image x y ?alpha?β Gets or sets the integer alpha value within an image.
winop lower ?window?...β Lowerswindowto the bottom of the X window stack.Windowis the path name of a Tk window. Down bad, but for windows. πwinop map ?window?...β Mapswindowon the screen.Windowis the path name of a Tk window. Ifwindowis already mapped, this command has no effect.winop move window x yβ Moveswindowto the screen location specified byxandy.Windowis the path name of a Tk window, whilexandyare screen coordinates. This command returns the empty string.winop queryβ Queries pointer position. Returns@X,Y.winop raise ?window?...β Raiseswindowto the top of the X window stack.Windowmust be a valid path name of a Tk window. This command returns the empty string. Main character energy. πwinop snap window photoName ?width height?β Takes a snapshot of the window and stores the contents in the photo imagephotoName.Windowis the valid path name of a Tk window which must be totally visible (unobscured).PhotoNameis the name of a Tk photo image which must already exist. This command can fail if the window is obscured in any fashion, such as covered by another window or partially offscreen. In that case, an error message is returned. Ifwidthorheightis given, the image is resampled to the given size.winop unmap ?window?...β Unmapswindowfrom the screen.Windowis the path name of a Tk window.winop warpto ?window?β Warps the pointer towindow.Windowis the path name of a Tk window which must be mapped. Ifwindowis in the form@x,y, wherexandyare root screen coordinates, the pointer is warped to that location on the screen.
[I've never heard a good case for warping the pointer in an application. It can be useful for testing, but in applications, it's always a bad idea. Simply stated, the user owns the pointer, not the application. If you have an application that needs it, I'd like to hear about it.]
If no window argument is present, the current location of the pointer is returned. The location is returned as a list in the form "x y", where x and y are the current coordinates of the pointer.
π KEYWORDS π
window, map, raise, lower, pointer, warp
That's the whole vibe, bestie. This page is from BLT 2.5, the blt::winop(3tcl) manual β the footer didn't give us a date, so we're just gonna say it's classic BLT era energy. πβ¨
π¦ where this page comes from
- debian bookworm: blt-dev 2.5.3+dfsg-4.1
- debian trixie: blt-dev 2.5.3+dfsg-8
- ubuntu jammy: blt-dev 2.5.3+dfsg-4.1build2
- ubuntu noble: blt-dev 2.5.3+dfsg-7build1
- ubuntu questing: blt-dev 2.5.3+dfsg-8
- ubuntu resolute: blt-dev 2.5.3+dfsg-8build1
- ubuntu stonking: blt-dev 2.5.3+dfsg-9
- Copyright 1991-1997 by Bell Labs Innovations for Lucent Technologies
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms