[sane-devel] Dimension ranges

Dave Close dclose@anim.dreamworks.com
Fri, 03 May 2002 13:47:25 -0700


Henning Meier-Geinitz wrote:
>I see. I don't like counting starting by 0 :-)

SANE permits the boundaries of a scan to be expressed in whatever units
the backend supports. Many support standard units like millimeters or
inches. Some support actual pixels. But I'm a little confused about how
to think about the difference.

Consider a scanner capable of an image up to US letter size, 8.5 inches
by 11 inches. If expressed in inches, the X SANE_Range might be { 0,
8.5, 0 }. If the resolution is 300 dots per inch, this would translate
to a SANE_Range in pixels of { 0, 2550, 0 }. But that isn't quite right.

To achieve an image of maximum width, a frontend might set the top-left
X position to 0 inches and the bottom-right X position to 8.5 inches.
Converted to pixels, these settings would be 0 and 2550. But that can't
be: there are 2551 pixels in that range, one too many.

A backend which wants to use pixels for dimensions might solve this by
setting the range to either { 0, 2449, 0 } or { 1, 2550, 0 }. Is there
a preferred solution?
-- 
Dave Close                    Dreamworks SKG, Animation Technology
+1 818 695 6962               Glendale California 91201-3007
dclose@anim.dreamworks.com    http://www.dreamworks.com/