gimp/plug-ins/twain
Jehan d493f0537f Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!

Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.

As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.

Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.

Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-08-02 10:46:38 +02:00
..
README Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
gimp-twain.png Applied a patch from Brion Vibber that makes the TWAIN plug-in available 2004-07-28 15:54:50 +00:00
meson.build build/windows: Add MS Store dist script 2024-04-21 18:12:38 -03:00
tw_dump.c Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
tw_dump.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
tw_func.c plug-ins: silence some warnings in twain plug-in. 2020-09-18 17:51:55 -04:00
tw_func.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
tw_local.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
tw_platform.h Use LoadLibraryW () 2023-01-24 14:48:44 +00:00
tw_util.c Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
tw_util.h Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
tw_win.c Use GetModuleHandleW () 2023-01-24 14:48:44 +00:00
twain.c Issue #8900 and #9923: reimplementing GimpUnit as a proper class. 2024-08-02 10:46:38 +02:00
twain.h plug-ins: fix #3854 by porting twain to the new plugin framework. 2020-09-18 17:51:55 -04:00

README

TWAIN Plug-in
Copyright (C) 1999 Craig Setera
Craig Setera <setera@home.com>
03/31/1999

Updated for Mac OS X support
Brion Vibber <brion@pobox.com>
07/22/2004

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Based on (at least) the following plug-ins:
Screenshot
GIF
Randomize

Any suggestions, bug-reports or patches are welcome.
 
This plug-in interfaces to the TWAIN support library in order
to capture images from TWAIN devices directly into GIMP images.
The plug-in is capable of acquiring the following type of
images:
 - B/W (1 bit images translated to grayscale B/W)
 - Grayscale up to 16 bits per pixel
 - RGB up to 16 bits per sample (24, 30, 36, etc.)
 - Paletted images (both Gray and RGB)

Prerequisites:
 Should compile and run on both Win32 and Mac OS X 10.3 (possibly
 also on 10.2).

Known problems:

 - Multiple image transfers will hang the plug-in.  The current
   configuration compiles with a maximum of single image transfers.
 - On Mac OS X, canceling doesn't always close things out fully.
 - Epson TWAIN driver on Mac OS X crashes the plugin when scanning.
 
Debugging:
 There are two different versions of the program included, a standard
 version and a version built for debugging.  The debugging version is
 a special version capable of capturing the TWAIN datasource data to
 a file for later processing.  This feature can be used to create a data
 dump that can be sent to me if for some reason the plug-in fails for
 your TWAIN datasource.  The function of the plug-in is controlled by
 the name of the executable file.  The plug-in should be placed in your
 plug-ins directory and named as follows:

twain.exe - This is the standard (non-debugging) version.  This file will
  not behave differently if renamed.  This version is intended to be used
  unless your TWAIN datasource has some problem.

gtwain.exe - This is the debugging version of the program shipped along.
  If this program is used as named, it will behave the same as "twain.exe"
  except that the file C:\twain.log will be written.  This file is a text
  file with very little information available for debugging.

dtwain.exe - Renaming "gtwain.exe" to "dtwain.exe" in your plug-ins directory
  will change the behavior of the plug-in.  The menu option will be registered
  as "TWAIN Acquire (Dump)..." and will cause the TWAIN acquire operation to
  be dumped to the file "C:\twaincap.bin".  This file contains all of the data
  necessary to recreate the capture on another system (such as my machine).  The
  image will not be displayed, as it might cause the plug-in to crash making
  the data useless.  Instead, a message will be displayed that the image
  information was dumped to a file.

rtwain.exe - Renaming "gtwain.exe" to "rtwain.exe" in your plug-ins directory
  will change the behavior of the plug-in.  The menu option will be registered
  as "TWAIN Acquire (Read)..." and will cause the TWAIN acquire operation to
  read a previously dumped (using dtwain.exe) TWAIN acquire from 
  "C:\twaincap.bin".

If you find that you are unable to capture data from you datasource (the plug-in
crashes or the image is wrong), please capture data using the following steps:

1) Copy gtwain.exe to your plug-ins directory as "dtwain.exe".
2) Run GIMP.
3) Choose Xtns->TWAIN Acquire (Dump)...
4) Choose the datasource settings that are causing problems.
5) Choose a *SMALL* sample image.
6) Zip up "C:\twaincap.bin" and "C:\twain.log" and send them to me.