Version 23 of NJG

Updated 2005-03-26 06:23:22

January 1, 2005

Moved introduction to Németh József Gábor e-mail: [L1 ]

Contributed pages (in reverse chronological order)

  • A regexp extension -- a companion to A regexp twist
  • A regexp twist -- with this extension regexp can be made to execute at each match a specified Tcl script that may make use of the result of the match
  • Yet another dll caller -- extension for calling functions in dynamic libraries from Tcl scripts; comes handy if you work in winNT/win2k/winXP and want to access the system API
  • Enhanced photo image copy command -- extension that provides arbitrary rotation and continuous scaling + filtering of photo images
  • vfs::zip -- log of finding a couple of subtle bugs in the vfs::zip virtual file system

Contribution to pages (in reverse chronological order)


July 8, 2004

For Xmas 2000 I bought a Kodak DCS280 digital camera and soon was compelled to provide a simple tool for my family whereby they could browse through the piling heap of shots and select those to get a photo print of. That was when I realized how limited the photo image handling capability of Tk was. The irritation I firs felt grew on me as I had to listen to the repeating complaint about how neck breaking it was to look at portrait shots in landscape display. Although I had never set my eyes on the Tcl/Tk sources before and I had not had much experience in C programming either, I decided to correct the situation.

First I located the appropriate source file, tkImgPhoto.c. I was enormously relieved to find that to change the orientation of a photo image required only the manipulation of the pointers in the defining struct. It was only a bit harder to find the way to add a new option, -roll ?integer?. I patched up the source, recompiled Tk and the complaints died.

Frustration gone itching set in: I wanted arbitrary rotation and scaling. First I defined a new image type rawpix to be able to dump/load photo image pixels to/from files. (This way I was able to generate geometric images for testing.) Not to be forced to continuously recompile Tk then I created a new command, rotate <rotate amount> ?<scale amount>?, as a shell for the development. Only when I had a reasonably tested code did I merge it into tkImgPhoto.c. By June 2001 I declared the project completed and until recently the only thing I did with it was that in each new release of Tcl/Tk I almost blindly replaced tkImgPhoto.c with my version.

Why was I sitting on it this long? First I had no convenient means of publishing it: I did not know about this wiki and I had no decent presence on the Internet. Second, I thought it needed more testing, some beautifying of the code and the addition of some features I left out of pure laziness. Finally, when (seeing the growing interest for image transformations on this wiki)I was on the verge of coming out with what I did tcl-magick hit me in the eye and then again TclMagick.

Why then the sudden urge?

For a long period not only there has been no development involving Tk's photo image manipulation but none even has been suggested. So when the announcement of TclMagick (first tcl-magick) appeared on this wiki I myself also thought that was the way to go. But when I merged my code into tkImgPhoto.c in the 8.4.6 release I noticed a functional (as opposed to cosmetic or bugfix) modification (concerning alpha blending). It was that started the itching again. Interested about the result? Then look at Enhanced photo image copy command


RS: Üdvözöljük a Tcl Wiki (welcome to the Tcl Wiki)! Your work on enhanced photo copy looks very promising - hope it will soon make it into the Tk core! CL says, "me, too": I like this page, and I like what I've seen of your [photo] work. Keep up the good work!


Category Home Page