After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 147962 - Port TWAIN plug-in to Mac OS X
Port TWAIN plug-in to Mac OS X
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other Mac OS
: Normal enhancement
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2004-07-20 08:39 UTC by Brion Vibber
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Initial patch (18.88 KB, patch)
2004-07-21 09:43 UTC, Brion Vibber
none Details | Review
Temporary makefile (736 bytes, text/plain)
2004-07-21 09:45 UTC, Brion Vibber
  Details
Patch without #ifdef hell; now with build fixes (57.54 KB, patch)
2004-07-23 07:16 UTC, Brion Vibber
none Details | Review
Dock icon (plug-ins/twain/gimp-twain.png) (13.53 KB, image/png)
2004-07-23 07:18 UTC, Brion Vibber
  Details
Updated patch fixes Win32 build, sets resolution on image (58.46 KB, patch)
2004-07-26 10:05 UTC, Brion Vibber
none Details | Review

Description Brion Vibber 2004-07-20 08:39:14 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.)
Comment 1 Brion Vibber 2004-07-20 23:00:49 UTC
I've managed to get it to compile; will post patches once it's actually working.
Comment 2 Brion Vibber 2004-07-21 09:43:47 UTC
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.
Comment 3 Brion Vibber 2004-07-21 09:45:23 UTC
Created attachment 29730 [details]
Temporary makefile

(haven't yet merged build fixes into the den of scariness that is
autoconf/automake)
Comment 4 Sven Neumann 2004-07-21 09:59:32 UTC
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.
Comment 5 Brion Vibber 2004-07-21 18:14:27 UTC
Will do. I still have to work out a crashing problem with the Epson driver anyway... urk.
Comment 6 Brion Vibber 2004-07-23 07:16:44 UTC
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.
Comment 7 Brion Vibber 2004-07-23 07:18:51 UTC
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.
Comment 8 Brion Vibber 2004-07-26 10:05:04 UTC
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.
Comment 9 Sven Neumann 2004-07-28 15:56:21 UTC
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.