[sane-devel] Re: [patch] xscanimage: resolution of the resulting GIMP image
Henning Meier-Geinitz
henning at meier-geinitz.de
Sun Jan 12 21:59:24 GMT 2003
Hi,
On Sun, Jan 12, 2003 at 09:17:45PM +0100, Aurelien Jarno wrote:
> Oups, forgotten the patch...
A bit too late for 1.0.10 but after that we can include the patch.
> --- xscanimage.c 2003-01-12 20:45:27.000000000 +0100
> +++ /home/aurel32/xscanimage.c 2003-01-12 20:45:09.000000000 +0100
> @@ -380,4 +380,29 @@
> #endif /* HAVE_LIBGIMP_GIMP_H */
>
> +static SANE_Word get_resolution(SANE_Handle dev)
> +{
> + int i;
> + SANE_Word resolution;
> + SANE_Int num_options;
> + const SANE_Option_Descriptor *option_desc;
> +
> + sane_control_option (dev, 0, SANE_ACTION_GET_VALUE, &num_options, 0);
Better check the return code. If this fails for some reason,
num_options may be unitialized (or set it to 1).
> + for(i = 1 ; i < num_options ; i++)
> + {
> + option_desc = sane_get_option_descriptor(dev, i);
> + if (option_desc)
> + if (option_desc->name)
> + if (strncmp(option_desc->name,
> + SANE_NAME_SCAN_RESOLUTION,
> + sizeof(SANE_NAME_SCAN_RESOLUTION)) == 0)
> + {
> + sane_control_option (dev, i, SANE_ACTION_GET_VALUE, &resolution, 0);
Same here.
> + resolution = get_resolution(dev);
> + if (resolution != 0) gimp_image_set_resolution(scan_win.image_ID,
> + resolution,
> + resolution);
> +
Is this function part of gimp 1.0? Just to make sure that xscanimage
still compiles on older installations.
Bye,
Henning
More information about the sane-devel
mailing list