#include "kds_s2000w_handler_opts.h"
#include "kds_s2000w_debug.h"
-#define COUNT_CUSTOM_OPTIONS 8
+#define COUNT_CUSTOM_OPTIONS 4
extern json_object* resp_config;
extern json_object* config;
-int gamma_table[4][256];
void _write_string_value(json_object* value_object, void* value)
{
return 0;
}
-void init_gamma_table()
-{
- for (int i = 0; i < 256; i++) {
- gamma_table[0][i] = i;
- gamma_table[1][i] = i;
- gamma_table[2][i] = i;
- gamma_table[3][i] = i;
- }
-}
-
void kds_s2000w_handler_get_option(handler* h, int option, void* value, int* info)
{
config = json_object_object_get(resp_config, "Configuration");
value_object = json_object_object_get(config, "MaxDocumentLength");
_write_int_value(value_object, value);
break;
- case 26:
- memcpy(value, &gamma_table[0][0], sizeof(int) * 256);
- break;
- case 27:
- memcpy(value, &gamma_table[1][0], sizeof(int) * 256);
- break;
- case 28:
- memcpy(value, &gamma_table[2][0], sizeof(int) * 256);
- break;
- case 29:
- memcpy(value, &gamma_table[3][0], sizeof(int) * 256);
- break;
default:
break;
}
SANE_String_Const* constraint_max_document_length = NULL;
SANE_String_Const* constraint_scan_source = NULL;
SANE_Word* constraint_depth = NULL;
-SANE_Range* constraint_gamma_range = NULL;
-SANE_Range* constraint_gamma_range_r = NULL;
-SANE_Range* constraint_gamma_range_g = NULL;
-SANE_Range* constraint_gamma_range_b = NULL;
SANE_Option_Descriptor* _kds_s2000w_option_descriptor_standard_group()
{
return descriptor;
}
-SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector()
-{
- debug_printf(ALL, "kds_s2000w_option_descriptor_gamma_vector");
- SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor));
-
- descriptor->name = SANE_NAME_GAMMA_VECTOR;
- descriptor->title = SANE_TITLE_GAMMA_VECTOR;
- descriptor->desc = SANE_DESC_GAMMA_VECTOR;
- descriptor->type = SANE_TYPE_INT;
- descriptor->unit = SANE_UNIT_NONE;
- 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;
- descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- descriptor->constraint.range = constraint_gamma_range;
- descriptor->size = sizeof(SANE_Int) * 256;
-
- return descriptor;
-}
-
-SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_r()
-{
- debug_printf(ALL, "kds_s2000w_option_descriptor_gamma_vector_r");
- SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor));
-
- descriptor->name = SANE_NAME_GAMMA_VECTOR_R;
- descriptor->title = SANE_TITLE_GAMMA_VECTOR_R;
- descriptor->desc = SANE_DESC_GAMMA_VECTOR_R;
- descriptor->type = SANE_TYPE_INT;
- descriptor->unit = SANE_UNIT_NONE;
- constraint_gamma_range_r = malloc(sizeof(SANE_Range));
- constraint_gamma_range_r->min = 0;
- constraint_gamma_range_r->max = 255;
- constraint_gamma_range_r->quant = 0;
- descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT;
- descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- descriptor->constraint.range = constraint_gamma_range_r;
- descriptor->size = sizeof(SANE_Int) * 256;
-
- return descriptor;
-}
-
-SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_g()
-{
- debug_printf(ALL, "kds_s2000w_option_descriptor_gamma_vector_g");
- SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor));
-
- descriptor->name = SANE_NAME_GAMMA_VECTOR_G;
- descriptor->title = SANE_TITLE_GAMMA_VECTOR_G;
- descriptor->desc = SANE_DESC_GAMMA_VECTOR_G;
- descriptor->type = SANE_TYPE_INT;
- descriptor->unit = SANE_UNIT_NONE;
- constraint_gamma_range_g = malloc(sizeof(SANE_Range));
- constraint_gamma_range_g->min = 0;
- constraint_gamma_range_g->max = 255;
- constraint_gamma_range_g->quant = 0;
- descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT;
- descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- descriptor->constraint.range = constraint_gamma_range_g;
- descriptor->size = sizeof(SANE_Int) * 256;
-
- return descriptor;
-}
-
-SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_b()
-{
- debug_printf(ALL, "kds_s2000w_option_descriptor_gamma_vector_b");
- SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor));
-
- descriptor->name = SANE_NAME_GAMMA_VECTOR_B;
- descriptor->title = SANE_TITLE_GAMMA_VECTOR_B;
- descriptor->desc = SANE_DESC_GAMMA_VECTOR_B;
- descriptor->type = SANE_TYPE_INT;
- descriptor->unit = SANE_UNIT_NONE;
- constraint_gamma_range_b = malloc(sizeof(SANE_Range));
- constraint_gamma_range_b->min = 0;
- constraint_gamma_range_b->max = 255;
- constraint_gamma_range_b->quant = 0;
- descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT;
- descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- descriptor->constraint.range = constraint_gamma_range_b;
- descriptor->size = sizeof(SANE_Int) * 256;
-
- return descriptor;
-}
-
void kds_s2000w_option_descriptor_init_option_descriptors()
{
debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors");
descriptor_array[23] = _kds_s2000w_option_descriptor_binarization_contrast();
descriptor_array[24] = _kds_s2000w_option_descriptor_max_document_length();
descriptor_array[25] = _kds_s2000w_option_descriptor_config_reset();
- descriptor_array[26] = _kds_s2000w_option_descriptor_gamma_vector();
- descriptor_array[27] = _kds_s2000w_option_descriptor_gamma_vector_r();
- descriptor_array[28] = _kds_s2000w_option_descriptor_gamma_vector_g();
- descriptor_array[29] = _kds_s2000w_option_descriptor_gamma_vector_b();
}
void kds_s2000w_option_descriptor_free_option_descriptors()
constraint_scan_source = NULL;
free(constraint_depth);
constraint_depth = NULL;
- free(constraint_gamma_range);
- constraint_gamma_range = NULL;
- free(constraint_gamma_range_r);
- constraint_gamma_range_r = NULL;
- free(constraint_gamma_range_g);
- constraint_gamma_range_g = NULL;
- free(constraint_gamma_range_b);
- constraint_gamma_range_b =NULL;
for (int i = 0; i < MAX_OPTION_COUNT; i++) {
free(descriptor_array[i]);