LibInsane  1.0.10
Cross-platform Cross-API Cross-driver Cross-image-scanner Image Scan Library
Libinsane structure

Let the insanity begin !

The end goal of Libinsane is to have a consistent behavior across all scan APIs, all scanners, and all drivers. All the workarounds and weird quirks should be implemented in Libinsane and not the applications using it.

For that purpose, Libinsane provides a bunch of components, each solving a specific problem (working around a bug, normalizing the behavior of drivers, etc).

These components all implement a normalized C API (think object-oriented interface). This API provides a generic way to access scanners and their options and a generic way to scan. In other words, there is a single API implemented by all components. Many of the components actually just wrap other implementations with their own, changing slightly the behavior of the wrapped component.

  • Component for WIA support (Windows) implements the normalized API.
  • Component for Twain support (Windows) implements the normalized API.
  • Component for Sane support (Linux) implements the normalized API.
  • Workaround components wraps the normalized API provided by others, and provide themselves an implementation of the normalized API.
  • Behavior normalization components wraps too the normalized API provided by others, and provide themselves an implementation of the normalized API.
  • One of the components makes it possible to access multiple components at the same time: It wraps multiple implementations of the normalized API and provides a single implementation.
  • GObject Introspection support simply wrap any implementation of the normalized API.

I think at this point, you get the idea ?

Since most of the components wrap other components, they can be stacked easily each on top of another and can be enabled or disabled easily.

While it may sound like a lot of wrapping and layers, this approach allows modularity. Any workaround or behavior normalization component can be enabled or disabled easily for debugging and clear separation of concerns is ensured.