[sane-devel] BRIGHTNESS / CONTRAST controls

jazz_johnson at verizon.net jazz_johnson at verizon.net
Mon Nov 5 20:42:47 UTC 2007

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 

  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] ?

More information about the sane-devel mailing list