GNOME Bugzilla – Bug 147962
Port TWAIN plug-in to Mac OS X
Last modified: 2004-12-22 21:47:04 UTC
The TWAIN scanning plugin is currently Win32-only, but it would be useful to have on Macintosh as well. Various scanner drivers on Mac OS X are provided as TWAIN data sources; also there's a TWAIN front-end for SANE which some users may install without a working xscanimage plugin, and this is known not to work with Image Capture. (TWAIN sources that do work with Image Capture may be invoked via the MacClipboard plugin [http://leuksman.com/mac/gimp/] but the transfer method used for the service is inefficient for large images, with intermediate TIFF compression and huge buffers galore.)
I've managed to get it to compile; will post patches once it's actually working.
Created attachment 29729 [details] [review] Initial patch Initial patch; seems to work with the TWAIN-SANE bridge and SANE's test driver; I haven't yet tried it with a real scanner. Doesn't yet include build or documentation fixes, and there are some weird issues with trying to cancel. At least on my machine, canceling the source selection doesn't return the expected cancel response and it goes on to offer to scan anyway. I don't think this will break building on Win32, but I haven't yet tested it there.
Created attachment 29730 [details] Temporary makefile (haven't yet merged build fixes into the den of scariness that is autoconf/automake)
That's quite a lot of #ifdef's. Is there no way the platform-specific code can be abstracted into separate C files? The code used to be ugly already but now it starts to become unreadable.
Will do. I still have to work out a crashing problem with the Epson driver anyway... urk.
Created attachment 29814 [details] [review] Patch without #ifdef hell; now with build fixes Platform-specific bits have been moved into separate files to reduce the #ifdef hell. Now builds, installs, and runs on Mac OS X with the regular autoconf build. I haven't got a Win32 build environment set up to test yet, so may be broken there.
Created attachment 29815 [details] Dock icon (plug-ins/twain/gimp-twain.png) Quick dock icon I threw together so you don't have to look at the ugly terminal icon that shows up by default when the UI is activated.
Created attachment 29893 [details] [review] Updated patch fixes Win32 build, sets resolution on image Finally got a win32 build setup; slight tweaks to build and run correctly on win32 again. Also added the setting of the image resolution, which is not being done in the current version.
Very nicely done. I have now committed this patch with some tiny modifications. I might have messed things up, so please check if things still work on both supported platforms. 2004-07-28 Sven Neumann <sven@gimp.org> Applied a patch from Brion Vibber that makes the TWAIN plug-in available on Mac OS X (bug #147962): * configure.in * plug-ins/Makefile.am: check for Mac OS X twain support. * plug-ins/twain/Makefile.am * plug-ins/twain/tw_local.h * plug-ins/twain/tw_mac.c * plug-ins/twain/tw_platform.h * plug-ins/twain/tw_win.c: new files with platform specific code. * plug-ins/twain/README * plug-ins/twain/tw_dump.[ch] * plug-ins/twain/tw_func.[ch] * plug-ins/twain/tw_util.[ch] * plug-ins/twain/twain.c: changed accordingly. * plug-ins/twain/gimp-twain.png: twain application icon used by the Mac port. * plug-ins/twain/tw_sess.c: removed, doesn't seem to be used.