SANE_Option_Descriptor* descriptor_array = NULL;
-SANE_Word constraint_dpi[] = {5, 100, 150, 200, 300, 600};
-SANE_Range constraint_binarization_contrast = {-50, 50, 1};
-SANE_Range constraint_background_smoothing_aggressivness = {-10, 10, 1};
-SANE_Range constraint_color_drop_out_aggressiveness_range = {-10, 10, 1};
-SANE_Range constraint_color_balance_aggressiveness = {-2, 2, 1};
-SANE_Range constraint_color_balance_red = {-50, 50, 1};
-SANE_Range constraint_color_balance_green = {-50, 50, 1};
-SANE_Range constraint_color_balance_blue = {-50, 50, 1};
-SANE_Range constraint_foreground_boldness_aggressiveness = {-10, 10, 1};
-
SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group()
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_standard_group");
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_dpi");
+ SANE_Word* constraint = malloc(sizeof(SANE_Word) * 6);
+ constraint[0] = 5;
+ constraint[1] = 100;
+ constraint[2] = 150;
+ constraint[3] = 200;
+ constraint[4] = 300;
+ constraint[5] = 600;
+
SANE_Option_Descriptor descriptor = {
SANE_NAME_SCAN_RESOLUTION,
SANE_TITLE_SCAN_RESOLUTION,
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_WORD_LIST,
- {.word_list = constraint_dpi}
+ {.word_list = constraint}
};
return descriptor;
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_drop_out_aggressiveness");
+ SANE_Range* constraint = malloc(sizeof(SANE_Range));
+ constraint->min = -10;
+ constraint->max = 10;
+ constraint->quant = 1;
+
SANE_Option_Descriptor descriptor = {
"colordropoutaggressiveness",
"colordropoutaggressiveness",
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_RANGE,
- {.range = &constraint_color_drop_out_aggressiveness_range}
+ {.range = constraint}
};
return descriptor;
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balancea_agressiveness");
+ SANE_Range* constraint = malloc(sizeof(SANE_Range));
+ constraint->min = -2;
+ constraint->max = 2;
+ constraint->quant = 1;
+
SANE_Option_Descriptor descriptor = {
"colorbalanceaggressiveness",
"colorbalanceaggressiveness",
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_RANGE,
- {.range = &constraint_color_balance_aggressiveness}
+ {.range = constraint}
};
return descriptor;
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_red");
+ SANE_Range* constraint = malloc(sizeof(SANE_Range));
+ constraint->min = -50;
+ constraint->max = 50;
+ constraint->quant = 1;
+
SANE_Option_Descriptor descriptor = {
"colorbalancered",
"colorbalancered",
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_RANGE,
- {.range = &constraint_color_balance_red}
+ {.range = constraint}
};
return descriptor;
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_green");
+ SANE_Range* constraint = malloc(sizeof(SANE_Range));
+ constraint->min = -50;
+ constraint->max = 50;
+ constraint->quant = 1;
+
SANE_Option_Descriptor descriptor = {
"colorbalancegreen",
"colorbalancegreen",
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_RANGE,
- {.range = &constraint_color_balance_green}
+ {.range = constraint}
};
return descriptor;
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_blue");
+ SANE_Range* constraint = malloc(sizeof(SANE_Range));
+ constraint->min = -50;
+ constraint->max = 50;
+ constraint->quant = 1;
+
SANE_Option_Descriptor descriptor = {
"colorbalanceblue",
"colorbalanceblue",
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_RANGE,
- {.range = &constraint_color_balance_blue}
+ {.range = constraint}
};
return descriptor;
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_foreground_boldness_aggressiveness");
+ SANE_Range* constraint = malloc(sizeof(SANE_Range));
+ constraint->min = -10;
+ constraint->max = 10;
+ constraint->quant = 1;
+
SANE_Option_Descriptor descriptor = {
"foreground-boldness-aggressiveness",
"Foreground Boldness Aggressiveness",
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_RANGE,
- {.range = &constraint_foreground_boldness_aggressiveness}
+ {.range = constraint}
};
return descriptor;
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_background_smoothing_aggressiveness");
+ SANE_Range* constraint = malloc(sizeof(SANE_Range));
+ constraint->min = -10;
+ constraint->max = 10;
+ constraint->quant = 1;
+
SANE_Option_Descriptor descriptor = {
"background-smoothing-aggressiveness",
"Background Smoothing Aggressivenes",
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_RANGE,
- {.range = &constraint_background_smoothing_aggressivness}
+ {.range = constraint}
};
return descriptor;
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_binarization_contrast");
+ SANE_Range* constraint = malloc(sizeof(SANE_Range));
+ constraint->min = -50;
+ constraint->max = 50;
+ constraint->quant = 1;
+
SANE_Option_Descriptor descriptor = {
SANE_NAME_CONTRAST,
SANE_TITLE_CONTRAST,
sizeof(SANE_Int),
SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
SANE_CONSTRAINT_RANGE,
- {.range = &constraint_binarization_contrast}
+ {.range = constraint}
};
return descriptor;
for (int i = 0; i < MAX_OPTION_COUNT; i++) {
descriptor = kds_s2000w_option_descriptors_get(i);
+
if (descriptor->constraint_type == SANE_CONSTRAINT_STRING_LIST) {
free((void*) descriptor->constraint.string_list);
descriptor->constraint.string_list = NULL;
}
+
+ if (descriptor->constraint_type == SANE_CONSTRAINT_WORD_LIST) {
+ free((void*) descriptor->constraint.word_list);
+ descriptor->constraint.word_list = NULL;
+ }
+
+ if (descriptor->constraint_type == SANE_CONSTRAINT_RANGE) {
+ free((void*) descriptor->constraint.range);
+ descriptor->constraint.range = NULL;
+ }
}
free(descriptor_array);