LibInsane
1.0.10
Cross-platform Cross-API Cross-driver Cross-image-scanner Image Scan Library
|
#include "capi.h"
Go to the source code of this file.
Functions | |
enum lis_error | lis_api_normalizer_source_nodes (struct lis_api *to_wrap, struct lis_api **out_impl) |
Ensure that sources are represented as node. More... | |
enum lis_error | lis_api_normalizer_min_one_source (struct lis_api *to_wrap, struct lis_api **out_impl) |
Ensure there is at least one source. More... | |
enum lis_error | lis_api_normalizer_all_opts_on_all_sources (struct lis_api *to_wrap, struct lis_api **out_impl) |
Ensure all options are available on sources. More... | |
enum lis_error | lis_api_normalizer_opt_aliases (struct lis_api *to_wrap, struct lis_api **out_impl) |
Make aliases for some options. More... | |
enum lis_error | lis_api_normalizer_resolution (struct lis_api *to_wrap, struct lis_api **out_impl) |
Ensure resolution constraint is always in the same format. More... | |
enum lis_error | lis_api_normalizer_source_types (struct lis_api *to_wrap, struct lis_api **out_impl) |
Ensure source types are clearly identified. More... | |
enum lis_error | lis_api_normalizer_bmp2raw (struct lis_api *to_wrap, struct lis_api **out_impl) |
Ensure the output format is RAW. More... | |
enum lis_error | lis_api_normalizer_raw24 (struct lis_api *to_wrap, struct lis_api **out_impl) |
Ensure the output format is RAW24. More... | |
enum lis_error | lis_api_normalizer_safe_defaults (struct lis_api *to_wrap, struct lis_api **out_impl) |
Set safest default values. More... | |
enum lis_error | lis_api_normalizer_source_names (struct lis_api *to_wrap, struct lis_api **out_impl) |
Makes sure the source names all look the same accross OSes. More... | |
enum lis_error | lis_api_normalizer_clean_dev_descs (struct lis_api *to_wrap, struct lis_api **out_impl) |
Clean device descriptors (name, model, etc) More... | |
enum lis_error lis_api_normalizer_all_opts_on_all_sources | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Ensure all options are available on sources.
Goal: Makes sure the application can find easily options by making the scanner options available on all its sources.
Sane: Only the scanner itself has options. Options must all be mapped too on all its sources.
WIA: Some options are on the scanner itself, some options are on the sources. Scanner options must be mapped on all its sources.
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
Ensure the output format is RAW.
Always getting the image as RAW24 is much more handy if you want to display the scan on-the-fly.
Sane: Image is always returned as RAW (unless some scanner-specific options are set to non-default values).
WIA2: Drivers may return the image in a variety of file formats: RAW, BMP, JPEG, PNG, etc. Not all drivers support returning the image as RAW24. LibInsane supports only BMP and will output the image as RAW24. WIA2 drivers must support the BMP format (Microsoft documentation states that they all must).
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
enum lis_error lis_api_normalizer_clean_dev_descs | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Clean device descriptors (name, model, etc)
If the model name contains also the manufacturer name, this workaround strips it.
Random example:
Will become:
Special case: HP. Manufacturer is "hewlett-packard", but model names contain the prefix "hp".
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
enum lis_error lis_api_normalizer_min_one_source | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Ensure there is at least one source.
Sane: Some scanner do not provide the option "source".
WIA2: Some scanners do not always provide a source. Scan is done directly on them.
If there is no source at all, this normalization will create a fake one.
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
enum lis_error lis_api_normalizer_opt_aliases | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Make aliases for some options.
Sane: Sane scan area options are used as reference.
WIA2: Fake options are added to simulate Sane options. They act like Sane options, and any change to these options is applied back to the WIA2 options.
WIA2 provides to options 'xres' and 'yres'. This normalizer will create an alias option 'resolution' that will set both options. 'xres' is used for reading the value.
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
Ensure the output format is RAW24.
Sane can return the image as various raw formats: RAW1 (B&W), RAW8 (Grayscale), RAW24 (RGB), etc.
This normalization ensures the output image is always in RAW24 (RGB).
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
enum lis_error lis_api_normalizer_resolution | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Ensure resolution constraint is always in the same format.
Sane and WIA: Resolution constraint can be expressed as a range or as a list of possible values. This normalization makes sure they are always expressed as a list. If the range has an interval < 25dpi, the interval used to generate the list will be 25dpi.
Sane: Resolution can be expressed as integers or as SANE_Fixed values (16 bits integer / 16 bits non-integer) (converted as float for the C API)
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
enum lis_error lis_api_normalizer_safe_defaults | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Set safest default values.
By default, some drivers don't have the scan area set to the maximum. This workaround just make sure the default area is the maximum area. It may be handy if you don't want to scan a specific area.
By default, some drivers don't have the mode set to color. This workaround just make sure the default mode is 24bits color.
Requires: lis_api_workaround_opt_values
Fujistu provides 2 extra settings, 'page-height' and 'page-width'. 'page-height' use case is unknown, but 'page-width' is used for automatic centering of the page. The default values are bad and this feature is specific to Fujistu ==> set them to the max by default to disable automatic centering.
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
enum lis_error lis_api_normalizer_source_names | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Makes sure the source names all look the same accross OSes.
Exanples when using WIA:
Examples when using Sane:
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
enum lis_error lis_api_normalizer_source_nodes | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Ensure that sources are represented as node.
WIA2: For each scanner, provides a device tree (see :ref:WIA2
description).
Sane: There is no tree (see :ref:Sane
description). Children nodes (sources) are simulated based on the values of the option 'source'.
TWAIN: There is no tree (see :ref:TWAIN
description). Children nodes (sources) are simulated based on the values of the option 'feeder_enabled'.
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |
enum lis_error lis_api_normalizer_source_types | ( | struct lis_api * | to_wrap, |
struct lis_api ** | out_impl | ||
) |
Ensure source types are clearly identified.
Sane: Sources have "name", but the exact names are up to the drivers.
WIA2: source types are already clearly defined.
See lis_item::type.
[in] | to_wrap | Base implementation to wrap. |
[out] | out_impl | Implementation of the out_impl including the workaround. |