kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Refactor scan color mode into an enum
rodzic
723426d78b
commit
6e657e3eac
|
@ -964,7 +964,8 @@ genesys_send_offset_and_shading (Genesys_Device * dev, const Genesys_Sensor& sen
|
|||
/* TODO invert the test so only the 2 models behaving like that are
|
||||
* tested instead of adding all the others */
|
||||
/* many scanners send coefficient for lineart/gray like in color mode */
|
||||
if (dev->settings.scan_mode < 2
|
||||
if ((dev->settings.scan_mode == ScanColorMode::LINEART ||
|
||||
dev->settings.scan_mode == ScanColorMode::HALFTONE)
|
||||
&& dev->model->ccd_type != CCD_PLUSTEK3800
|
||||
&& dev->model->ccd_type != CCD_KVSS080
|
||||
&& dev->model->ccd_type != CCD_G4050
|
||||
|
@ -1033,10 +1034,15 @@ sanei_genesys_init_shading_data (Genesys_Device * dev, const Genesys_Sensor& sen
|
|||
|
||||
DBG(DBG_proc, "%s (pixels_per_line = %d)\n", __func__, pixels_per_line);
|
||||
|
||||
if (dev->settings.scan_mode >= 2) /* 3 pass or single pass color */
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
// BUG: GRAY shouldn't probably be in the if condition below. Discovered when refactoring
|
||||
if (dev->settings.scan_mode == ScanColorMode::GRAY ||
|
||||
dev->settings.scan_mode == ScanColorMode::COLOR_MULTI_PASS ||
|
||||
dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
channels = 3;
|
||||
} else {
|
||||
channels = 1;
|
||||
}
|
||||
|
||||
// 16 bit black, 16 bit white
|
||||
std::vector<uint8_t> shading_data(pixels_per_line * 4 * channels, 0);
|
||||
|
@ -1409,7 +1415,7 @@ genesys_average_black (Genesys_Device * dev, int channel,
|
|||
|
||||
sum = 0;
|
||||
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
data += (channel * 2);
|
||||
pixel_step = 3 * 2;
|
||||
|
@ -1446,12 +1452,12 @@ static SANE_Status genesys_coarse_calibration(Genesys_Device * dev, Genesys_Sens
|
|||
uint16_t white[12], dark[12];
|
||||
int i, j;
|
||||
|
||||
DBG(DBG_info, "%s (scan_mode = %d)\n", __func__, dev->settings.scan_mode);
|
||||
DBG(DBG_info, "%s (scan_mode = %d)\n", __func__, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
black_pixels = sensor.black_pixels
|
||||
* dev->settings.xres / sensor.optical_res;
|
||||
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
@ -1638,7 +1644,7 @@ static SANE_Status genesys_coarse_calibration(Genesys_Device * dev, Genesys_Sens
|
|||
DBG(DBG_error, "%s: Failed to end scan: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1664,7 +1670,7 @@ static SANE_Status genesys_coarse_calibration(Genesys_Device * dev, Genesys_Sens
|
|||
|
||||
if (i == 3)
|
||||
{
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
/* todo: huh? */
|
||||
dev->dark[0] =
|
||||
|
@ -4148,7 +4154,7 @@ genesys_fill_segmented_buffer (Genesys_Device * dev, uint8_t *work_buffer_dst, s
|
|||
int depth,i,n,k;
|
||||
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == SCAN_MODE_LINEART && dev->settings.dynamic_lineart==SANE_FALSE)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART && dev->settings.dynamic_lineart==SANE_FALSE)
|
||||
depth = 1;
|
||||
|
||||
/* fill buffer if needed */
|
||||
|
@ -4942,13 +4948,13 @@ calc_parameters (Genesys_Scanner * s)
|
|||
}
|
||||
|
||||
if (s->mode == SANE_VALUE_SCAN_MODE_COLOR) {
|
||||
s->dev->settings.scan_mode = SCAN_MODE_COLOR;
|
||||
s->dev->settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
} else if (s->mode == SANE_VALUE_SCAN_MODE_GRAY) {
|
||||
s->dev->settings.scan_mode = SCAN_MODE_GRAY;
|
||||
s->dev->settings.scan_mode = ScanColorMode::GRAY;
|
||||
} else if (s->mode == SANE_TITLE_HALFTONE) {
|
||||
s->dev->settings.scan_mode = SCAN_MODE_HALFTONE;
|
||||
s->dev->settings.scan_mode = ScanColorMode::HALFTONE;
|
||||
} else { /* Lineart */
|
||||
s->dev->settings.scan_mode = SCAN_MODE_LINEART;
|
||||
s->dev->settings.scan_mode = ScanColorMode::LINEART;
|
||||
}
|
||||
|
||||
if (s->source == STR_FLATBED) {
|
||||
|
@ -4988,7 +4994,7 @@ calc_parameters (Genesys_Scanner * s)
|
|||
/* dynamic lineart */
|
||||
s->dev->settings.dynamic_lineart = SANE_FALSE;
|
||||
s->dev->settings.threshold_curve=0;
|
||||
if (!s->disable_dynamic_lineart && s->dev->settings.scan_mode == SCAN_MODE_LINEART) {
|
||||
if (!s->disable_dynamic_lineart && s->dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
s->dev->settings.dynamic_lineart = SANE_TRUE;
|
||||
}
|
||||
|
||||
|
@ -4997,7 +5003,7 @@ calc_parameters (Genesys_Scanner * s)
|
|||
* dynamic_lineart */
|
||||
if(s->dev->settings.xres > 600
|
||||
&& s->dev->model->asic_type==GENESYS_GL847
|
||||
&& s->dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
&& s->dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
{
|
||||
s->dev->settings.dynamic_lineart = SANE_TRUE;
|
||||
}
|
||||
|
|
|
@ -687,7 +687,7 @@ gl124_init_motor_regs_scan (Genesys_Device * dev,
|
|||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
int scan_mode,
|
||||
ScanColorMode scan_mode,
|
||||
unsigned int flags)
|
||||
{
|
||||
SANE_Status status;
|
||||
|
@ -705,7 +705,8 @@ gl124_init_motor_regs_scan (Genesys_Device * dev,
|
|||
DBGSTART;
|
||||
DBG(DBG_info, "%s : scan_exposure_time=%d, scan_yres=%g, scan_step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, scan_mode=%d, flags=%x\n", __func__, scan_exposure_time,
|
||||
scan_yres, scan_step_type, scan_lines, scan_dummy, feed_steps, scan_mode, flags);
|
||||
scan_yres, scan_step_type, scan_lines, scan_dummy, feed_steps,
|
||||
static_cast<unsigned>(scan_mode), flags);
|
||||
|
||||
/* we never use fast fed since we do manual feed for the scans */
|
||||
use_fast_fed=0;
|
||||
|
@ -713,7 +714,7 @@ gl124_init_motor_regs_scan (Genesys_Device * dev,
|
|||
|
||||
/* enforce motor minimal scan speed
|
||||
* @TODO extend motor struct for this value */
|
||||
if (scan_mode == SCAN_MODE_COLOR)
|
||||
if (scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
min_speed = 900;
|
||||
}
|
||||
|
@ -801,7 +802,7 @@ gl124_init_motor_regs_scan (Genesys_Device * dev,
|
|||
fast_dpi=yres;
|
||||
|
||||
/*
|
||||
if (scan_mode != SCAN_MODE_COLOR)
|
||||
if (scan_mode != ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
fast_dpi*=3;
|
||||
}
|
||||
|
@ -1266,7 +1267,7 @@ gl124_init_scan_regs (Genesys_Device * dev,
|
|||
unsigned int depth,
|
||||
unsigned int channels,
|
||||
__sane_unused__ ScanMethod scan_method,
|
||||
int scan_mode,
|
||||
ScanColorMode scan_mode,
|
||||
int color_filter,
|
||||
unsigned int flags)
|
||||
{
|
||||
|
@ -1376,7 +1377,7 @@ gl124_init_scan_regs (Genesys_Device * dev,
|
|||
/*** optical parameters ***/
|
||||
/* in case of dynamic lineart, we use an internal 8 bit gray scan
|
||||
* to generate 1 lineart data */
|
||||
if ((flags & SCAN_FLAG_DYNAMIC_LINEART) && (scan_mode == SCAN_MODE_LINEART))
|
||||
if ((flags & SCAN_FLAG_DYNAMIC_LINEART) && (scan_mode == ScanColorMode::LINEART))
|
||||
{
|
||||
depth = 8;
|
||||
}
|
||||
|
@ -1541,17 +1542,17 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
|||
__func__,
|
||||
dev->settings.xres,
|
||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
||||
dev->settings.tl_x, dev->settings.tl_y, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == 4) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == 0)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
/* start */
|
||||
|
@ -2057,7 +2058,7 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
8,
|
||||
1,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_GRAY,
|
||||
ScanColorMode::GRAY,
|
||||
0,
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -2162,7 +2163,7 @@ gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse)
|
|||
8,
|
||||
3,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_COLOR,
|
||||
ScanColorMode::COLOR_SINGLE_PASS,
|
||||
dev->settings.color_filter,
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -2259,7 +2260,7 @@ gl124_search_start_position (Genesys_Device * dev)
|
|||
8,
|
||||
1,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_GRAY,
|
||||
ScanColorMode::GRAY,
|
||||
1, /*green */
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -2346,7 +2347,7 @@ gl124_init_regs_for_coarse_calibration(Genesys_Device* dev, const Genesys_Sensor
|
|||
cksel = (regs.find_reg(0x18).value & REG18_CKSEL) + 1; /* clock speed = 1..4 clocks */
|
||||
|
||||
/* set line size */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
@ -2444,7 +2445,7 @@ gl124_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
16,
|
||||
dev->calib_channels,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_COLOR,
|
||||
ScanColorMode::COLOR_SINGLE_PASS,
|
||||
0,
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -2497,7 +2498,7 @@ gl124_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
dev->settings.pixels,
|
||||
dev->settings.tl_x,
|
||||
dev->settings.tl_y,
|
||||
dev->settings.scan_mode);
|
||||
static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
/* wait for motor to stop first */
|
||||
status = sanei_genesys_get_status (dev, &val);
|
||||
|
@ -2541,14 +2542,14 @@ gl124_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
RIE (gl124_slow_back_home (dev, SANE_TRUE));
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR)
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
/* y (motor) distance to move to reach scanned area */
|
||||
|
@ -2582,7 +2583,7 @@ gl124_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
flags = 0;
|
||||
|
||||
/* enable emulated lineart from gray data */
|
||||
if(dev->settings.scan_mode == SCAN_MODE_LINEART
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
|
@ -2769,7 +2770,7 @@ move_to_calibration_area (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
8,
|
||||
3,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_COLOR,
|
||||
ScanColorMode::COLOR_SINGLE_PASS,
|
||||
dev->settings.color_filter,
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -2861,7 +2862,7 @@ gl124_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
depth,
|
||||
channels,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_COLOR,
|
||||
ScanColorMode::COLOR_SINGLE_PASS,
|
||||
dev->settings.color_filter,
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -3044,7 +3045,7 @@ gl124_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
bpp,
|
||||
channels,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_COLOR,
|
||||
ScanColorMode::COLOR_SINGLE_PASS,
|
||||
dev->settings.color_filter,
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -3216,7 +3217,7 @@ gl124_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
bpp,
|
||||
channels,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_COLOR,
|
||||
ScanColorMode::COLOR_SINGLE_PASS,
|
||||
dev->settings.color_filter,
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -3343,7 +3344,7 @@ gl124_init_regs_for_warmup (Genesys_Device * dev,
|
|||
8,
|
||||
*channels,
|
||||
dev->settings.scan_method,
|
||||
SCAN_MODE_COLOR,
|
||||
ScanColorMode::COLOR_SINGLE_PASS,
|
||||
dev->settings.color_filter,
|
||||
SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
|
|
@ -474,7 +474,7 @@ SANE_Status gl124_init_scan_regs (Genesys_Device * dev, const Genesys_Sensor& se
|
|||
unsigned int depth,
|
||||
unsigned int channels,
|
||||
ScanMethod scan_method,
|
||||
int scan_mode,
|
||||
ScanColorMode scan_mode,
|
||||
int color_filter,
|
||||
unsigned int flags);
|
||||
|
||||
|
|
|
@ -2503,7 +2503,7 @@ gl646_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
|
||||
/* setup for a backward scan of 65535 steps, with no actual data reading */
|
||||
settings.scan_method = ScanMethod::FLATBED;
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
settings.xres = get_lowest_resolution (dev->model->ccd_type, SANE_FALSE);
|
||||
settings.yres = settings.xres;
|
||||
settings.tl_x = 0;
|
||||
|
@ -2623,7 +2623,7 @@ gl646_search_start_position (Genesys_Device * dev)
|
|||
|
||||
/* fill settings for a gray level scan */
|
||||
settings.scan_method = ScanMethod::FLATBED;
|
||||
settings.scan_mode = SCAN_MODE_GRAY;
|
||||
settings.scan_mode = ScanColorMode::GRAY;
|
||||
settings.xres = resolution;
|
||||
settings.yres = resolution;
|
||||
settings.tl_x = 0;
|
||||
|
@ -2752,7 +2752,7 @@ gl646_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
settings.scan_mode = dev->settings.scan_mode;
|
||||
if (dev->model->is_cis == SANE_FALSE)
|
||||
{
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
}
|
||||
settings.xres = sensor.optical_res / half_ccd;
|
||||
cksel = get_cksel (dev->model->ccd_type, dev->settings.xres, SANE_TRUE);
|
||||
|
@ -2881,10 +2881,10 @@ setup_for_scan (Genesys_Device * dev,
|
|||
"Lines : %u\nPixels : %u\nStartpos : %.3f/%.3f\nScan mode : %d\nScan method: %s\n\n",
|
||||
__func__,
|
||||
settings.xres, settings.yres, settings.lines, settings.pixels,
|
||||
settings.tl_x, settings.tl_y, settings.scan_mode,
|
||||
settings.tl_x, settings.tl_y, static_cast<unsigned>(settings.scan_mode),
|
||||
settings.scan_method == ScanMethod::FLATBED ? "flatbed" : "XPA");
|
||||
|
||||
if (settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
channels = 3;
|
||||
color = SANE_TRUE;
|
||||
|
@ -2896,7 +2896,7 @@ setup_for_scan (Genesys_Device * dev,
|
|||
}
|
||||
|
||||
depth=settings.depth;
|
||||
if (settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (settings.scan_mode == ScanColorMode::LINEART)
|
||||
{
|
||||
if (settings.dynamic_lineart == SANE_TRUE)
|
||||
{
|
||||
|
@ -3148,12 +3148,12 @@ gl646_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
}
|
||||
|
||||
/* get led calibration resolution */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR)
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
resolution =
|
||||
get_closest_resolution (dev->model->ccd_type, sensor.optical_res,
|
||||
SANE_TRUE);
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
channels = 3;
|
||||
}
|
||||
else
|
||||
|
@ -3161,7 +3161,7 @@ gl646_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
resolution =
|
||||
get_closest_resolution (dev->model->ccd_type, sensor.optical_res,
|
||||
SANE_FALSE);
|
||||
settings.scan_mode = SCAN_MODE_GRAY;
|
||||
settings.scan_mode = ScanColorMode::GRAY;
|
||||
channels = 1;
|
||||
}
|
||||
|
||||
|
@ -3346,7 +3346,7 @@ ad_fe_offset_calibration (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels);
|
||||
|
||||
settings.scan_method = ScanMethod::FLATBED;
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
settings.xres = resolution;
|
||||
settings.yres = resolution;
|
||||
settings.tl_x = 0;
|
||||
|
@ -3475,7 +3475,7 @@ gl646_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels);
|
||||
|
||||
settings.scan_method = ScanMethod::FLATBED;
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
settings.xres = resolution;
|
||||
settings.yres = resolution;
|
||||
settings.tl_x = 0;
|
||||
|
@ -3631,7 +3631,7 @@ ad_fe_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
/* resolution is the one from the final scan */
|
||||
resolution = get_closest_resolution (dev->model->ccd_type, dpi, SANE_TRUE);
|
||||
channels = 3;
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
|
||||
settings.scan_method = ScanMethod::FLATBED;
|
||||
settings.xres = resolution;
|
||||
|
@ -3755,7 +3755,7 @@ gl646_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
}
|
||||
|
||||
settings.scan_method = dev->settings.scan_method;
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
settings.xres = resolution;
|
||||
settings.yres = resolution;
|
||||
settings.tl_y = 0;
|
||||
|
@ -3908,7 +3908,7 @@ gl646_init_regs_for_warmup (Genesys_Device * dev,
|
|||
|
||||
/* set up for a half width 2 lines gray scan without moving */
|
||||
settings.scan_method = ScanMethod::FLATBED;
|
||||
settings.scan_mode = SCAN_MODE_GRAY;
|
||||
settings.scan_mode = ScanColorMode::GRAY;
|
||||
settings.xres = resolution;
|
||||
settings.yres = resolution;
|
||||
settings.tl_x = 0;
|
||||
|
@ -3975,7 +3975,7 @@ gl646_repark_head (Genesys_Device * dev)
|
|||
DBG(DBG_proc, "%s: start\n", __func__);
|
||||
|
||||
settings.scan_method = ScanMethod::FLATBED;
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
settings.xres =
|
||||
get_closest_resolution (dev->model->ccd_type, 75, SANE_FALSE);
|
||||
settings.yres = settings.xres;
|
||||
|
@ -4361,7 +4361,7 @@ simple_scan (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
else
|
||||
bpp = 1;
|
||||
size *= bpp;
|
||||
if (settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
size *= 3;
|
||||
data.clear();
|
||||
data.resize(size);
|
||||
|
@ -4461,7 +4461,7 @@ simple_scan (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
|
||||
/* in case of CIS scanner, we must reorder data */
|
||||
if (dev->model->is_cis == SANE_TRUE
|
||||
&& settings.scan_mode == SCAN_MODE_COLOR)
|
||||
&& settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
/* alloc one line sized working buffer */
|
||||
std::vector<uint8_t> buffer(settings.pixels * 3 * bpp);
|
||||
|
@ -4537,7 +4537,7 @@ simple_move (Genesys_Device * dev, SANE_Int distance)
|
|||
|
||||
/* TODO give a no AGOHOME flag */
|
||||
settings.scan_method = ScanMethod::TRANSPARENCY;
|
||||
settings.scan_mode = SCAN_MODE_COLOR;
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
settings.xres = resolution;
|
||||
settings.yres = resolution;
|
||||
settings.tl_y = 0;
|
||||
|
@ -4795,7 +4795,7 @@ gl646_is_compatible_calibration (Genesys_Device * dev, const Genesys_Sensor& sen
|
|||
/* build minimal current_setup for calibration cache use only, it will be better
|
||||
* computed when during setup for scan
|
||||
*/
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR)
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
dev->current_setup.channels = 3;
|
||||
}
|
||||
|
@ -4885,7 +4885,7 @@ gl646_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor, SANE_Bool
|
|||
|
||||
/* we set up for a lowest available resolution color grey scan, full width */
|
||||
settings.scan_method = ScanMethod::FLATBED;
|
||||
settings.scan_mode = SCAN_MODE_GRAY;
|
||||
settings.scan_mode = ScanColorMode::GRAY;
|
||||
settings.xres = res;
|
||||
settings.yres = res;
|
||||
settings.tl_x = 0;
|
||||
|
|
|
@ -2561,17 +2561,17 @@ static SANE_Status gl841_calculate_current_setup(Genesys_Device * dev, const Gen
|
|||
"Scan mode : %d\n\n",
|
||||
__func__,
|
||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
||||
dev->settings.tl_x, dev->settings.tl_y, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == 4) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == 0)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
/* start */
|
||||
|
@ -3295,7 +3295,7 @@ gl841_detect_document_end (Genesys_Device * dev)
|
|||
DBG(DBG_proc, "%s: finished\n", __func__);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR && dev->model->is_cis)
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS && dev->model->is_cis)
|
||||
{
|
||||
scancnt/=3;
|
||||
}
|
||||
|
@ -3744,7 +3744,7 @@ gl841_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
cksel = (regs.find_reg(0x18).value & REG18_CKSEL) + 1; /* clock speed = 1..4 clocks */
|
||||
|
||||
/* set line size */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
@ -3881,19 +3881,19 @@ gl841_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
DBG(DBG_info, "%s:\nResolution: %uDPI\n"
|
||||
"Lines : %u\nPPL : %u\nStartpos : %.3f/%.3f\nScan mode : %d\n\n", __func__,
|
||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels, dev->settings.tl_x,
|
||||
dev->settings.tl_y, dev->settings.scan_mode);
|
||||
dev->settings.tl_y, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
gl841_slow_back_home(dev,SANE_TRUE);
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
|
||||
|
@ -3950,7 +3950,7 @@ gl841_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
|
||||
/* true gray (led add for cis scanners) */
|
||||
if(dev->model->is_cis && dev->settings.true_gray
|
||||
&& dev->settings.scan_mode != SCAN_MODE_COLOR
|
||||
&& dev->settings.scan_mode != ScanColorMode::COLOR_SINGLE_PASS
|
||||
&& dev->model->ccd_type != CIS_CANONLIDE80)
|
||||
{
|
||||
// on Lide 80 the LEDADD bit results in only red LED array being lit
|
||||
|
@ -3959,7 +3959,7 @@ gl841_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
}
|
||||
|
||||
/* enable emulated lineart from gray data */
|
||||
if(dev->settings.scan_mode == SCAN_MODE_LINEART
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
|
|
|
@ -1324,7 +1324,7 @@ struct ScanSessionParams {
|
|||
// the number of channels
|
||||
int channels = -1;
|
||||
|
||||
int scan_mode = -1;
|
||||
ScanColorMode scan_mode = ScanColorMode::LINEART;
|
||||
|
||||
int color_filter = -1;
|
||||
|
||||
|
@ -1333,7 +1333,7 @@ struct ScanSessionParams {
|
|||
void assert_valid() const
|
||||
{
|
||||
if (xres < 0 || yres < 0 || startx < 0 || starty < 0 || pixels < 0 || lines < 0 ||
|
||||
depth < 0 || channels < 0 || scan_mode < 0 || color_filter < 0 || flags < 0)
|
||||
depth < 0 || channels < 0 || color_filter < 0 || flags < 0)
|
||||
{
|
||||
throw std::runtime_error("ScanGenesysPhysicalParams are not valid");
|
||||
}
|
||||
|
@ -1530,7 +1530,7 @@ static SANE_Status gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Senso
|
|||
/*** optical parameters ***/
|
||||
/* in case of dynamic lineart, we use an internal 8 bit gray scan
|
||||
* to generate 1 lineart data */
|
||||
if ((session.params.flags & SCAN_FLAG_DYNAMIC_LINEART) && (session.params.scan_mode == SCAN_MODE_LINEART))
|
||||
if ((session.params.flags & SCAN_FLAG_DYNAMIC_LINEART) && (session.params.scan_mode == ScanColorMode::LINEART))
|
||||
{
|
||||
session.params.depth = 8;
|
||||
}
|
||||
|
@ -1684,7 +1684,7 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
"Scan mode : %d\n\n", __func__,
|
||||
dev->settings.xres,
|
||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
||||
dev->settings.tl_x, dev->settings.tl_y, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
xres = dev->settings.xres;
|
||||
yres = dev->settings.yres;
|
||||
|
@ -1693,14 +1693,14 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(xres);
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
/* start */
|
||||
|
@ -2052,7 +2052,7 @@ gl843_detect_document_end (Genesys_Device * dev)
|
|||
{
|
||||
/* compute number of line read */
|
||||
tmp = (int) dev->total_bytes_read;
|
||||
if (depth == 1 || dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (depth == 1 || dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
flines = tmp * 8 / dev->settings.pixels / channels;
|
||||
else
|
||||
flines = tmp / (depth / 8) / dev->settings.pixels / channels;
|
||||
|
@ -2087,7 +2087,7 @@ gl843_detect_document_end (Genesys_Device * dev)
|
|||
DBG(DBG_io, "%s: bytes_remain=%d\n", __func__, bytes_remain);
|
||||
|
||||
/* remaining lines to read by frontend for the current scan */
|
||||
if (depth == 1 || dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (depth == 1 || dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
{
|
||||
flines = bytes_remain * 8 / dev->settings.pixels / channels;
|
||||
}
|
||||
|
@ -2103,7 +2103,7 @@ gl843_detect_document_end (Genesys_Device * dev)
|
|||
* multiplied by bytes per line */
|
||||
sublines = flines - lines;
|
||||
|
||||
if (depth == 1 || dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (depth == 1 || dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
sub_bytes =
|
||||
((dev->settings.pixels * sublines) / 8 +
|
||||
(((dev->settings.pixels * sublines) % 8) ? 1 : 0)) *
|
||||
|
@ -2546,7 +2546,7 @@ gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
session.params.lines = 100;
|
||||
session.params.depth = 8;
|
||||
session.params.channels = 1;
|
||||
session.params.scan_mode = SCAN_MODE_LINEART;
|
||||
session.params.scan_mode = ScanColorMode::LINEART;
|
||||
session.params.color_filter = dev->settings.color_filter;
|
||||
session.params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -2655,7 +2655,7 @@ gl843_search_start_position (Genesys_Device * dev)
|
|||
session.params.lines = dev->model->search_lines;
|
||||
session.params.depth = 8;
|
||||
session.params.channels = 1;
|
||||
session.params.scan_mode = SCAN_MODE_GRAY;
|
||||
session.params.scan_mode = ScanColorMode::GRAY;
|
||||
session.params.color_filter = 1; // green
|
||||
session.params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -2745,7 +2745,7 @@ gl843_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
cksel = (regs.find_reg(0x18).value & REG18_CKSEL) + 1; /* clock speed = 1..4 clocks */
|
||||
|
||||
/* set line size */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
@ -2827,7 +2827,7 @@ gl843_feed (Genesys_Device * dev, unsigned int steps)
|
|||
session.params.lines = 3;
|
||||
session.params.depth = 8;
|
||||
session.params.channels = 3;
|
||||
session.params.scan_mode = SCAN_MODE_COLOR;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = 0;
|
||||
session.params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -3014,20 +3014,20 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
dev->settings.pixels,
|
||||
dev->settings.tl_x,
|
||||
dev->settings.tl_y,
|
||||
dev->settings.scan_mode);
|
||||
static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
/* ensure head is parked in case of calibration */
|
||||
gl843_slow_back_home (dev, SANE_TRUE);
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR)
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
move_dpi = dev->motor.base_ydpi;
|
||||
|
@ -3059,7 +3059,7 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
start = (start * sensor.optical_res) / MM_PER_INCH;
|
||||
|
||||
/* enable emulated lineart from gray data */
|
||||
if(dev->settings.scan_mode == SCAN_MODE_LINEART
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
|
@ -3184,7 +3184,7 @@ gl843_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
session.params.lines = 1;
|
||||
session.params.depth = depth;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_mode = SCAN_MODE_COLOR;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = dev->settings.color_filter;
|
||||
session.params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -3424,7 +3424,7 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
session.params.lines = lines;
|
||||
session.params.depth = bpp;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_mode = SCAN_MODE_COLOR;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = 0;
|
||||
session.params.flags = flags;
|
||||
gl843_compute_session(dev, session, calib_sensor);
|
||||
|
@ -3657,7 +3657,7 @@ gl843_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
session.params.lines = lines;
|
||||
session.params.depth = bpp;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_mode = SCAN_MODE_COLOR;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = dev->settings.color_filter;
|
||||
session.params.flags = flags;
|
||||
gl843_compute_session(dev, session, calib_sensor);
|
||||
|
@ -3817,7 +3817,7 @@ gl843_init_regs_for_warmup (Genesys_Device * dev,
|
|||
session.params.lines = 1;
|
||||
session.params.depth = 8;
|
||||
session.params.channels = *channels;
|
||||
session.params.scan_mode = SCAN_MODE_COLOR;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = dev->settings.color_filter;
|
||||
session.params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||
SCAN_FLAG_DISABLE_GAMMA |
|
||||
|
@ -4117,7 +4117,7 @@ gl843_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
session.params.lines = lines;
|
||||
session.params.depth = depth;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_mode = SCAN_MODE_GRAY;
|
||||
session.params.scan_mode = ScanColorMode::GRAY;
|
||||
session.params.color_filter = 0;
|
||||
session.params.flags = SCAN_FLAG_DISABLE_SHADING | SCAN_FLAG_DISABLE_SHADING;
|
||||
gl843_compute_session(dev, session, calib_sensor);
|
||||
|
|
|
@ -1212,7 +1212,7 @@ gl846_init_scan_regs (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
/*** optical parameters ***/
|
||||
/* in case of dynamic lineart, we use an internal 8 bit gray scan
|
||||
* to generate 1 lineart data */
|
||||
if ((flags & SCAN_FLAG_DYNAMIC_LINEART) && (dev->settings.scan_mode == SCAN_MODE_LINEART))
|
||||
if ((flags & SCAN_FLAG_DYNAMIC_LINEART) && (dev->settings.scan_mode == ScanColorMode::LINEART))
|
||||
{
|
||||
depth = 8;
|
||||
}
|
||||
|
@ -1386,17 +1386,17 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
"Startpos : %.3f/%.3f\n"
|
||||
"Scan mode : %d\n\n", __func__,
|
||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
||||
dev->settings.tl_x, dev->settings.tl_y, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == 4) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == 0)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
/* start */
|
||||
|
@ -1711,7 +1711,7 @@ gl846_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
float resolution;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
int scan_mode;
|
||||
ScanColorMode scan_mode;
|
||||
|
||||
DBG(DBG_proc, "%s (wait_until_home = %d)\n", __func__, wait_until_home);
|
||||
|
||||
|
@ -1760,7 +1760,7 @@ gl846_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
|
||||
/* TODO add scan_mode to the API */
|
||||
scan_mode= dev->settings.scan_mode;
|
||||
dev->settings.scan_mode=SCAN_MODE_LINEART;
|
||||
dev->settings.scan_mode = ScanColorMode::LINEART;
|
||||
status = gl846_init_scan_regs (dev, sensor,
|
||||
&local_reg,
|
||||
resolution,
|
||||
|
@ -1955,7 +1955,7 @@ gl846_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
cksel = (regs.find_reg(0x18).value & REG18_CKSEL) + 1; /* clock speed = 1..4 clocks */
|
||||
|
||||
/* set line size */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
@ -2165,17 +2165,17 @@ gl846_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
DBG(DBG_info, "%s settings:\nResolution: %uDPI\n"
|
||||
"Lines : %u\nPPL : %u\nStartpos : %.3f/%.3f\nScan mode : %d\n\n", __func__,
|
||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
||||
dev->settings.tl_x, dev->settings.tl_y, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
|
||||
|
@ -2233,7 +2233,7 @@ gl846_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
flags = 0;
|
||||
|
||||
/* emulated lineart from gray data is required for now */
|
||||
if(dev->settings.scan_mode == SCAN_MODE_LINEART
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
|
|
|
@ -1228,7 +1228,7 @@ gl847_init_scan_regs (Genesys_Device * dev,
|
|||
/*** optical parameters ***/
|
||||
/* in case of dynamic lineart, we use an internal 8 bit gray scan
|
||||
* to generate 1 lineart data */
|
||||
if ((flags & SCAN_FLAG_DYNAMIC_LINEART) && (dev->settings.scan_mode == SCAN_MODE_LINEART))
|
||||
if ((flags & SCAN_FLAG_DYNAMIC_LINEART) && (dev->settings.scan_mode == ScanColorMode::LINEART))
|
||||
{
|
||||
depth = 8;
|
||||
}
|
||||
|
@ -1402,17 +1402,17 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
"Startpos : %.3f/%.3f\n"
|
||||
"Scan mode : %d\n\n", __func__,
|
||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
||||
dev->settings.tl_x, dev->settings.tl_y, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == 4) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == 0)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
/* start */
|
||||
|
@ -1774,7 +1774,7 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
float resolution;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
int scan_mode;
|
||||
ScanColorMode scan_mode;
|
||||
|
||||
DBG(DBG_proc, "%s (wait_until_home = %d)\n", __func__, wait_until_home);
|
||||
|
||||
|
@ -1822,8 +1822,8 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
const auto& sensor = sanei_genesys_find_sensor_any(dev);
|
||||
|
||||
/* TODO add scan_mode to the API */
|
||||
scan_mode= dev->settings.scan_mode;
|
||||
dev->settings.scan_mode=SCAN_MODE_LINEART;
|
||||
scan_mode = dev->settings.scan_mode;
|
||||
dev->settings.scan_mode = ScanColorMode::LINEART;
|
||||
status = gl847_init_scan_regs (dev, sensor,
|
||||
&local_reg,
|
||||
resolution,
|
||||
|
@ -1845,7 +1845,7 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
return status;
|
||||
}
|
||||
|
||||
dev->settings.scan_mode=scan_mode;
|
||||
dev->settings.scan_mode = scan_mode;
|
||||
|
||||
/* clear scan and feed count */
|
||||
RIE (sanei_genesys_write_register (dev, REG0D, REG0D_CLRLNCNT | REG0D_CLRMCNT));
|
||||
|
@ -2019,7 +2019,7 @@ gl847_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
cksel = (regs.find_reg(0x18).value & REG18_CKSEL) + 1; /* clock speed = 1..4 clocks */
|
||||
|
||||
/* set line size */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
@ -2229,17 +2229,17 @@ gl847_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
DBG(DBG_info, "%s settings:\nResolution: %uDPI\n"
|
||||
"Lines : %u\nPPL : %u\nStartpos : %.3f/%.3f\nScan mode : %d\n\n", __func__,
|
||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
||||
dev->settings.tl_x, dev->settings.tl_y, static_cast<unsigned>(dev->settings.scan_mode));
|
||||
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
|
||||
|
||||
|
@ -2297,7 +2297,7 @@ gl847_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
flags = 0;
|
||||
|
||||
/* emulated lineart from gray data is required for now */
|
||||
if(dev->settings.scan_mode == SCAN_MODE_LINEART
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
|
|
|
@ -229,6 +229,14 @@ enum class ScanMethod {
|
|||
TRANSPARENCY_INFRARED = 2
|
||||
};
|
||||
|
||||
enum class ScanColorMode {
|
||||
LINEART = 0,
|
||||
HALFTONE,
|
||||
GRAY,
|
||||
COLOR_MULTI_PASS, // TODO: maybe unused
|
||||
COLOR_SINGLE_PASS
|
||||
};
|
||||
|
||||
struct GenesysRegister {
|
||||
uint16_t address = 0;
|
||||
uint8_t value = 0;
|
||||
|
@ -1066,7 +1074,7 @@ typedef struct Genesys_Command_Set
|
|||
unsigned int depth,
|
||||
unsigned int channels,
|
||||
ScanMethod scan_method,
|
||||
int scan_mode,
|
||||
ScanColorMode scan_mode,
|
||||
int color_filter,
|
||||
unsigned int flags);
|
||||
|
||||
|
@ -1134,17 +1142,11 @@ typedef struct Genesys_Model
|
|||
SANE_Int search_lines; /* how many lines are used to search start position */
|
||||
} Genesys_Model;
|
||||
|
||||
#define SCAN_MODE_LINEART 0 /**< lineart scan mode */
|
||||
#define SCAN_MODE_HALFTONE 1 /**< halftone scan mode */
|
||||
#define SCAN_MODE_GRAY 2 /**< gray scan mode */
|
||||
#define SCAN_MODE_COLOR 4 /**< color scan mode */
|
||||
|
||||
struct Genesys_Settings
|
||||
{
|
||||
ScanMethod scan_method = ScanMethod::FLATBED;
|
||||
ScanColorMode scan_mode = ScanColorMode::LINEART;
|
||||
|
||||
// TODO: change 0,1 = lineart, halftone; 2 = gray, 3 = 3pass color, 4=single pass color
|
||||
int scan_mode = 0;
|
||||
// horizontal dpi
|
||||
int xres = 0;
|
||||
// vertical dpi
|
||||
|
|
Ładowanie…
Reference in New Issue