genesys: Add option to get a raw scan ignoring offsets

merge-requests/99/head
Povilas Kanapickas 2019-07-13 04:14:45 +03:00
rodzic 144ed1f29b
commit 1a5e3944b3
4 zmienionych plików z 37 dodań i 6 usunięć

Wyświetl plik

@ -5823,6 +5823,18 @@ init_options (Genesys_Scanner * s)
s->opt[OPT_FORCE_CALIBRATION].cap =
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED;
// ignore offsets option
s->opt[OPT_IGNORE_OFFSETS].name = "ignore-internal-offsets";
s->opt[OPT_IGNORE_OFFSETS].title = SANE_I18N("Ignore internal offsets");
s->opt[OPT_IGNORE_OFFSETS].desc =
SANE_I18N("Acquires the image including the internal calibration areas of the scanner");
s->opt[OPT_IGNORE_OFFSETS].type = SANE_TYPE_BUTTON;
s->opt[OPT_IGNORE_OFFSETS].unit = SANE_UNIT_NONE;
s->opt[OPT_IGNORE_OFFSETS].size = 0;
s->opt[OPT_IGNORE_OFFSETS].constraint_type = SANE_CONSTRAINT_NONE;
s->opt[OPT_IGNORE_OFFSETS].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT |
SANE_CAP_ADVANCED;
RIE (calc_parameters (s));
DBGCOMPLETED;
@ -7112,6 +7124,10 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
*myinfo |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS;
break;
case OPT_IGNORE_OFFSETS: {
s->dev->ignore_offsets = true;
break;
}
default:
DBG(DBG_warn, "%s: can't set unknown option %d\n", __func__, option);
}

Wyświetl plik

@ -142,6 +142,7 @@ enum Genesys_Option
OPT_CALIBRATE,
OPT_CLEAR_CALIBRATION,
OPT_FORCE_CALIBRATION,
OPT_IGNORE_OFFSETS,
/* must come last: */
NUM_OPTIONS

Wyświetl plik

@ -3037,16 +3037,26 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
move_dpi = dev->motor.base_ydpi;
flags = 0;
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
{
// note: move_to_ta() function has already been called and the sensor is at the
// transparency adapter
move = SANE_UNFIX(dev->model->y_offset_ta) - SANE_UNFIX(dev->model->y_offset_sensor_to_ta);
flags |= SCAN_FLAG_USE_XPA;
}
else
move = SANE_UNFIX(dev->model->y_offset);
if (dev->ignore_offsets) {
move = 0;
} else {
move = SANE_UNFIX(dev->model->y_offset_ta) -
SANE_UNFIX(dev->model->y_offset_sensor_to_ta);
}
flags |= SCAN_FLAG_USE_XPA;
} else {
if (dev->ignore_offsets) {
move = 0;
} else {
move = SANE_UNFIX(dev->model->y_offset);
}
}
move += dev->settings.tl_y;
move = (move * move_dpi) / MM_PER_INCH;

Wyświetl plik

@ -1512,6 +1512,10 @@ struct Genesys_Device
// if enabled, no calibration data will be loaded or saved to files
SANE_Int force_calibration = 0;
// if enabled, will ignore the scan offsets and start scanning at true origin. This allows
// acquiring the positions of the black and white strips and the actual scan area
bool ignore_offsets = false;
Genesys_Model *model = nullptr;
Genesys_Register_Set reg;