Lines Matching refs:scanner

64  * \brief Function that converts the 'color modes' of the scanner (color/gray) to be understood by SANE.
150 * \brief Callback function that stocks in memory the content of the scanner capabilities.
152 * \return realsize (size of the content needed -> the scanner capabilities)
175 * --> to recover the scanner capabilities.
193 * \fn static int find_valor_of_array_variables(xmlNode *node, capabilities_t *scanner)
194 * \brief Function that searches in the xml file if a scanner capabilitie stocked
200 find_valor_of_array_variables(xmlNode *node, capabilities_t *scanner, int type)
206 scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes, &scanner->caps[type].ColorModesSize, (SANE_String_Const)xmlNodeGetContent(node), 1);
209 scanner->caps[type].ContentTypes = char_to_array(scanner->caps[type].ContentTypes, &scanner->caps[type].ContentTypesSize, (SANE_String_Const)xmlNodeGetContent(node), 0);
214 scanner->caps[type].DocumentFormats = char_to_array(scanner->caps[type].DocumentFormats, &scanner->caps[type].DocumentFormatsSize, (SANE_String_Const)xmlNodeGetContent(node), 0);
215 scanner->caps[type].have_jpeg = -1;
216 scanner->caps[type].have_png = -1;
217 scanner->caps[type].have_tiff = -1;
218 scanner->caps[type].have_pdf = -1;
219 for(; i < scanner->caps[type].DocumentFormatsSize; i++)
221 if (!strcmp(scanner->caps[type].DocumentFormats[i], "image/jpeg"))
224 scanner->caps[type].have_jpeg = i;
227 else if(!strcmp(scanner->caps[type].DocumentFormats[i], "image/png"))
230 scanner->caps[type].have_png = i;
234 else if(type == PLATEN && !strcmp(scanner->caps[type].DocumentFormats[i], "image/tiff"))
237 scanner->caps[type].have_tiff = i;
241 else if(type == PLATEN && !strcmp(scanner->caps[type].DocumentFormats[i], "application/pdf"))
244 scanner->caps[type].have_pdf = i;
249 scanner->caps[type].default_format = strdup("application/pdf");
251 scanner->caps[type].default_format = strdup("image/tiff");
253 scanner->caps[type].default_format = strdup("image/png");
255 scanner->caps[type].default_format = strdup("image/jpeg");
258 scanner->caps[type].format_ext = 1;
260 scanner->caps[type].SupportedIntents = char_to_array(scanner->caps[type].SupportedIntents, &scanner->caps[type].SupportedIntentsSize, (SANE_String_Const)xmlNodeGetContent(node), 0);
262 scanner->caps[type].SupportedResolutions = int_to_array(scanner->caps[type].SupportedResolutions, &scanner->caps[type].SupportedResolutionsSize, atoi((const char *)xmlNodeGetContent(node)));
267 * \fn static int find_value_of_int_variables(xmlNode *node, capabilities_t *scanner)
268 * \brief Function that searches in the xml file if a integer scanner capabilitie is found.
269 * The integer scanner capabilities that are interesting are :
276 find_value_of_int_variables(xmlNode *node, capabilities_t *scanner, int type)
283 scanner->caps[type].MinWidth = atoi((const char*)xmlNodeGetContent(node));
286 if (scanner->caps[type].MaxWidth == 0 || MaxWidth < scanner->caps[type].MaxWidth)
287 scanner->caps[type].MaxWidth = atoi((const char *)xmlNodeGetContent(node));
290 scanner->caps[type].MinHeight = atoi((const char*)xmlNodeGetContent(node));
293 if (scanner->caps[type].MaxHeight == 0 || MaxHeight < scanner->caps[type].MaxHeight)
294 scanner->caps[type].MaxHeight = atoi((const char *)xmlNodeGetContent(node));
297 scanner->caps[type].MaxScanRegions = atoi((const char *)xmlNodeGetContent(node));
299 scanner->caps[type].MaxOpticalXResolution = atoi((const char *)xmlNodeGetContent(node));
301 scanner->caps[type].RiskyLeftMargin = atoi((const char *)xmlNodeGetContent(node));
303 scanner->caps[type].RiskyRightMargin = atoi((const char *)xmlNodeGetContent(node));
305 scanner->caps[type].RiskyTopMargin = atoi((const char *)xmlNodeGetContent(node));
307 scanner->caps[type].RiskyBottomMargin = atoi((const char *)xmlNodeGetContent(node));
308 find_valor_of_array_variables(node, scanner, type);
351 find_struct_variables(xmlNode *node, capabilities_t *scanner)
355 scanner->brightness =
360 scanner->contrast =
365 scanner->sharpen =
370 scanner->threshold =
378 * \fn static int find_true_variables(xmlNode *node, capabilities_t *scanner)
379 * \brief Function that searches in the xml file if we find a scanner capability stored
381 * or, if we find a integer scanner capability.
386 find_true_variables(xmlNode *node, capabilities_t *scanner, int type)
405 find_value_of_int_variables(node, scanner, type);
420 * \fn static int print_xml_c(xmlNode *node, capabilities_t *scanner)
426 print_xml_c(xmlNode *node, ESCL_Device *device, capabilities_t *scanner, int type)
431 find_true_variables(node, scanner, type);
441 scanner->Sources[PLATEN] = (SANE_String_Const)strdup(SANE_I18N ("Flatbed"));
442 scanner->SourcesSize++;
443 scanner->source = PLATEN;
444 print_xml_c(node->children, device, scanner, PLATEN);
445 scanner->caps[PLATEN].duplex = 0;
448 scanner->Sources[ADFSIMPLEX] = (SANE_String_Const)strdup(SANE_I18N("ADF"));
449 scanner->SourcesSize++;
450 if (scanner->source == -1) scanner->source = ADFSIMPLEX;
451 print_xml_c(node->children, device, scanner, ADFSIMPLEX);
452 scanner->caps[ADFSIMPLEX].duplex = 0;
455 scanner->Sources[ADFDUPLEX] = (SANE_String_Const)strdup(SANE_I18N ("ADF Duplex"));
456 scanner->SourcesSize++;
457 if (scanner->source == -1) scanner->source = ADFDUPLEX;
458 print_xml_c(node->children, device, scanner, ADFDUPLEX);
459 scanner->caps[ADFDUPLEX].duplex = 1;
461 else if (find_struct_variables(node, scanner) == 0)
462 print_xml_c(node->children, device, scanner, type);
469 _reduce_color_modes(capabilities_t *scanner)
473 if (scanner->caps[type].ColorModesSize) {
474 if (scanner->caps[type].default_format &&
475 strcmp(scanner->caps[type].default_format, "application/pdf")) {
476 if (scanner->caps[type].ColorModesSize == 3) {
477 free(scanner->caps[type].ColorModes);
478 scanner->caps[type].ColorModes = NULL;
479 scanner->caps[type].ColorModesSize = 0;
480 scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes,
481 &scanner->caps[type].ColorModesSize,
483 scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes,
484 &scanner->caps[type].ColorModesSize,
493 _delete_pdf(capabilities_t *scanner)
497 if (scanner->caps[type].ColorModesSize) {
498 if (scanner->caps[type].default_format) {
499 scanner->caps[type].have_pdf = -1;
500 if (!strcmp(scanner->caps[type].default_format, "application/pdf")) {
501 free(scanner->caps[type].default_format);
502 if (scanner->caps[type].have_tiff > -1)
503 scanner->caps[type].default_format = strdup("image/tiff");
504 else if (scanner->caps[type].have_png > -1)
505 scanner->caps[type].default_format = strdup("image/png");
506 else if (scanner->caps[type].have_jpeg > -1)
507 scanner->caps[type].default_format = strdup("image/jpeg");
509 free(scanner->caps[type].ColorModes);
510 scanner->caps[type].ColorModes = NULL;
511 scanner->caps[type].ColorModesSize = 0;
512 scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes,
513 &scanner->caps[type].ColorModesSize,
515 scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes,
516 &scanner->caps[type].ColorModesSize,
525 * \brief Function that finally recovers all the capabilities of the scanner, using curl.
529 * \return scanner (the structure that stocks all the capabilities elements)
534 capabilities_t *scanner = (capabilities_t*)calloc(1, sizeof(capabilities_t));
567 DBG( 1, "Create NewJob : the scanner header responded : [%s]\n", header->memory);
569 DBG( 1, "The scanner didn't respond: %s\n", curl_easy_strerror(res));
592 scanner->source = 0;
593 scanner->Sources = (SANE_String_Const *)malloc(sizeof(SANE_String_Const) * 4);
595 scanner->Sources[i] = NULL;
596 print_xml_c(node, device, scanner, -1);
614 _reduce_color_modes(scanner);
616 _delete_pdf(scanner);
629 return (scanner);