diff --git a/ChangeLog b/ChangeLog index ff49fd97b..00b8ebdb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-02-23 Stéphane Voltz + + * backend/umax_pp_low.c backend/umax_pp_low.h backend/umax_pp_mid.c + backend/umax_pp_mid.h backend/umax_pp.c backend/umax_pp.h + backend/umax_pp.conf tools/umax_pp.c doc/sane-umax_pp.man: changed + highlight option to contrast, and gain to brightness. + 2003-02-24 Henning Meier-Geinitz * backend/Makefile.in backend/dll.conf backend/ma1509.c diff --git a/backend/umax_pp.c b/backend/umax_pp.c index b960a8306..4acb5eeeb 100644 --- a/backend/umax_pp.c +++ b/backend/umax_pp.c @@ -116,13 +116,13 @@ static Umax_PP_Device *first_dev = NULL; static long int buf_size = 2048 * 1024; -static int red_gain = 0; -static int green_gain = 0; -static int blue_gain = 0; +static int red_brightness = 0; +static int green_brightness = 0; +static int blue_brightness = 0; -static int red_highlight = 0; -static int green_highlight = 0; -static int blue_highlight = 0; +static int red_contrast = 0; +static int green_contrast = 0; +static int blue_contrast = 0; @@ -542,121 +542,121 @@ init_options (Umax_PP_Device * dev) dev->opt[OPT_GAMMA_VECTOR_B].constraint.range = &u8_range; dev->val[OPT_GAMMA_VECTOR_B].wa = &dev->gamma_table[3][0]; - /* gain group */ - dev->opt[OPT_MANUAL_GAIN].name = "manual-channel-gain"; - dev->opt[OPT_MANUAL_GAIN].title = SANE_I18N ("Gain"); - dev->opt[OPT_MANUAL_GAIN].desc = SANE_I18N ("Color channels gain settings"); - dev->opt[OPT_MANUAL_GAIN].type = SANE_TYPE_BOOL; - dev->opt[OPT_MANUAL_GAIN].cap |= SANE_CAP_ADVANCED; - dev->val[OPT_MANUAL_GAIN].w = SANE_FALSE; + /* brightness group */ + dev->opt[OPT_MANUAL_BRIGHTNESS].name = "manual-channel-brightness"; + dev->opt[OPT_MANUAL_BRIGHTNESS].title = SANE_I18N ("Brightness"); + dev->opt[OPT_MANUAL_BRIGHTNESS].desc = SANE_I18N ("Color channels brightness settings"); + dev->opt[OPT_MANUAL_BRIGHTNESS].type = SANE_TYPE_BOOL; + dev->opt[OPT_MANUAL_BRIGHTNESS].cap |= SANE_CAP_ADVANCED; + dev->val[OPT_MANUAL_BRIGHTNESS].w = SANE_FALSE; - /* gray gain */ - dev->opt[OPT_GRAY_GAIN].name = "gray-gain"; - dev->opt[OPT_GRAY_GAIN].title = SANE_I18N ("Gray gain"); - dev->opt[OPT_GRAY_GAIN].desc = SANE_I18N ("Sets gray channel gain"); - dev->opt[OPT_GRAY_GAIN].type = SANE_TYPE_INT; - dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; - dev->opt[OPT_GRAY_GAIN].unit = SANE_UNIT_NONE; - dev->opt[OPT_GRAY_GAIN].size = sizeof (SANE_Int); - dev->opt[OPT_GRAY_GAIN].constraint_type = SANE_CONSTRAINT_RANGE; - dev->opt[OPT_GRAY_GAIN].constraint.range = &u4_range; - dev->val[OPT_GRAY_GAIN].w = dev->gray_gain; + /* gray brightness */ + dev->opt[OPT_GRAY_BRIGHTNESS].name = "gray-brightness"; + dev->opt[OPT_GRAY_BRIGHTNESS].title = SANE_I18N ("Gray brightness"); + dev->opt[OPT_GRAY_BRIGHTNESS].desc = SANE_I18N ("Sets gray channel brightness"); + dev->opt[OPT_GRAY_BRIGHTNESS].type = SANE_TYPE_INT; + dev->opt[OPT_GRAY_BRIGHTNESS].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; + dev->opt[OPT_GRAY_BRIGHTNESS].unit = SANE_UNIT_NONE; + dev->opt[OPT_GRAY_BRIGHTNESS].size = sizeof (SANE_Int); + dev->opt[OPT_GRAY_BRIGHTNESS].constraint_type = SANE_CONSTRAINT_RANGE; + dev->opt[OPT_GRAY_BRIGHTNESS].constraint.range = &u4_range; + dev->val[OPT_GRAY_BRIGHTNESS].w = dev->gray_brightness; - /* red gain */ - dev->opt[OPT_RED_GAIN].name = "red-gain"; - dev->opt[OPT_RED_GAIN].title = SANE_I18N ("Red gain"); - dev->opt[OPT_RED_GAIN].desc = SANE_I18N ("Sets red channel gain"); - dev->opt[OPT_RED_GAIN].type = SANE_TYPE_INT; - dev->opt[OPT_RED_GAIN].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; - dev->opt[OPT_RED_GAIN].unit = SANE_UNIT_NONE; - dev->opt[OPT_RED_GAIN].size = sizeof (SANE_Int); - dev->opt[OPT_RED_GAIN].constraint_type = SANE_CONSTRAINT_RANGE; - dev->opt[OPT_RED_GAIN].constraint.range = &u4_range; - dev->val[OPT_RED_GAIN].w = dev->red_gain; + /* red brightness */ + dev->opt[OPT_RED_BRIGHTNESS].name = "red-brightness"; + dev->opt[OPT_RED_BRIGHTNESS].title = SANE_I18N ("Red brightness"); + dev->opt[OPT_RED_BRIGHTNESS].desc = SANE_I18N ("Sets red channel brightness"); + dev->opt[OPT_RED_BRIGHTNESS].type = SANE_TYPE_INT; + dev->opt[OPT_RED_BRIGHTNESS].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; + dev->opt[OPT_RED_BRIGHTNESS].unit = SANE_UNIT_NONE; + dev->opt[OPT_RED_BRIGHTNESS].size = sizeof (SANE_Int); + dev->opt[OPT_RED_BRIGHTNESS].constraint_type = SANE_CONSTRAINT_RANGE; + dev->opt[OPT_RED_BRIGHTNESS].constraint.range = &u4_range; + dev->val[OPT_RED_BRIGHTNESS].w = dev->red_brightness; - /* green gain */ - dev->opt[OPT_GREEN_GAIN].name = "green-gain"; - dev->opt[OPT_GREEN_GAIN].title = SANE_I18N ("Green gain"); - dev->opt[OPT_GREEN_GAIN].desc = SANE_I18N ("Sets green channel gain"); - dev->opt[OPT_GREEN_GAIN].type = SANE_TYPE_INT; - dev->opt[OPT_GREEN_GAIN].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; - dev->opt[OPT_GREEN_GAIN].unit = SANE_UNIT_NONE; - dev->opt[OPT_GREEN_GAIN].size = sizeof (SANE_Int); - dev->opt[OPT_GREEN_GAIN].constraint_type = SANE_CONSTRAINT_RANGE; - dev->opt[OPT_GREEN_GAIN].constraint.range = &u4_range; - dev->val[OPT_GREEN_GAIN].w = dev->green_gain; + /* green brightness */ + dev->opt[OPT_GREEN_BRIGHTNESS].name = "green-brightness"; + dev->opt[OPT_GREEN_BRIGHTNESS].title = SANE_I18N ("Green brightness"); + dev->opt[OPT_GREEN_BRIGHTNESS].desc = SANE_I18N ("Sets green channel brightness"); + dev->opt[OPT_GREEN_BRIGHTNESS].type = SANE_TYPE_INT; + dev->opt[OPT_GREEN_BRIGHTNESS].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; + dev->opt[OPT_GREEN_BRIGHTNESS].unit = SANE_UNIT_NONE; + dev->opt[OPT_GREEN_BRIGHTNESS].size = sizeof (SANE_Int); + dev->opt[OPT_GREEN_BRIGHTNESS].constraint_type = SANE_CONSTRAINT_RANGE; + dev->opt[OPT_GREEN_BRIGHTNESS].constraint.range = &u4_range; + dev->val[OPT_GREEN_BRIGHTNESS].w = dev->green_brightness; - /* blue gain */ - dev->opt[OPT_BLUE_GAIN].name = "blue-gain"; - dev->opt[OPT_BLUE_GAIN].title = SANE_I18N ("Blue gain"); - dev->opt[OPT_BLUE_GAIN].desc = SANE_I18N ("Sets blue channel gain"); - dev->opt[OPT_BLUE_GAIN].type = SANE_TYPE_INT; - dev->opt[OPT_BLUE_GAIN].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; - dev->opt[OPT_BLUE_GAIN].unit = SANE_UNIT_NONE; - dev->opt[OPT_BLUE_GAIN].size = sizeof (SANE_Int); - dev->opt[OPT_BLUE_GAIN].constraint_type = SANE_CONSTRAINT_RANGE; - dev->opt[OPT_BLUE_GAIN].constraint.range = &u4_range; - dev->val[OPT_BLUE_GAIN].w = dev->blue_gain; + /* blue brightness */ + dev->opt[OPT_BLUE_BRIGHTNESS].name = "blue-brightness"; + dev->opt[OPT_BLUE_BRIGHTNESS].title = SANE_I18N ("Blue brightness"); + dev->opt[OPT_BLUE_BRIGHTNESS].desc = SANE_I18N ("Sets blue channel brightness"); + dev->opt[OPT_BLUE_BRIGHTNESS].type = SANE_TYPE_INT; + dev->opt[OPT_BLUE_BRIGHTNESS].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; + dev->opt[OPT_BLUE_BRIGHTNESS].unit = SANE_UNIT_NONE; + dev->opt[OPT_BLUE_BRIGHTNESS].size = sizeof (SANE_Int); + dev->opt[OPT_BLUE_BRIGHTNESS].constraint_type = SANE_CONSTRAINT_RANGE; + dev->opt[OPT_BLUE_BRIGHTNESS].constraint.range = &u4_range; + dev->val[OPT_BLUE_BRIGHTNESS].w = dev->blue_brightness; - /* highlight group */ - dev->opt[OPT_MANUAL_HIGHLIGHT].name = "manual-highlight"; - dev->opt[OPT_MANUAL_HIGHLIGHT].title = SANE_TITLE_HIGHLIGHT; - dev->opt[OPT_MANUAL_HIGHLIGHT].desc = - SANE_I18N ("Color channels highlight settings"); - dev->opt[OPT_MANUAL_HIGHLIGHT].type = SANE_TYPE_BOOL; - dev->opt[OPT_MANUAL_HIGHLIGHT].cap |= SANE_CAP_ADVANCED; - dev->val[OPT_MANUAL_HIGHLIGHT].w = SANE_FALSE; + /* contrast group */ + dev->opt[OPT_MANUAL_CONTRAST].name = "manual-contrast"; + dev->opt[OPT_MANUAL_CONTRAST].title = SANE_TITLE_CONTRAST; + dev->opt[OPT_MANUAL_CONTRAST].desc = + SANE_I18N ("Color channels contrast settings"); + dev->opt[OPT_MANUAL_CONTRAST].type = SANE_TYPE_BOOL; + dev->opt[OPT_MANUAL_CONTRAST].cap |= SANE_CAP_ADVANCED; + dev->val[OPT_MANUAL_CONTRAST].w = SANE_FALSE; - /* gray highlight */ - dev->opt[OPT_GRAY_HIGHLIGHT].name = "gray-highlight"; - dev->opt[OPT_GRAY_HIGHLIGHT].title = SANE_I18N ("Gray highlight"); - dev->opt[OPT_GRAY_HIGHLIGHT].desc = - SANE_I18N ("Sets gray channel highlight"); - dev->opt[OPT_GRAY_HIGHLIGHT].type = SANE_TYPE_INT; - dev->opt[OPT_GRAY_HIGHLIGHT].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; - dev->opt[OPT_GRAY_HIGHLIGHT].unit = SANE_UNIT_NONE; - dev->opt[OPT_GRAY_HIGHLIGHT].size = sizeof (SANE_Int); - dev->opt[OPT_GRAY_HIGHLIGHT].constraint_type = SANE_CONSTRAINT_RANGE; - dev->opt[OPT_GRAY_HIGHLIGHT].constraint.range = &u4_range; - dev->val[OPT_GRAY_HIGHLIGHT].w = dev->gray_highlight; + /* gray contrast */ + dev->opt[OPT_GRAY_CONTRAST].name = "gray-contrast"; + dev->opt[OPT_GRAY_CONTRAST].title = SANE_I18N ("Gray contrast"); + dev->opt[OPT_GRAY_CONTRAST].desc = + SANE_I18N ("Sets gray channel contrast"); + dev->opt[OPT_GRAY_CONTRAST].type = SANE_TYPE_INT; + dev->opt[OPT_GRAY_CONTRAST].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; + dev->opt[OPT_GRAY_CONTRAST].unit = SANE_UNIT_NONE; + dev->opt[OPT_GRAY_CONTRAST].size = sizeof (SANE_Int); + dev->opt[OPT_GRAY_CONTRAST].constraint_type = SANE_CONSTRAINT_RANGE; + dev->opt[OPT_GRAY_CONTRAST].constraint.range = &u4_range; + dev->val[OPT_GRAY_CONTRAST].w = dev->gray_contrast; - /* red highlight */ - dev->opt[OPT_RED_HIGHLIGHT].name = "red-highlight"; - dev->opt[OPT_RED_HIGHLIGHT].title = SANE_TITLE_HIGHLIGHT_R; - dev->opt[OPT_RED_HIGHLIGHT].desc = SANE_I18N ("Sets red channel highlight"); - dev->opt[OPT_RED_HIGHLIGHT].type = SANE_TYPE_INT; - dev->opt[OPT_RED_HIGHLIGHT].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; - dev->opt[OPT_RED_HIGHLIGHT].unit = SANE_UNIT_NONE; - dev->opt[OPT_RED_HIGHLIGHT].size = sizeof (SANE_Int); - dev->opt[OPT_RED_HIGHLIGHT].constraint_type = SANE_CONSTRAINT_RANGE; - dev->opt[OPT_RED_HIGHLIGHT].constraint.range = &u4_range; - dev->val[OPT_RED_HIGHLIGHT].w = dev->red_highlight; + /* red contrast */ + dev->opt[OPT_RED_CONTRAST].name = "red-contrast"; + dev->opt[OPT_RED_CONTRAST].title = SANE_TITLE_CONTRAST; + dev->opt[OPT_RED_CONTRAST].desc = SANE_I18N ("Sets red channel contrast"); + dev->opt[OPT_RED_CONTRAST].type = SANE_TYPE_INT; + dev->opt[OPT_RED_CONTRAST].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; + dev->opt[OPT_RED_CONTRAST].unit = SANE_UNIT_NONE; + dev->opt[OPT_RED_CONTRAST].size = sizeof (SANE_Int); + dev->opt[OPT_RED_CONTRAST].constraint_type = SANE_CONSTRAINT_RANGE; + dev->opt[OPT_RED_CONTRAST].constraint.range = &u4_range; + dev->val[OPT_RED_CONTRAST].w = dev->red_contrast; - /* green highlight */ - dev->opt[OPT_GREEN_HIGHLIGHT].name = "green-highlight"; - dev->opt[OPT_GREEN_HIGHLIGHT].title = SANE_TITLE_HIGHLIGHT_G; - dev->opt[OPT_GREEN_HIGHLIGHT].desc = - SANE_I18N ("Sets green channel highlight"); - dev->opt[OPT_GREEN_HIGHLIGHT].type = SANE_TYPE_INT; - dev->opt[OPT_GREEN_HIGHLIGHT].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; - dev->opt[OPT_GREEN_HIGHLIGHT].unit = SANE_UNIT_NONE; - dev->opt[OPT_GREEN_HIGHLIGHT].size = sizeof (SANE_Int); - dev->opt[OPT_GREEN_HIGHLIGHT].constraint_type = SANE_CONSTRAINT_RANGE; - dev->opt[OPT_GREEN_HIGHLIGHT].constraint.range = &u4_range; - dev->val[OPT_GREEN_HIGHLIGHT].w = dev->green_highlight; + /* green contrast */ + dev->opt[OPT_GREEN_CONTRAST].name = "green-contrast"; + dev->opt[OPT_GREEN_CONTRAST].title = SANE_TITLE_CONTRAST; + dev->opt[OPT_GREEN_CONTRAST].desc = + SANE_I18N ("Sets green channel contrast"); + dev->opt[OPT_GREEN_CONTRAST].type = SANE_TYPE_INT; + dev->opt[OPT_GREEN_CONTRAST].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; + dev->opt[OPT_GREEN_CONTRAST].unit = SANE_UNIT_NONE; + dev->opt[OPT_GREEN_CONTRAST].size = sizeof (SANE_Int); + dev->opt[OPT_GREEN_CONTRAST].constraint_type = SANE_CONSTRAINT_RANGE; + dev->opt[OPT_GREEN_CONTRAST].constraint.range = &u4_range; + dev->val[OPT_GREEN_CONTRAST].w = dev->green_contrast; - /* blue highlight */ - dev->opt[OPT_BLUE_HIGHLIGHT].name = "blue-highlight"; - dev->opt[OPT_BLUE_HIGHLIGHT].title = SANE_TITLE_HIGHLIGHT_B; - dev->opt[OPT_BLUE_HIGHLIGHT].desc = - SANE_I18N ("Sets blue channel highlight"); - dev->opt[OPT_BLUE_HIGHLIGHT].type = SANE_TYPE_INT; - dev->opt[OPT_BLUE_HIGHLIGHT].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; - dev->opt[OPT_BLUE_HIGHLIGHT].unit = SANE_UNIT_NONE; - dev->opt[OPT_BLUE_HIGHLIGHT].size = sizeof (SANE_Int); - dev->opt[OPT_BLUE_HIGHLIGHT].constraint_type = SANE_CONSTRAINT_RANGE; - dev->opt[OPT_BLUE_HIGHLIGHT].constraint.range = &u4_range; - dev->val[OPT_BLUE_HIGHLIGHT].w = dev->blue_highlight; + /* blue contrast */ + dev->opt[OPT_BLUE_CONTRAST].name = "blue-contrast"; + dev->opt[OPT_BLUE_CONTRAST].title = SANE_TITLE_CONTRAST; + dev->opt[OPT_BLUE_CONTRAST].desc = + SANE_I18N ("Sets blue channel contrast"); + dev->opt[OPT_BLUE_CONTRAST].type = SANE_TYPE_INT; + dev->opt[OPT_BLUE_CONTRAST].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; + dev->opt[OPT_BLUE_CONTRAST].unit = SANE_UNIT_NONE; + dev->opt[OPT_BLUE_CONTRAST].size = sizeof (SANE_Int); + dev->opt[OPT_BLUE_CONTRAST].constraint_type = SANE_CONSTRAINT_RANGE; + dev->opt[OPT_BLUE_CONTRAST].constraint.range = &u4_range; + dev->val[OPT_BLUE_CONTRAST].w = dev->blue_contrast; return SANE_STATUS_GOOD; } @@ -775,12 +775,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) sanei_umax_pp_setastra (val); DBG (3, "init: option astra %ld P\n", val); } - else if (strncmp (cp, "red-gain", 8) == 0) + else if ( (strncmp (cp, "red-brightness", 14) == 0) && isspace (cp[14]) ) { char *end; long int val; - cp += 9; + cp += 15; errno = 0; val = strtol (cp, &end, 0); @@ -794,15 +794,15 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) DBG (3, "init: option buffer %ld\n", val); - DBG (3, "init: setting global option red-gain to %ld\n", val); - red_gain = val; + DBG (3, "init: setting global option red-brightness to %ld\n", val); + red_brightness = val; } - else if (strncmp (cp, "green-gain", 10) == 0 && isspace (cp[10])) + else if (strncmp (cp, "green-brightness", 16) == 0 && isspace (cp[16])) { char *end; long int val; - cp += 11; + cp += 17; errno = 0; val = strtol (cp, &end, 0); @@ -814,16 +814,16 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) cp, val); } - DBG (3, "init: option green-gain %ld\n", val); - DBG (3, "init: setting global option green-gain to %ld\n", val); - green_gain = val; + DBG (3, "init: option green-brightness %ld\n", val); + DBG (3, "init: setting global option green-brightness to %ld\n", val); + green_brightness = val; } - else if (strncmp (cp, "blue-gain", 9) == 0 && isspace (cp[9])) + else if (strncmp (cp, "blue-brightness", 15) == 0 && isspace (cp[15])) { char *end; long int val; - cp += 10; + cp += 16; errno = 0; val = strtol (cp, &end, 0); @@ -835,12 +835,58 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) cp, val); } - DBG (3, "init: option blue-gain %ld\n", val); + DBG (3, "init: option blue-brightness %ld\n", val); - DBG (3, "init: setting global option blue-gain to %ld\n", val); - blue_gain = val; + DBG (3, "init: setting global option blue-brightness to %ld\n", val); + blue_brightness = val; } - else if ((strncmp (cp, "red-highlight", 13) == 0) + else if ((strncmp (cp, "red-contrast", 12) == 0) && isspace (cp[12])) + { + char *end; + long int val; + + cp += 13; + + errno = 0; + val = strtol (cp, &end, 0); + + if ((end == cp || errno) || (val < 0) || (val > 15)) + { + val = 8; /* safe fallback */ + DBG (2, "init: invalid value `%s`, falling back to %ld\n", + cp, val); + } + + DBG (3, "init: option buffer %ld\n", val); + + DBG (3, "init: setting global option red-contrast to %ld\n", + val); + red_contrast = val; + } + else if (strncmp (cp, "green-contrast", 14) == 0 + && isspace (cp[14])) + { + char *end; + long int val; + + cp += 15; + + errno = 0; + val = strtol (cp, &end, 0); + + if ((end == cp || errno) || (val < 0) || (val > 15)) + { + val = 4; /* safe fallback */ + DBG (2, "init: invalid value `%s`, falling back to %ld\n", + cp, val); + } + + DBG (3, "init: option green-contrast %ld\n", val); + DBG (3, "init: setting global option green-contrast to %ld\n", + val); + green_contrast = val; + } + else if (strncmp (cp, "blue-contrast", 13) == 0 && isspace (cp[13])) { char *end; @@ -858,58 +904,11 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) cp, val); } - DBG (3, "init: option buffer %ld\n", val); + DBG (3, "init: option blue-contrast %ld\n", val); - DBG (3, "init: setting global option red-highlight to %ld\n", + DBG (3, "init: setting global option blue-contrast to %ld\n", val); - red_highlight = val; - } - else if (strncmp (cp, "green-highlight", 15) == 0 - && isspace (cp[15])) - { - char *end; - long int val; - - cp += 16; - - errno = 0; - val = strtol (cp, &end, 0); - - if ((end == cp || errno) || (val < 0) || (val > 15)) - { - val = 4; /* safe fallback */ - DBG (2, "init: invalid value `%s`, falling back to %ld\n", - cp, val); - } - - DBG (3, "init: option green-highlight %ld\n", val); - DBG (3, "init: setting global option green-highlight to %ld\n", - val); - green_highlight = val; - } - else if (strncmp (cp, "blue-highlight", 14) == 0 - && isspace (cp[14])) - { - char *end; - long int val; - - cp += 15; - - errno = 0; - val = strtol (cp, &end, 0); - - if ((end == cp || errno) || (val < 0) || (val > 15)) - { - val = 8; /* safe fallback */ - DBG (2, "init: invalid value `%s`, falling back to %ld\n", - cp, val); - } - - DBG (3, "init: option blue-highlight %ld\n", val); - - DBG (3, "init: setting global option blue-highlight to %ld\n", - val); - blue_highlight = val; + blue_contrast = val; } } else if ((strncmp (cp, "port", 4) == 0) && isspace (cp[4])) @@ -1003,28 +1002,28 @@ sane_exit (void) } if (devlist != NULL) - { - free (devlist); - devlist = NULL; - } + { + free (devlist); + devlist=NULL; + } if (devarray != NULL) - { - free (devarray); - devarray = NULL; - } + { + free (devarray); + devarray=NULL; + } /* reset values */ num_devices = 0; first_dev = NULL; - red_gain = 0; - green_gain = 0; - blue_gain = 0; + red_brightness = 0; + green_brightness = 0; + blue_brightness = 0; - red_highlight = 0; - green_highlight = 0; - blue_highlight = 0; + red_contrast = 0; + green_contrast = 0; + blue_contrast = 0; } @@ -1037,10 +1036,10 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only) DBG (129, "unused arg: local_only = %d\n", (int) local_only); if (devarray != NULL) - { - free (devarray); - devarray = NULL; - } + { + free (devarray); + devarray=NULL; + } devarray = malloc ((num_devices + 1) * sizeof (devarray[0])); @@ -1119,12 +1118,12 @@ sane_open (SANE_String_Const devicename, SANE_Handle * handle) return SANE_STATUS_INVAL; } - DBG (3, "open: trying default device %s, port=%s\n", - devlist[0].sane.name, devlist[0].port); - if (devlist[0].port != NULL) - rc = sanei_umax_pp_open (atoi (devlist[0].port), NULL); + DBG (3, "open: trying default device %s, port=%s,ppdev=%s\n", + devlist[0].sane.name, devlist[0].port, devlist[0].ppdevice); + if(devlist[0].port!=NULL) + rc = sanei_umax_pp_open (atoi (devlist[0].port), NULL); else - rc = sanei_umax_pp_open (0, devlist[0].sane.name); + rc = sanei_umax_pp_open (0 , devlist[0].ppdevice); desc = &devlist[0]; } @@ -1200,15 +1199,15 @@ sane_open (SANE_String_Const devicename, SANE_Handle * handle) dev->y_range.max = dev->desc->max_v_size; dev->y_range.quant = 0; - dev->gray_gain = 0; + dev->gray_brightness = 0; /* use pre defined settings read from umax_pp.conf */ - dev->red_gain = red_gain; - dev->green_gain = green_gain; - dev->blue_gain = blue_gain; - dev->red_highlight = red_highlight; - dev->green_highlight = green_highlight; - dev->blue_highlight = blue_highlight; + dev->red_brightness = red_brightness; + dev->green_brightness = green_brightness; + dev->blue_brightness = blue_brightness; + dev->red_contrast = red_contrast; + dev->green_contrast = green_contrast; + dev->blue_contrast = blue_contrast; if (dev->buf == NULL) @@ -1279,13 +1278,13 @@ sane_close (SANE_Handle handle) } } - /* then we switch off light if needed */ + /* then we switch off brightness if needed */ if (dev->val[OPT_LAMP_CONTROL].w == SANE_TRUE) { rc = sanei_umax_pp_lamp (0); if (rc == UMAX1220P_TRANSPORT_FAILED) { - DBG (1, "close: switch off light failed (ignored....)\n"); + DBG (1, "close: switch off brightness failed (ignored....)\n"); } } @@ -1381,16 +1380,16 @@ sane_control_option (SANE_Handle handle, SANE_Int option, case OPT_BR_Y: case OPT_NUM_OPTS: case OPT_CUSTOM_GAMMA: - case OPT_MANUAL_GAIN: - case OPT_GRAY_GAIN: - case OPT_GREEN_GAIN: - case OPT_RED_GAIN: - case OPT_BLUE_GAIN: - case OPT_MANUAL_HIGHLIGHT: - case OPT_GRAY_HIGHLIGHT: - case OPT_GREEN_HIGHLIGHT: - case OPT_RED_HIGHLIGHT: - case OPT_BLUE_HIGHLIGHT: + case OPT_MANUAL_BRIGHTNESS: + case OPT_GRAY_BRIGHTNESS: + case OPT_GREEN_BRIGHTNESS: + case OPT_RED_BRIGHTNESS: + case OPT_BLUE_BRIGHTNESS: + case OPT_MANUAL_CONTRAST: + case OPT_GRAY_CONTRAST: + case OPT_GREEN_CONTRAST: + case OPT_RED_CONTRAST: + case OPT_BLUE_CONTRAST: *(SANE_Word *) val = dev->val[option].w; return SANE_STATUS_GOOD; @@ -1454,14 +1453,14 @@ sane_control_option (SANE_Handle handle, SANE_Int option, if (info) *info |= SANE_INFO_RELOAD_PARAMS; - case OPT_GRAY_GAIN: - case OPT_GREEN_GAIN: - case OPT_RED_GAIN: - case OPT_BLUE_GAIN: - case OPT_GRAY_HIGHLIGHT: - case OPT_GREEN_HIGHLIGHT: - case OPT_RED_HIGHLIGHT: - case OPT_BLUE_HIGHLIGHT: + case OPT_GRAY_BRIGHTNESS: + case OPT_GREEN_BRIGHTNESS: + case OPT_RED_BRIGHTNESS: + case OPT_BLUE_BRIGHTNESS: + case OPT_GRAY_CONTRAST: + case OPT_GREEN_CONTRAST: + case OPT_RED_CONTRAST: + case OPT_BLUE_CONTRAST: dev->val[option].w = *(SANE_Word *) val; /* sanity check */ @@ -1604,16 +1603,16 @@ sane_control_option (SANE_Handle handle, SANE_Int option, } return SANE_STATUS_GOOD; - case OPT_MANUAL_HIGHLIGHT: + case OPT_MANUAL_CONTRAST: w = *(SANE_Word *) val; - if (w == dev->val[OPT_MANUAL_HIGHLIGHT].w) + if (w == dev->val[OPT_MANUAL_CONTRAST].w) return SANE_STATUS_GOOD; /* no change */ if (info) *info |= SANE_INFO_RELOAD_OPTIONS; - dev->val[OPT_MANUAL_HIGHLIGHT].w = w; + dev->val[OPT_MANUAL_CONTRAST].w = w; if (w == SANE_TRUE) { @@ -1621,36 +1620,36 @@ sane_control_option (SANE_Handle handle, SANE_Int option, if ((strcmp (mode, "Grayscale") == 0) || (strcmp (mode, "Lineart") == 0)) - dev->opt[OPT_GRAY_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GRAY_CONTRAST].cap &= ~SANE_CAP_INACTIVE; else if (strcmp (mode, "Color") == 0) { - dev->opt[OPT_GRAY_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_RED_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE; - dev->opt[OPT_GREEN_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE; - dev->opt[OPT_BLUE_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GRAY_CONTRAST].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_RED_CONTRAST].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GREEN_CONTRAST].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_BLUE_CONTRAST].cap &= ~SANE_CAP_INACTIVE; } } else { - dev->opt[OPT_GRAY_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_RED_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_GREEN_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_BLUE_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_GRAY_CONTRAST].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_RED_CONTRAST].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_GREEN_CONTRAST].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_BLUE_CONTRAST].cap |= SANE_CAP_INACTIVE; } return SANE_STATUS_GOOD; - case OPT_MANUAL_GAIN: + case OPT_MANUAL_BRIGHTNESS: w = *(SANE_Word *) val; - if (w == dev->val[OPT_MANUAL_GAIN].w) + if (w == dev->val[OPT_MANUAL_BRIGHTNESS].w) return SANE_STATUS_GOOD; /* no change */ if (info) *info |= SANE_INFO_RELOAD_OPTIONS; - dev->val[OPT_MANUAL_GAIN].w = w; + dev->val[OPT_MANUAL_BRIGHTNESS].w = w; if (w == SANE_TRUE) { @@ -1658,21 +1657,21 @@ sane_control_option (SANE_Handle handle, SANE_Int option, if ((strcmp (mode, "Grayscale") == 0) || (strcmp (mode, "Lineart") == 0)) - dev->opt[OPT_GRAY_GAIN].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GRAY_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE; else if (strcmp (mode, "Color") == 0) { - dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_RED_GAIN].cap &= ~SANE_CAP_INACTIVE; - dev->opt[OPT_GREEN_GAIN].cap &= ~SANE_CAP_INACTIVE; - dev->opt[OPT_BLUE_GAIN].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GRAY_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_RED_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GREEN_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_BLUE_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE; } } else { - dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_RED_GAIN].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_GREEN_GAIN].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_BLUE_GAIN].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_GRAY_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_RED_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_GREEN_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_BLUE_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; } return SANE_STATUS_GOOD; @@ -1782,43 +1781,43 @@ sane_control_option (SANE_Handle handle, SANE_Int option, } } - /* rebuild OPT HIGHLIGHT */ - dev->opt[OPT_GRAY_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_RED_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_GREEN_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_BLUE_HIGHLIGHT].cap |= SANE_CAP_INACTIVE; + /* rebuild OPT CONTRAST */ + dev->opt[OPT_GRAY_CONTRAST].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_RED_CONTRAST].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_GREEN_CONTRAST].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_BLUE_CONTRAST].cap |= SANE_CAP_INACTIVE; - if (dev->val[OPT_MANUAL_HIGHLIGHT].w == SANE_TRUE) + if (dev->val[OPT_MANUAL_CONTRAST].w == SANE_TRUE) { if ((strcmp (val, "Grayscale") == 0) || (strcmp (val, "Lineart") == 0)) - dev->opt[OPT_GRAY_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GRAY_CONTRAST].cap &= ~SANE_CAP_INACTIVE; else if (strcmp (val, "Color") == 0) { - dev->opt[OPT_RED_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE; - dev->opt[OPT_GREEN_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE; - dev->opt[OPT_BLUE_HIGHLIGHT].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_RED_CONTRAST].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GREEN_CONTRAST].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_BLUE_CONTRAST].cap &= ~SANE_CAP_INACTIVE; } } - /* rebuild OPT GAIN */ - dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_RED_GAIN].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_GREEN_GAIN].cap |= SANE_CAP_INACTIVE; - dev->opt[OPT_BLUE_GAIN].cap |= SANE_CAP_INACTIVE; + /* rebuild OPT BRIGHTNESS */ + dev->opt[OPT_GRAY_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_RED_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_GREEN_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; + dev->opt[OPT_BLUE_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; - if (dev->val[OPT_MANUAL_GAIN].w == SANE_TRUE) + if (dev->val[OPT_MANUAL_BRIGHTNESS].w == SANE_TRUE) { if ((strcmp (val, "Grayscale") == 0) || (strcmp (val, "Lineart") == 0)) - dev->opt[OPT_GRAY_GAIN].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GRAY_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE; else if (strcmp (val, "Color") == 0) { - dev->opt[OPT_RED_GAIN].cap &= ~SANE_CAP_INACTIVE; - dev->opt[OPT_GREEN_GAIN].cap &= ~SANE_CAP_INACTIVE; - dev->opt[OPT_BLUE_GAIN].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_RED_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_GREEN_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE; + dev->opt[OPT_BLUE_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE; } } @@ -1854,50 +1853,50 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params) else dev->color = UMAX_PP_MODE_COLOR; - /* highlight control */ - if (dev->val[OPT_MANUAL_HIGHLIGHT].w == SANE_TRUE) + /* contrast control */ + if (dev->val[OPT_MANUAL_CONTRAST].w == SANE_TRUE) { if (dev->color != UMAX_PP_MODE_COLOR) { - dev->red_highlight = 0; - dev->green_highlight = (int) (dev->val[OPT_GRAY_HIGHLIGHT].w); - dev->blue_highlight = 0; + dev->red_contrast = 0; + dev->green_contrast = (int) (dev->val[OPT_GRAY_CONTRAST].w); + dev->blue_contrast = 0; } else { - dev->red_highlight = (int) (dev->val[OPT_RED_HIGHLIGHT].w); - dev->green_highlight = (int) (dev->val[OPT_GREEN_HIGHLIGHT].w); - dev->blue_highlight = (int) (dev->val[OPT_BLUE_HIGHLIGHT].w); + dev->red_contrast = (int) (dev->val[OPT_RED_CONTRAST].w); + dev->green_contrast = (int) (dev->val[OPT_GREEN_CONTRAST].w); + dev->blue_contrast = (int) (dev->val[OPT_BLUE_CONTRAST].w); } } else { - dev->red_highlight = 2; - dev->green_highlight = 2; - dev->blue_highlight = 2; + dev->red_contrast = 2; + dev->green_contrast = 2; + dev->blue_contrast = 2; } - /* gain control */ - if (dev->val[OPT_MANUAL_GAIN].w == SANE_TRUE) + /* brightness control */ + if (dev->val[OPT_MANUAL_BRIGHTNESS].w == SANE_TRUE) { if (dev->color != UMAX_PP_MODE_COLOR) { - dev->red_gain = 0; - dev->green_gain = (int) (dev->val[OPT_GRAY_GAIN].w); - dev->blue_gain = 0; + dev->red_brightness = 0; + dev->green_brightness = (int) (dev->val[OPT_GRAY_BRIGHTNESS].w); + dev->blue_brightness = 0; } else { - dev->red_gain = (int) (dev->val[OPT_RED_GAIN].w); - dev->green_gain = (int) (dev->val[OPT_GREEN_GAIN].w); - dev->blue_gain = (int) (dev->val[OPT_BLUE_GAIN].w); + dev->red_brightness = (int) (dev->val[OPT_RED_BRIGHTNESS].w); + dev->green_brightness = (int) (dev->val[OPT_GREEN_BRIGHTNESS].w); + dev->blue_brightness = (int) (dev->val[OPT_BLUE_BRIGHTNESS].w); } } else { - dev->red_gain = red_gain; - dev->green_gain = green_gain; - dev->blue_gain = blue_gain; + dev->red_brightness = red_brightness; + dev->green_brightness = green_brightness; + dev->blue_brightness = blue_brightness; } /* geometry */ @@ -2034,7 +2033,7 @@ sane_start (SANE_Handle handle) dev->val[OPT_LAMP_CONTROL].w = SANE_TRUE; /* tests if we do auto setting */ - if (dev->val[OPT_MANUAL_GAIN].w == SANE_TRUE) + if (dev->val[OPT_MANUAL_BRIGHTNESS].w == SANE_TRUE) autoset = 0; else autoset = 1; @@ -2050,9 +2049,9 @@ sane_start (SANE_Handle handle) dev->BottomX - dev->TopX, dev->BottomY - dev->TopY, dev->dpi, - (dev->red_gain << 8) + (dev->green_gain << 4) + dev->blue_gain, - (dev->red_highlight << 8) + (dev->green_highlight << 4) + - dev->blue_highlight); + (dev->red_brightness << 8) + (dev->green_brightness << 4) + dev->blue_brightness, + (dev->red_contrast << 8) + (dev->green_contrast << 4) + + dev->blue_contrast); rc = sanei_umax_pp_start (dev->TopX, dev->TopY - 2 * delta, @@ -2061,11 +2060,11 @@ sane_start (SANE_Handle handle) dev->dpi, 2, autoset, - (dev->red_gain << 8) + - (dev->green_gain << 4) + dev->blue_gain, - (dev->red_highlight << 8) + - (dev->green_highlight << 4) + - dev->blue_highlight, + (dev->red_brightness << 8) + + (dev->green_brightness << 4) + dev->blue_brightness, + (dev->red_contrast << 8) + + (dev->green_contrast << 4) + + dev->blue_contrast, &(dev->bpp), &(dev->tw), &(dev->th)); /* we enlarged the scanning zone */ /* to allow reordering, we must */ @@ -2079,8 +2078,8 @@ sane_start (SANE_Handle handle) dev->TopX, dev->TopY, dev->BottomX - dev->TopX, - dev->BottomY - dev->TopY, dev->dpi, dev->gray_gain << 4, - dev->gray_highlight << 4); + dev->BottomY - dev->TopY, dev->dpi, dev->gray_brightness << 4, + dev->gray_contrast << 4); rc = sanei_umax_pp_start (dev->TopX, dev->TopY, dev->BottomX - dev->TopX, @@ -2088,7 +2087,7 @@ sane_start (SANE_Handle handle) dev->dpi, (dev->color == UMAX_PP_MODE_GRAYSCALE) ? 1 : 0, autoset, - dev->gray_gain << 4, dev->gray_highlight << 4, + dev->gray_brightness << 4, dev->gray_contrast << 4, &(dev->bpp), &(dev->tw), &(dev->th)); } diff --git a/backend/umax_pp.conf b/backend/umax_pp.conf index 78f5e1aa1..f0cc7a02c 100644 --- a/backend/umax_pp.conf +++ b/backend/umax_pp.conf @@ -16,29 +16,29 @@ option buffer 2097152 port /dev/parport0 # the following options are local to this scanner -# gain for red channel, if not given, will be automatically computed +# brightness for red channel, if not given, will be automatically computed # must be between 0 and 15 -#option red-gain 8 +#option red-brightness 8 -# gain for green channel, if not given, will be automatically computed +# brightness for green channel, if not given, will be automatically computed # must be between 0 and 15 -#option green-gain 4 +#option green-brightness 4 -# gain for blue channel, if not given, will be automatically computed +# brightness for blue channel, if not given, will be automatically computed # must be between 0 and 15 -#option blue-gain 8 +#option blue-brightness 8 -# highlight for red channel, if not given, will default to 0 +# contrast for red channel, if not given, will default to 0 # must be between 0 and 15 -#option red-highlight 2 +#option red-contrast 2 -# highlight for green channel, if not given, will default to 0 +# contrast for green channel, if not given, will default to 0 # must be between 0 and 15 -#option green-highlight 1 +#option green-contrast 1 -# highlight for blue channel, if not given, will default to 0 +# contrast for blue channel, if not given, will default to 0 # must be between 0 and 15 -#option blue-highlight 1 +#option blue-contrast 1 # diff --git a/backend/umax_pp.h b/backend/umax_pp.h index 4d30ab7cc..3297e49ea 100644 --- a/backend/umax_pp.h +++ b/backend/umax_pp.h @@ -77,17 +77,17 @@ enum Umax_PP_Option OPT_GAMMA_VECTOR_G, OPT_GAMMA_VECTOR_B, - OPT_MANUAL_GAIN, - OPT_GRAY_GAIN, - OPT_RED_GAIN, - OPT_GREEN_GAIN, - OPT_BLUE_GAIN, + OPT_MANUAL_BRIGHTNESS, + OPT_GRAY_BRIGHTNESS, + OPT_RED_BRIGHTNESS, + OPT_GREEN_BRIGHTNESS, + OPT_BLUE_BRIGHTNESS, - OPT_MANUAL_HIGHLIGHT, - OPT_GRAY_HIGHLIGHT, - OPT_RED_HIGHLIGHT, - OPT_GREEN_HIGHLIGHT, - OPT_BLUE_HIGHLIGHT, + OPT_MANUAL_CONTRAST, + OPT_GRAY_CONTRAST, + OPT_RED_CONTRAST, + OPT_GREEN_CONTRAST, + OPT_BLUE_CONTRAST, /* must come last: */ NUM_OPTIONS @@ -116,14 +116,14 @@ typedef struct Umax_PP_Descriptor u_char revision; /* default values */ - SANE_Int gray_gain; - SANE_Int red_gain; - SANE_Int blue_gain; - SANE_Int green_gain; - SANE_Int gray_highlight; - SANE_Int red_highlight; - SANE_Int blue_highlight; - SANE_Int green_highlight; + SANE_Int gray_brightness; + SANE_Int red_brightness; + SANE_Int blue_brightness; + SANE_Int green_brightness; + SANE_Int gray_contrast; + SANE_Int red_contrast; + SANE_Int blue_contrast; + SANE_Int green_contrast; } Umax_PP_Descriptor; @@ -147,7 +147,7 @@ typedef struct Umax_PP_Device int BottomY; int dpi; - int gain; + int brightness; int color; int bpp; /* bytes per pixel */ int tw; /* target width in pixels */ @@ -168,15 +168,15 @@ typedef struct Umax_PP_Device SANE_Range x_range; SANE_Range y_range; - SANE_Int gray_gain; - SANE_Int red_gain; - SANE_Int blue_gain; - SANE_Int green_gain; + SANE_Int gray_brightness; + SANE_Int red_brightness; + SANE_Int blue_brightness; + SANE_Int green_brightness; - SANE_Int gray_highlight; - SANE_Int red_highlight; - SANE_Int blue_highlight; - SANE_Int green_highlight; + SANE_Int gray_contrast; + SANE_Int red_contrast; + SANE_Int blue_contrast; + SANE_Int green_contrast; } Umax_PP_Device; diff --git a/backend/umax_pp_low.c b/backend/umax_pp_low.c index d247f3a54..69b5e292f 100644 --- a/backend/umax_pp_low.c +++ b/backend/umax_pp_low.c @@ -461,8 +461,8 @@ sanei_umax_pp_InitPort (int port, char *name) /* since this function must be called before */ /* any other, we put debug init here */ DBG_INIT (); - - /* sets global vars */ + + /* sets global vars */ ggGreen = ggamma; ggBlue = ggamma; ggRed = ggamma; @@ -3821,7 +3821,7 @@ sanei_umax_pp_InitScanner (int recover) sentcmd[j] = 0x80; j++; sentcmd[j] = 0xF0; - j++; /* F0 means light on, 90 light off */ + j++; /* F0 means brightness on, 90 brightness off */ if (GetModel () == 0x07) { sentcmd[j] = 0x00; @@ -6334,10 +6334,10 @@ Bloc2Decode (int *op) DBG (0, "\t->scan height =0x%04X (%d)\n", scanh, scanh); DBG (0, "\t->skip height =0x%04X (%d)\n", skiph, skiph); DBG (0, "\t->y dpi =0x%04X (%d)\n", dpi, dpi); - DBG (0, "\t->channel 1 gain=0x%02X (%d)\n", op[10] & 0x0F, op[10] & 0x0F); - DBG (0, "\t->channel 2 gain=0x%02X (%d)\n", (op[10] & 0xF0) / 16, + DBG (0, "\t->channel 1 brightness=0x%02X (%d)\n", op[10] & 0x0F, op[10] & 0x0F); + DBG (0, "\t->channel 2 brightness=0x%02X (%d)\n", (op[10] & 0xF0) / 16, (op[10] & 0xF0) / 16); - DBG (0, "\t->channel 3 gain=0x%02X (%d)\n", op[11] & 0x0F, op[11] & 0x0F); + DBG (0, "\t->channel 3 brightness=0x%02X (%d)\n", op[11] & 0x0F, op[11] & 0x0F); DBG (0, "\t->channel 1 high=0x%02X (%d)\n", (op[11] / 16) & 0x0F, (op[11] / 16) & 0x0F); DBG (0, "\t->channel 2 high=0x%02X (%d)\n", (op[12] & 0xF0) / 16, @@ -7026,7 +7026,7 @@ MoveToOrigin (void) */ static int -WarmUp (int color, int *gain) +WarmUp (int color, int *brightness) { unsigned char buffer[5300]; int i, val, min, max; @@ -7221,16 +7221,16 @@ WarmUp (int color, int *gain) /***********************/ - /* auto gain computing */ + /* auto brightness computing */ /***********************/ /* color correction set to 53 05 */ /* for a start */ - *gain = 0x535; + *brightness = 0x535; CMDSETGET (2, 0x10, opsc18); CMDSETGET (8, 0x24, opsc39); opsc04[7] = opsc04[7] & 0x20; - opsc04[6] = 0x06; /* one channel gain value */ + opsc04[6] = 0x06; /* one channel brightness value */ CMDSETGET (1, 0x08, opsc10); /* was opsc04, extraneaous string */ /* that prevents using Move .... */ CMDSYNC (0xC2); @@ -7242,10 +7242,10 @@ WarmUp (int color, int *gain) Dump (0x200, buffer, NULL); - /* auto correction of gain levels */ + /* auto correction of brightness levels */ /* first color component X */ - opsc51[10] = (*gain) / 16; /* channel 1 & 2 gain */ - opsc51[11] = (*gain) % 16; /* channel 3 gain */ + opsc51[10] = (*brightness) / 16; /* channel 1 & 2 brightness */ + opsc51[11] = (*brightness) % 16; /* channel 3 brightness */ if (color >= RGB_MODE) { if (sanei_umax_pp_getastra () == 1600) @@ -7263,7 +7263,7 @@ WarmUp (int color, int *gain) Bloc2Decode (opsc51); Bloc8Decode (opsc40); } - opsc04[6] = (*gain) / 256; + opsc04[6] = (*brightness) / 256; CMDSETGET (1, 0x08, opsc04); CMDSYNC (0xC2); CMDSYNC (0x00); @@ -7301,9 +7301,9 @@ WarmUp (int color, int *gain) } } - *gain = (*gain & 0xFF) + 256 * (opsc04[6] - 1); - opsc51[10] = *gain / 16; /* channel 1 & 2 gain */ - opsc51[11] = *gain % 16; /* channel 3 gain */ + *brightness = (*brightness & 0xFF) + 256 * (opsc04[6] - 1); + opsc51[10] = *brightness / 16; /* channel 1 & 2 brightness */ + opsc51[11] = *brightness % 16; /* channel 3 brightness */ opsc51[0] = 0x01; opsc51[13] = 0x80; if (sanei_umax_pp_getastra () == 1600) @@ -7316,7 +7316,7 @@ WarmUp (int color, int *gain) } CMDSETGET (2, 0x10, opsc51); CMDSETGET (8, 0x24, opsc40); - opsc04[6] = (*gain & 0x00F); + opsc04[6] = (*brightness & 0x00F); CMDSETGET (1, 0x08, opsc04); CMDSYNC (0xC2); CMDSYNC (0x00); @@ -7354,7 +7354,7 @@ WarmUp (int color, int *gain) max = buffer[i]; } } - *gain = (*gain & 0xFF0) + (opsc04[6] - 1); + *brightness = (*brightness & 0xFF0) + (opsc04[6] - 1); } @@ -7362,8 +7362,8 @@ WarmUp (int color, int *gain) /* component Z: B&W component */ - opsc51[10] = *gain / 16; /* channel 1 & 2 gain */ - opsc51[11] = *gain % 16; /* channel 3 gain */ + opsc51[10] = *brightness / 16; /* channel 1 & 2 brightness */ + opsc51[11] = *brightness % 16; /* channel 3 brightness */ if (color < RGB_MODE) opsc51[0] = 0x01; /* in BW, scan zone doesn't have an extra 4 points */ else @@ -7383,7 +7383,7 @@ WarmUp (int color, int *gain) Bloc2Decode (opsc51); } CMDSETGET (8, 0x24, opsc40); - opsc04[6] = (*gain & 0x0F0) / 16; + opsc04[6] = (*brightness & 0x0F0) / 16; CMDSETGET (1, 0x08, opsc04); CMDSYNC (0xC2); CMDSYNC (0x00); @@ -7420,7 +7420,7 @@ WarmUp (int color, int *gain) max = buffer[i]; } } - *gain = (*gain & 0xF0F) + (opsc04[6] - 1) * 16; + *brightness = (*brightness & 0xF0F) + (opsc04[6] - 1) * 16; DBG (1, "Warm-up done ...\n"); return (1); } @@ -7459,7 +7459,7 @@ sanei_umax_pp_Park (void) /* calibrates CCD: returns 1 on success, 0 on failure */ static int -ColorCalibration (int color, int dpi, int gain, int highlight, int width, +ColorCalibration (int color, int dpi, int brightness, int contrast, int width, int *calibration) { int opsc32[17] = @@ -7507,18 +7507,18 @@ ColorCalibration (int color, int dpi, int gain, int highlight, int width, /* get calibration data */ if (sanei_umax_pp_getauto ()) - { /* auto settings doesn't use highlight */ - highlight = 0x000; + { /* auto settings doesn't use contrast */ + contrast = 0x000; } else { /* manual settings */ - gain = 0x777; - highlight = 0x000; + brightness = 0x777; + contrast = 0x000; } - opsc32[10] = gain / 16; - opsc32[11] = gain % 16 | ((highlight / 16) & 0xF0); - opsc32[12] = highlight % 256; - DBG (8, "USING 0x%03X gain, 0x%03X highlight\n", gain, highlight); + opsc32[10] = brightness / 16; + opsc32[11] = brightness % 16 | ((contrast / 16) & 0xF0); + opsc32[12] = contrast % 256; + DBG (8, "USING 0x%03X brightness, 0x%03X contrast\n", brightness, contrast); if (sanei_umax_pp_getastra () == 1600) { opsc32[13] = 0x03; @@ -7649,7 +7649,7 @@ sanei_umax_pp_ReadBlock (long len, int window, int dpi, int last, int sanei_umax_pp_Scan (int x, int y, int width, int height, int dpi, int color, - int gain, int highlight) + int brightness, int contrast) { #ifdef HAVE_SYS_TIME_H struct timeval td, tf; @@ -7665,7 +7665,7 @@ sanei_umax_pp_Scan (int x, int y, int width, int height, int dpi, int color, int bx, by; if (sanei_umax_pp_StartScan - (x, y, width, height, dpi, color, gain, highlight, &bpp, &tw, &th) == 1) + (x, y, width, height, dpi, color, brightness, contrast, &bpp, &tw, &th) == 1) { COMPLETIONWAIT; @@ -7852,7 +7852,7 @@ sanei_umax_pp_ParkWait (void) /* starts scan: return 1 on success */ int sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, - int color, int gain, int highlight, int *rbpp, + int color, int brightness, int contrast, int *rbpp, int *rtw, int *rth) { unsigned char *buffer; @@ -7893,7 +7893,7 @@ sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, DBG (8, "StartScan(%d,%d,%d,%d,%d,%d,%X);\n", x, y, width, height, dpi, - color, gain); + color, brightness); buffer = (unsigned char *) malloc (2096100); if (buffer == NULL) { @@ -8042,11 +8042,11 @@ sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, } - /* adjust gain and color offset */ + /* adjust brightness and color offset */ /* red*256+green*16+blue */ if (sanei_umax_pp_getauto ()) { - if (WarmUp (color, &gain) == 0) + if (WarmUp (color, &brightness) == 0) { DBG (0, "Warm-up failed !!! (%s:%d)\n", __FILE__, __LINE__); return (0); @@ -8078,7 +8078,7 @@ sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, tw = (width * xdpi) / 600; /* do gamma calibration */ - if (ColorCalibration (color, dpi, gain, highlight, width, calibration) == 0) + if (ColorCalibration (color, dpi, brightness, contrast, width, calibration) == 0) { DBG (0, "Gamma calibration failed !!! (%s:%d)\n", __FILE__, __LINE__); return (0); @@ -8173,10 +8173,10 @@ sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, break; } - /* channels gain */ - opsc53[10] = gain / 16; - opsc53[11] = ((highlight / 16) & 0xF0) | (gain % 16); - opsc53[12] = highlight % 256; + /* channels brightness */ + opsc53[10] = brightness / 16; + opsc53[11] = ((contrast / 16) & 0xF0) | (brightness % 16); + opsc53[12] = contrast % 256; /* scan height */ opsc53[0] = h % 256; @@ -8218,7 +8218,7 @@ sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, { opsc53[7] = 0x2F; /* 00 seems to give better results ? */ - /* 80 some more gain, lamp power level ? */ + /* 80 some more brightness, lamp power level ? */ /* 8x does not make much difference */ opsc04[6] = 0x8F; if (sanei_umax_pp_getastra () == 1600) @@ -8236,7 +8236,7 @@ sanei_umax_pp_StartScan (int x, int y, int width, int height, int dpi, { opsc53[7] = 0x40; opsc53[13] = 0xC0; - opsc04[6] = 0x80 | ((gain / 16) & 0x0F); + opsc04[6] = 0x80 | ((brightness / 16) & 0x0F); if (sanei_umax_pp_getastra () == 1600) { opsc04[7] = 0x20; diff --git a/backend/umax_pp_low.h b/backend/umax_pp_low.h index bf409f4ca..a16586d14 100644 --- a/backend/umax_pp_low.h +++ b/backend/umax_pp_low.h @@ -91,7 +91,7 @@ extern void sanei_umax_pp_setauto (int mode); #endif extern int sanei_umax_pp_Scan (int x, int y, int width, int height, int dpi, - int color, int gain, int highlight); + int color, int brightness, int contrast); extern int sanei_umax_pp_Move (int distance, int precision, unsigned char *buffer); extern int sanei_umax_pp_SetLamp (int on); @@ -102,7 +102,7 @@ extern int sanei_umax_pp_ParkWait (void); extern int sanei_umax_pp_ReadBlock (long len, int window, int dpi, int last, unsigned char *buffer); extern int sanei_umax_pp_StartScan (int x, int y, int width, int height, - int dpi, int color, int gain, + int dpi, int color, int brightness, int contrast, int *rbpp, int *rtw, int *rth); diff --git a/backend/umax_pp_mid.c b/backend/umax_pp_mid.c index 2ff61ac62..5443b6bee 100644 --- a/backend/umax_pp_mid.c +++ b/backend/umax_pp_mid.c @@ -330,7 +330,7 @@ sanei_umax_pp_cancel (void) int sanei_umax_pp_start (int x, int y, int width, int height, int dpi, int color, int autoset, - int gain, int highlight, int *rbpp, int *rtw, int *rth) + int brightness, int contrast, int *rbpp, int *rtw, int *rth) { int col = BW_MODE; @@ -359,7 +359,7 @@ sanei_umax_pp_start (int x, int y, int width, int height, int dpi, int color, } if (sanei_umax_pp_StartScan - (x + 144, y, width, height, dpi, col, gain, highlight, rbpp, rtw, + (x + 144, y, width, height, dpi, col, brightness, contrast, rbpp, rtw, rth) != 1) { sanei_umax_pp_EndSession (); diff --git a/backend/umax_pp_mid.h b/backend/umax_pp_mid.h index f6b503a15..fc8a3d304 100644 --- a/backend/umax_pp_mid.h +++ b/backend/umax_pp_mid.h @@ -132,7 +132,7 @@ extern int sanei_umax_pp_cancel (void); /* starts scanning: - find scanner origin - - does channel gain calibration if needed + - does channel brightness calibration if needed - does calibration - initialize scan operation @@ -142,8 +142,8 @@ extern int sanei_umax_pp_cancel (void); color is true for color scan, false for gray-levels - gain value is 256*red_gain+16*green_gain+blue_gain - if gain is given (ie <> 0), auto gain will not be performed + brightness value is 256*red_brightness+16*green_brightness+blue_brightness + if brightness is given (ie <> 0), auto brightness will not be performed @@ -152,8 +152,8 @@ extern int sanei_umax_pp_cancel (void); the width of scanned area expressed in pixels */ extern int sanei_umax_pp_start (int x, int y, int width, int height, int dpi, - int color, int autoset, int gain, - int highlight, int *rbpp, int *rtw, int *rth); + int color, int autoset, int brightness, + int contrast, int *rbpp, int *rtw, int *rth); /* reads one block of data from scanner diff --git a/doc/sane-umax_pp.man b/doc/sane-umax_pp.man index ae1a9b40e..1985e979a 100644 --- a/doc/sane-umax_pp.man +++ b/doc/sane-umax_pp.man @@ -112,35 +112,36 @@ scanners. Empty lines and lines starting with a hash mark (#) are ignored. .PP The height options supported are -.BR red-gain , -.BR green-gain , -.BR blue-gain , -.BR red-highlight , -.BR green-highlight , -.BR blue-highlight , +.BR red-brightness , +.BR green-brightness , +.BR blue-brightness , +.BR red-contrast , +.BR green-contrast , +.BR blue-contrast , .BR astra , and .BR buffer . Options -.B red-gain +.B red-brightness , -.B green-gain +.B green-brightness and -.B blue-gain +.B blue-brightness allow you to adjust the sensitivy of your scanner for the given color. Values -range from 0 (lowest gain) to 15 (highest). When all three gains are set to -0, the backend does auto gain tuning. +range from 0 (lowest brightness) to 15 (highest). The "Brightness" option isn't +checked in the frontend, the backend does automatic brightness calibration. + .PP Options -.B red-highlight +.B red-contrast , -.B green-highlight +.B green-contrast and -.B blue-highlight -allow you to adjust the highlight of your scanner for the given color. Values -range from 0 (lowest highlight) to 15 (highest). +.B blue-contrast +allow you to adjust the contrast of your scanner for the given color. Values +range from 0 (lowest contrast) to 15 (highest). .PP Option diff --git a/tools/umax_pp.c b/tools/umax_pp.c index bb97de4ab..1b0996f83 100644 --- a/tools/umax_pp.c +++ b/tools/umax_pp.c @@ -19,7 +19,7 @@ static void Usage (char *name) { fprintf (stderr, - "%s [-c color_mode] [-x coord] [-y coord] [-w width] [-h height] [-g gain] [-z highlight] [-d dpi] [-t level] [-s] [-p] [-l 0|1] [-a ioport_addr] [-r]\n", + "%s [-c color_mode] [-x coord] [-y coord] [-w width] [-h height] [-g brightness] [-z contrast] [-d dpi] [-t level] [-s] [-p] [-l 0|1] [-a ioport_addr] [-r]\n", name); } @@ -39,8 +39,8 @@ main (int argc, char **argv) int trace = 0; /* scanning parameters : defaults to preview (75 dpi color, full scan area) */ - int gain = 0x0; - int highlight = 0x2C0; + int brightness = 0x0; + int contrast = 0x2C0; int dpi = 75; int x = 0, y = 0; int width = 5100, height = 7000; @@ -50,23 +50,23 @@ main (int argc, char **argv) /* option parsing */ /* - -c --color : color mode: RGB, BW, BW12, RGB12 - -x : x coordinate - -y : y coordinate - -w --witdh : scan width - -h --height : scan height - -f --file : session file - -p --probe : probe scanner - -s --scan : scan - -t --trace : execution trace - -l --lamp : turn lamp on/off 1/0 - -d --dpi : set scan resolution - -g --gain : set RVB gain - -z --highlight: set highlight - -a --addr : io port address - -n --name : ppdev device name - -r : recover from previous failed scan - -m --model : model revision + -c --color : color mode: RGB, BW, BW12, RGB12 + -x : x coordinate + -y : y coordinate + -w --witdh : scan width + -h --height : scan height + -f --file : session file + -p --probe : probe scanner + -s --scan : scan + -t --trace : execution trace + -l --lamp : turn lamp on/off 1/0 + -d --dpi : set scan resolution + -g --brightness : set RVB brightness + -z --contrast: set contrast + -a --addr : io port address + -n --name : ppdev device name + -r : recover from previous failed scan + -m --model : model revision */ @@ -249,12 +249,12 @@ main (int argc, char **argv) found = 1; } - if ((strcmp (argv[i], "-g") == 0) || (strcmp (argv[i], "--gain") == 0)) + if ((strcmp (argv[i], "-g") == 0) || (strcmp (argv[i], "--brightness") == 0)) { if (i == (argc - 1)) { Usage (argv[0]); - fprintf (stderr, "expected hex gain value ( ex: A59 )\n"); + fprintf (stderr, "expected hex brightness value ( ex: A59 )\n"); return (0); } i++; @@ -262,20 +262,20 @@ main (int argc, char **argv) if (strlen (argv[i]) != 3) { Usage (argv[0]); - fprintf (stderr, "expected hex gain value ( ex: A59 )\n"); + fprintf (stderr, "expected hex brightness value ( ex: A59 )\n"); return (0); } - gain = strtol (argv[i], NULL, 16); + brightness = strtol (argv[i], NULL, 16); sanei_umax_pp_setauto (0); } if ((strcmp (argv[i], "-z") == 0) - || (strcmp (argv[i], "--highlight") == 0)) + || (strcmp (argv[i], "--contrast") == 0)) { if (i == (argc - 1)) { Usage (argv[0]); - fprintf (stderr, "expected hex highlight value ( ex: A59 )\n"); + fprintf (stderr, "expected hex contrast value ( ex: A59 )\n"); return (0); } i++; @@ -283,10 +283,10 @@ main (int argc, char **argv) if (strlen (argv[i]) != 3) { Usage (argv[0]); - fprintf (stderr, "expected hex highlight value ( ex: A59 )\n"); + fprintf (stderr, "expected hex contrast value ( ex: A59 )\n"); return (0); } - highlight = strtol (argv[i], NULL, 16); + contrast = strtol (argv[i], NULL, 16); } if ((strcmp (argv[i], "-n") == 0) || (strcmp (argv[i], "--name") == 0)) @@ -367,7 +367,7 @@ main (int argc, char **argv) } if (trace) { - printf ("UMAX 1220P scanning program version 3.0 starting ...\n"); + printf ("UMAX 1220P scanning program version 3.1 starting ...\n"); #ifdef HAVE_LINUX_PPDEV_H printf ("ppdev character device built-in.\n"); #endif @@ -477,7 +477,7 @@ main (int argc, char **argv) } /* scan */ if (sanei_umax_pp_Scan - (x, y, width, height, dpi, color, gain, highlight) != 1) + (x, y, width, height, dpi, color, brightness, contrast) != 1) { sanei_umax_pp_ReleaseScanner (); sanei_umax_pp_EndSession ();