From: Bastian Dehn Date: Sat, 15 Feb 2025 19:31:36 +0000 (+0100) Subject: add option color sharpen X-Git-Tag: v1.1.0^2~4^2~49 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=7ca7e07b8ab8cb1fcd6bc99611f3ba511cfe2bfd;p=sane-kds-s2000w-net.git add option color sharpen --- diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index 2f5d578..3976aa5 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -5,7 +5,7 @@ #include "kds_s2000w_debug.h" #define AUTOSTART_ON 1 -#define OPTION_COUNT 22 +#define OPTION_COUNT 23 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value) { diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index a563e2d..009faa2 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -3,6 +3,8 @@ #include "kds_s2000w_option_descriptors.h" #include "kds_s2000w_debug.h" +#define MAX_OPTION_COUNT 23 + SANE_Option_Descriptor* descriptor_array = NULL; SANE_Word constraint_dpi[] = {5, 100, 150, 200, 300, 600}; @@ -24,6 +26,7 @@ SANE_String_Const* constraint_background_smoothing_mode = NULL; SANE_String_Const* constraint_binarization_mode = NULL; SANE_String_Const* constraint_max_document_length = NULL; SANE_String_Const* constraint_scan_source = NULL; +SANE_String_Const* constraint_color_sharpen = NULL; SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group() { @@ -491,6 +494,32 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_config_reset() return descriptor; } +SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_sharpen() +{ + kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_sharpen"); + + constraint_color_sharpen = malloc(sizeof(SANE_String_Const*) * 5); + constraint_color_sharpen[0] = "None"; + constraint_color_sharpen[1] = "Normal"; + constraint_color_sharpen[2] = "High"; + constraint_color_sharpen[3] = "Exaggerated"; + constraint_color_sharpen[4] = NULL; + + SANE_Option_Descriptor descriptor = { + "colorsharpen", + "colorsharpen", + "colorsharpen", + SANE_TYPE_STRING, + SANE_UNIT_NONE, + sizeof(SANE_String_Const*) * 5, + SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, + SANE_CONSTRAINT_STRING_LIST, + {.string_list = constraint_color_sharpen} + }; + + return descriptor; +} + void kds_s2000w_option_descriptors_init() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors"); @@ -507,17 +536,18 @@ void kds_s2000w_option_descriptors_init() descriptor_array[8] = _kds_s2000w_option_descriptor_color_drop(); descriptor_array[9] = _kds_s2000w_option_descriptor_color_drop_out_aggressiveness(); descriptor_array[10] = _kds_s2000w_option_descriptor_color_auto_brightness_mode(); - descriptor_array[11] = _kds_s2000w_option_descriptor_color_balance_mode(); - descriptor_array[12] = _kds_s2000w_option_descriptor_color_balancea_agressiveness(); - descriptor_array[13] = _kds_s2000w_option_descriptor_color_balance_red(); - descriptor_array[14] = _kds_s2000w_option_descriptor_color_balance_green(); - descriptor_array[15] = _kds_s2000w_option_descriptor_color_balance_blue(); - descriptor_array[16] = _kds_s2000w_option_descriptor_foreground_boldness_mode(); - descriptor_array[17] = _kds_s2000w_option_descriptor_foreground_boldness_aggressiveness(); - descriptor_array[18] = _kds_s2000w_option_descriptor_background_smoothing_mode(); - descriptor_array[19] = _kds_s2000w_option_descriptor_background_smoothing_aggressiveness(); - descriptor_array[20] = _kds_s2000w_option_descriptor_binarization_contrast(); - descriptor_array[21] = _kds_s2000w_option_descriptor_config_reset(); + descriptor_array[11] = _kds_s2000w_option_descriptor_color_sharpen(); + descriptor_array[12] = _kds_s2000w_option_descriptor_color_balance_mode(); + descriptor_array[13] = _kds_s2000w_option_descriptor_color_balancea_agressiveness(); + descriptor_array[14] = _kds_s2000w_option_descriptor_color_balance_red(); + descriptor_array[15] = _kds_s2000w_option_descriptor_color_balance_green(); + descriptor_array[16] = _kds_s2000w_option_descriptor_color_balance_blue(); + descriptor_array[17] = _kds_s2000w_option_descriptor_foreground_boldness_mode(); + descriptor_array[18] = _kds_s2000w_option_descriptor_foreground_boldness_aggressiveness(); + descriptor_array[19] = _kds_s2000w_option_descriptor_background_smoothing_mode(); + descriptor_array[20] = _kds_s2000w_option_descriptor_background_smoothing_aggressiveness(); + descriptor_array[21] = _kds_s2000w_option_descriptor_binarization_contrast(); + descriptor_array[22] = _kds_s2000w_option_descriptor_config_reset(); } void kds_s2000w_option_descriptors_free() @@ -544,6 +574,8 @@ void kds_s2000w_option_descriptors_free() constraint_max_document_length = NULL; free(constraint_scan_source); constraint_scan_source = NULL; + free(constraint_color_sharpen); + constraint_color_sharpen = NULL; free(descriptor_array); descriptor_array = NULL; } diff --git a/src/kds_s2000w_option_descriptors.h b/src/kds_s2000w_option_descriptors.h index eca41fb..edced05 100644 --- a/src/kds_s2000w_option_descriptors.h +++ b/src/kds_s2000w_option_descriptors.h @@ -3,8 +3,6 @@ #include #include -#define MAX_OPTION_COUNT 22 - void kds_s2000w_option_descriptors_init(); void kds_s2000w_option_descriptors_free(); diff --git a/tests/kds_s2000w_net_get_opt_tests.c b/tests/kds_s2000w_net_get_opt_tests.c index a77cd17..a74549d 100644 --- a/tests/kds_s2000w_net_get_opt_tests.c +++ b/tests/kds_s2000w_net_get_opt_tests.c @@ -22,7 +22,7 @@ void sane_kds_s2000w_net_control_get_option_zero_test(void** state) sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &value, NULL); - assert_int_equal(value, 22); + assert_int_equal(value, 23); kds_s2000w_handler_free(h); h = NULL; diff --git a/tests/kds_s2000w_option_descriptor_tests.c b/tests/kds_s2000w_option_descriptor_tests.c index 7c5fb11..d3ff6eb 100644 --- a/tests/kds_s2000w_option_descriptor_tests.c +++ b/tests/kds_s2000w_option_descriptor_tests.c @@ -4,6 +4,8 @@ #include "kds_s2000w_client_mock.h" #include "../src/kds_s2000w_option_descriptors.h" +#define MAX_OPTION_COUNT 23 + int setup(void** state) { kds_s2000w_option_descriptors_init(); @@ -208,6 +210,25 @@ void kds_s2000w_option_get_descriptor_eleven_test() { SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(11); + assert_string_equal("colorsharpen", option->name); + assert_string_equal("colorsharpen", option->title); + assert_string_equal("colorsharpen", option->desc); + assert_int_equal(SANE_TYPE_STRING, option->type); + assert_int_equal(SANE_UNIT_NONE, option->unit); + assert_int_equal(sizeof(SANE_String_Const*) * 5, option->size); + assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, option->cap); + assert_int_equal(SANE_CONSTRAINT_STRING_LIST, option->constraint_type); + assert_string_equal("None", option->constraint.string_list[0]); + assert_string_equal("Normal", option->constraint.string_list[1]); + assert_string_equal("High", option->constraint.string_list[2]); + assert_string_equal("Exaggerated", option->constraint.string_list[3]); + assert_null(option->constraint.string_list[4]); +} + +void kds_s2000w_option_get_descriptor_twelve_test() +{ + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(12); + assert_string_equal("colorbalancemode", option->name); assert_string_equal("colorbalancemode", option->title); assert_string_equal("colorbalancemode", option->desc); @@ -223,9 +244,9 @@ void kds_s2000w_option_get_descriptor_eleven_test() assert_null(option->constraint.string_list[4]); } -void kds_s2000w_option_get_descriptor_twelve_test() +void kds_s2000w_option_get_descriptor_thirdteen_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(12); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(13); assert_string_equal("colorbalanceaggressiveness", option->name); assert_string_equal("colorbalanceaggressiveness", option->title); @@ -240,9 +261,9 @@ void kds_s2000w_option_get_descriptor_twelve_test() assert_int_equal(1, option->constraint.range->quant); } -void kds_s2000w_option_get_descriptor_thirdteen_test() +void kds_s2000w_option_get_descriptor_fourteen_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(13); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(14); assert_string_equal("colorbalancered", option->name); assert_string_equal("colorbalancered", option->title); @@ -257,9 +278,9 @@ void kds_s2000w_option_get_descriptor_thirdteen_test() assert_int_equal(1, option->constraint.range->quant); } -void kds_s2000w_option_get_descriptor_fourteen_test() +void kds_s2000w_option_get_descriptor_fifteen_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(14); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(15); assert_string_equal("colorbalancegreen", option->name); assert_string_equal("colorbalancegreen", option->title); @@ -274,9 +295,9 @@ void kds_s2000w_option_get_descriptor_fourteen_test() assert_int_equal(1, option->constraint.range->quant); } -void kds_s2000w_option_get_descriptor_fifteen_test() +void kds_s2000w_option_get_descriptor_sixteen_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(15); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(16); assert_string_equal("colorbalanceblue", option->name); assert_string_equal("colorbalanceblue", option->title); @@ -291,9 +312,9 @@ void kds_s2000w_option_get_descriptor_fifteen_test() assert_int_equal(1, option->constraint.range->quant); } -void kds_s2000w_option_get_descriptor_sixteen_test() +void kds_s2000w_option_get_descriptor_seventeen_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(16); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(17); assert_string_equal("foreground-boldness-mode", option->name); assert_string_equal("Foreground Boldness Mode", option->title); @@ -309,9 +330,9 @@ void kds_s2000w_option_get_descriptor_sixteen_test() assert_null(option->constraint.string_list[3]); } -void kds_s2000w_option_get_descriptor_seventeen_test() +void kds_s2000w_option_get_descriptor_eightteen_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(17); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(18); assert_string_equal("foreground-boldness-aggressiveness", option->name); assert_string_equal("Foreground Boldness Aggressiveness", option->title); @@ -326,9 +347,9 @@ void kds_s2000w_option_get_descriptor_seventeen_test() assert_int_equal(1, option->constraint.range->quant); } -void kds_s2000w_option_get_descriptor_eightteen_test() +void kds_s2000w_option_get_descriptor_nineteen_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(18); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(19); assert_string_equal("background-smoothing-mode", option->name); assert_string_equal("Background Smoothing Mode", option->title); @@ -344,9 +365,9 @@ void kds_s2000w_option_get_descriptor_eightteen_test() assert_null(option->constraint.string_list[3]); } -void kds_s2000w_option_get_descriptor_nineteen_test() +void kds_s2000w_option_get_descriptor_twenty_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(19); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(20); assert_string_equal("background-smoothing-aggressiveness", option->name); assert_string_equal("Background Smoothing Aggressivenes", option->title); @@ -361,9 +382,9 @@ void kds_s2000w_option_get_descriptor_nineteen_test() assert_int_equal(1, option->constraint.range->quant); } -void kds_s2000w_option_get_descriptor_twenty_test() +void kds_s2000w_option_get_descriptor_twentyone_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(20); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(21); assert_string_equal(SANE_NAME_CONTRAST, option->name); assert_string_equal(SANE_TITLE_CONTRAST, option->title); @@ -378,9 +399,9 @@ void kds_s2000w_option_get_descriptor_twenty_test() assert_int_equal(1, option->constraint.range->quant); } -void kds_s2000w_option_get_descriptor_twentyone_test() +void kds_s2000w_option_get_descriptor_twentytwo_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(21); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(22); assert_string_equal("config-reset", option->name); assert_string_equal("reset config", option->title); diff --git a/tests/kds_s2000w_option_descriptor_tests.h b/tests/kds_s2000w_option_descriptor_tests.h index 67080aa..caff54e 100644 --- a/tests/kds_s2000w_option_descriptor_tests.h +++ b/tests/kds_s2000w_option_descriptor_tests.h @@ -30,5 +30,6 @@ void kds_s2000w_option_get_descriptor_eightteen_test(); void kds_s2000w_option_get_descriptor_nineteen_test(); void kds_s2000w_option_get_descriptor_twenty_test(); void kds_s2000w_option_get_descriptor_twentyone_test(); +void kds_s2000w_option_get_descriptor_twentytwo_test(); void kds_s2000w_option_get_descriptor_over_max_options_test(); #endif \ No newline at end of file diff --git a/tests/kds_s2000w_option_descriptor_tests_run.c b/tests/kds_s2000w_option_descriptor_tests_run.c index 63c3a01..9f177a7 100644 --- a/tests/kds_s2000w_option_descriptor_tests_run.c +++ b/tests/kds_s2000w_option_descriptor_tests_run.c @@ -25,6 +25,7 @@ int main() cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_nineteen_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twenty_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyone_test, setup, teardown), + cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentytwo_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown) };