From 1725bc3b292222f629ef4768f0d27c9cf1c9056b Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Wed, 14 Feb 2024 21:46:27 +0100 Subject: [PATCH] add option for gamma --- src/kds_s2000w_handler_opts.c | 12 ++++++++---- src/kds_s2000w_option_descriptors.c | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index 4f6e8c4..89797d8 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -214,16 +214,20 @@ void kds_s2000w_handler_get_option(int option, void* value) _write_string_value(value_object, value); break; case 25: - memcpy(value, &gamma_table[0][0], sizeof(int) * 256); + int default_gamma = 0; + memcpy(value, &default_gamma, sizeof(int)); break; case 26: - memcpy(value, &gamma_table[1][0], sizeof(int) * 256); + int default_gamma_r = 0; + memcpy(value, &default_gamma_r, sizeof(int)); break; case 27: - memcpy(value, &gamma_table[2][0], sizeof(int) * 256); + int default_gamma_g = 0; + memcpy(value, &default_gamma_g, sizeof(int)); break; case 28: - memcpy(value, &gamma_table[3][0], sizeof(int) * 256); + int default_gamma_b = 0; + memcpy(value, &default_gamma_b, sizeof(int)); default: break; } diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index e4dd225..d493afc 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -539,11 +539,11 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector() constraint_gamma_range = malloc(sizeof(SANE_Range)); constraint_gamma_range->min = 0; constraint_gamma_range->max = 255; - constraint_gamma_range->quant = 0; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_INACTIVE; + constraint_gamma_range->quant = 1; + descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; descriptor->constraint_type = SANE_CONSTRAINT_RANGE; descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int) * 256; + descriptor->size = sizeof(SANE_Int); } SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_r() @@ -559,11 +559,11 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_r() constraint_gamma_range = malloc(sizeof(SANE_Range)); constraint_gamma_range->min = 0; constraint_gamma_range->max = 255; - constraint_gamma_range->quant = 0; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_INACTIVE; + constraint_gamma_range->quant = 1; + descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; descriptor->constraint_type = SANE_CONSTRAINT_RANGE; descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int) * 256; + descriptor->size = sizeof(SANE_Int); } SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_g() @@ -579,11 +579,11 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_g() constraint_gamma_range = malloc(sizeof(SANE_Range)); constraint_gamma_range->min = 0; constraint_gamma_range->max = 255; - constraint_gamma_range->quant = 0; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_INACTIVE; + constraint_gamma_range->quant = 1; + descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; descriptor->constraint_type = SANE_CONSTRAINT_RANGE; descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int) * 256; + descriptor->size = sizeof(SANE_Int); } @@ -601,11 +601,11 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_b() constraint_gamma_range = malloc(sizeof(SANE_Range)); constraint_gamma_range->min = 0; constraint_gamma_range->max = 255; - constraint_gamma_range->quant = 0; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_INACTIVE; + constraint_gamma_range->quant = 1; + descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; descriptor->constraint_type = SANE_CONSTRAINT_RANGE; descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int) * 256; + descriptor->size = sizeof(SANE_Int); } void kds_s2000w_option_descriptor_init_option_descriptors() -- 2.39.5