Don't send gimp images with more then 8 bits/color. Patches from

mh <crapsite@gmx.net>. Changed name of find-scanner
to sane-find-scanner.
Henning Meier-Geinitz <henning@meier-geinitz.de>
DEVEL_2_0_BRANCH-1
Henning Geinitz 2001-10-13 15:54:38 +00:00
rodzic 6db317aa7e
commit a2af61540c
1 zmienionych plików z 16 dodań i 5 usunięć

Wyświetl plik

@ -923,8 +923,9 @@ scan_start (void)
case SANE_FRAME_RED:
case SANE_FRAME_GREEN:
case SANE_FRAME_BLUE:
fprintf (scan_win.out, "P6\n# SANE data follows\n%d %d\n255\n",
scan_win.param.pixels_per_line, scan_win.param.lines);
fprintf (scan_win.out, "P6\n# SANE data follows\n%d %d\n%d\n",
scan_win.param.pixels_per_line, scan_win.param.lines,
(scan_win.param.depth <= 8) ? 255 : 65535);
break;
case SANE_FRAME_GRAY:
@ -932,8 +933,9 @@ scan_start (void)
fprintf (scan_win.out, "P4\n# SANE data follows\n%d %d\n",
scan_win.param.pixels_per_line, scan_win.param.lines);
else
fprintf (scan_win.out, "P5\n# SANE data follows\n%d %d\n255\n",
scan_win.param.pixels_per_line, scan_win.param.lines);
fprintf (scan_win.out, "P5\n# SANE data follows\n%d %d\n%d\n",
scan_win.param.pixels_per_line, scan_win.param.lines,
(scan_win.param.depth <= 8) ? 255 : 65535);
break;
}
scan_win.header_size = ftell (scan_win.out);
@ -952,6 +954,15 @@ scan_start (void)
size_t tile_size;
/* We are running under the GIMP */
/* Check whether the selected bit depth is supported by the Gimp */
if (scan_win.param.depth > 8)
{
gsg_set_sensitivity (dialog, TRUE);
snprintf (buf, sizeof (buf), "The Gimp doesn't support images "
"with %d bits/channel.", scan_win.param.depth);
gsg_error (buf);
return;
}
scan_win.tile_offset = 0;
tile_size = scan_win.param.pixels_per_line * gimp_tile_height ();
@ -1769,7 +1780,7 @@ interface (int argc, char **argv)
{
DBG (DBG_fatal, "No scanners were identified. If you were expecting something\n"
" different, check that the scanner is plugged in, turned on and\n"
" detected by the find-scanner tool (if appropriate). Please read\n"
" detected by sane-find-scanner (if appropriate). Please read\n"
" the documentation which came with this software (README, FAQ,\n"
" manpages).\n");
quit_xscanimage ();