[sane-devel] BRIGHTNESS / CONTRAST controls

stef stef.dev at free.fr
Tue Nov 6 04:51:56 UTC 2007


Le Monday 05 November 2007 21:42:47 jazz_johnson at verizon.net, vous avez 
écrit :
> I've been debugging my hs2p backend and have a question about
> BRIGHTNESS/CONTRAST controls.
>
> Following the ibm, bh, and sp15c backends, I initialized a SANE option
> OPT_BRIGHTNESS in
>
> init_options()
> {
>   s->opt[OPT_BRIGHTNESS].name = SANE_NAME_BRIGHTNESS;
>   s->opt[OPT_BRIGHTNESS].title = SANE_TITLE_BRIGHTNESS;
>   s->opt[OPT_BRIGHTNESS].desc = SANE_DESC_BRIGHTNESS;
>   s->opt[OPT_BRIGHTNESS].type = SANE_TYPE_INT;
>   s->opt[OPT_BRIGHTNESS].unit = SANE_UNIT_NONE;
>   s->opt[OPT_BRIGHTNESS].constraint_type = SANE_CONSTRAINT_RANGE;
>   s->opt[OPT_BRIGHTNESS].constraint.range = &s->hw->info.brightness_range;
>   s->val[OPT_BRIGHTNESS].w = 128;
> }
> where struct SANE_range brightness_range = {
>    1, 255, 1 /*min,max,quant*/
> }
>
> since the IS450 has a brightness range [0,255] with 0 being an alias for
> the default value of 128 (the midpoint of the odd interval [1,255])
>
> I also defined an analogous OPT_CONTRAST for the contrast function
> under the Enhancement Group.
>
> When I bring up Xsane, though, I have two brightness controls, one under
> the Enhancement Group with the interval [1,255] labeled Brightness,
> and the other under the main Xsane window with the interval [-100,100] with
> a "Sun" symbol for the brightness control. The Xsane contol works with the
> Preview window and the Histogram window. I also have analogous dual
> controls for contrast, with the Xsane control (labeled with a contrast
> symbol) working with the Preview/Histogram windows.
>
>
> I obviously just want one brightness control and one contrast control. I
> don't care whethor the range is [-100,100] or [1,128]  or [0%,100%], just
> so long as when I set my window parameters I translate to [1,255]
>
> Are BRIGHTNESS/CONTRAST predefined somewhere?
> When I reference s->val[OPT_BRIGHTNESS].w am I referencing a value
> in the range [-100,100] or [1,255] ?

	Hello,

	Xsane has a software contrast and brightness correction (the ones in 
the -100,+100 range). It also provides a software gamma correction. All these 
are independent from the backend and work on the scanned data after they have 
been received.
	They can be turned off (from the configuration pane in prefrences menu), so 
only the controls implemented in your backend would be used.

Regards,
	Stef





More information about the sane-devel mailing list