Apply "Imported SANE2 draft version 0.07"

draft-2
Olaf Meeuwissen 2020-01-19 18:57:30 +09:00
commit c3b9503828
6 zmienionych plików z 1060 dodań i 182 usunięć

Wyświetl plik

@ -58,3 +58,21 @@ div#network-protocol table.docutils td {
margin: 0px;
line-height: 0px;
}
/* Changebar-like re-styling of attention directives. */
.rst-content .attention .admonition-title {
display: none;
}
.rst-content .attention {
margin: 0;
margin-left: -8px;
padding: 0;
padding-left: 6px;
border-left: 2px solid;
background: none;
}
.rst-content .attention p:last-child {
margin-bottom: 24px;
}

1065
api.rst

Plik diff jest za duży Load Diff

14
conf.py
Wyświetl plik

@ -20,7 +20,7 @@ import os
project = 'SANE Standard'
copyright = ''
author = ''
version = 'Version 1.03'
version = 'Version 2.0 proposal 0.07 - rauch/beck'
release = version
# -- General configuration ---------------------------------------------------
@ -53,7 +53,7 @@ numfig_format = {
'section': '%s'
}
today_fmt = '2002-10-10'
today_fmt = 'Dec 5, 2002'
highlight_language = 'c'
@ -83,5 +83,13 @@ latex_documents = [
latex_elements = {
'papersize': 'a4paper',
'releasename': '\!' # suppress default with negative thin space
'releasename': '\!', # suppress default with negative thin space
# Attention directives are abused to inject changebar environments.
'preamble': r'''
\usepackage{changebar}
\setlength{\changebarwidth}{1pt}
\setcounter{changebargrey}{10}
\renewenvironment{sphinxattention}[1]
{\begin{changebar}}{\end{changebar}}
'''
}

Wyświetl plik

@ -9,7 +9,7 @@ The SANE standard is discussed and evolved via a mailing list. Anybody
with email access to the Internet can automatically join and leave the
discussion group by sending mail to the following address.
mailto:sane-devel-request@mostang.com
mailto:majordomo@mostang.com
To subscribe, send a mail with the body “``subscribe sane-devel``” to
the above address.

Wyświetl plik

@ -127,17 +127,9 @@ the time this standard was created.
A SANE image is a rectangular area. The rectangular area is subdivided
into a number of rows and columns. At the intersection of each row and
column is a quadratic pixel. A pixel consists of one or more sample
column is a (preferable quadratic) pixel. A pixel consists of one or more sample
values. Each sample value represents one channel (e.g., the red
channel). Each sample value has a certain bit depth. The bit depth is
fixed for the entire image and can be as small as one bit. Valid bit
depths are 1, 8, or 16 bits per sample. If a devices natural bit depth
is something else, it is up to the driver to scale the sample values
appropriately (e.g., a 4 bit sample could be scaled by a factor of four
to represent a sample value of depth 8).
Image Transmission
~~~~~~~~~~~~~~~~~~
channel).
The SANE API transmits an image as a sequence of frames. Each frame
covers the same rectangular area as the entire image, but may contain
@ -148,13 +140,58 @@ transmitted as a sequence of three frames: the first frame containing
the red channel, the second the green channel, and the third the blue
channel.
Conceptually, each frame is transmitted a byte at a time. Each byte may
When transmitting an image frame by frame, the frontend needs to know what
part of the image a frame represents (and how many frames it should expect).
For that purpose, the SANE API tags every frame with a type and a format
descriptor.
.. attention::
There are two different types of frames: pixel oriented frames
:macro:`SANE_FRAME_RAW` and arbitrary data frames
:macro:`SANE_FRAME_MIME`. These types are discussed in detail in
the following sections. The frame types used by version 1 of this
standard :macro:`SANE_FRAME_GRAY`, :macro:`SANE_FRAME_RGB`,
:macro:`SANE_FRAME_RED`, :macro:`SANE_FRAME_GREEN`, and
:macro:`SANE_FRAME_BLUE`) are obsolete and superseded by
:macro:`SANE_FRAME_RAW`.
Pixel oriented frames
~~~~~~~~~~~~~~~~~~~~~
.. attention::
The type of pixel oriented frames is :macro:`SANE_FRAME_RAW`. The
frame contains one or more channels of data in a
channel-interleaved format, that represents sample values from a
property of the individual pixels that is subject to further
description in the :member:`format_desc` member of the
:type:`SANE_Parameters` structured type. See section
:numref:`sec:sanegetparameters` for details about the format
descriptions.
Each sample value has a certain bit depth. The bit depth is
fixed for the entire image and can be as small as one bit. Valid bit
depths are 1, 8, or 16 bits per sample. If a device's natural bit depth
is something else, it is up to the driver to scale the sample values
appropriately (e.g., a 4 bit sample could be scaled by a factor of four
to represent a sample value of depth 8).
.. attention::
The complete image may consist of several different channels. The
number of channels is defined by member :member:`channels_per_image`
of :type:`SANE_Parameters`. The image may be transmitted in an
arbitary number of frames which can be determined by watching the
:macro:`SANE_PFLAG_LAST_FRAME` flag in said type (or by counting the
channels). Note: This frame type replaces all frame types of the SANE
standard version 1.
Conceptually, each pixel oriented frame is transmitted a byte at a time. Each byte may
contain 8 sample values (for an image bit depth of 1), one full sample
value (for an image bit depth of 8), or a partial sample value (for an
image bit depth of 16 or bigger). In the latter case, the bytes of each
sample value are transmitted in the machines native byte order.
For depth 1, the leftmost pixel is stored in the most significant bit,
and the rightmost pixel in the least significant bit.
**Backend Implementation Note**
@ -183,63 +220,44 @@ orientation (as it would be displayed on a screen, for example).
If a frame contains multiple channels, then the channels are transmitted
in an interleaved fashion. :numref:`fig:pixels`
illustrates this for the case where a frame contains a complete
red/green/blue image with a bit-depth of 8. For a bit depth of 1, each
byte contains 8 sample values of a *single* channel. In other words, a
bit depth 1 frame is transmitted in a byte interleaved fashion.
red/green/blue image with a bit-depth of 8.
.. figure:: figs/image-data.*
:name: fig:pixels
:scale: 80%
:align: center
Bit and byte order or image data
Bit and byte order of image data
When transmitting an image frame by frame, the frontend needs to know
what part of the image a frame represents (and how many frames it should
expect). For that purpose, the SANE API tags every frame with a type.
This version of the SANE standard supports the following frame types:
For a bit depth of 1, each byte contains 8 sample values of a *single*
channel. In other words, a bit depth 1 frame is transmitted in a byte
interleaved fashion. The first sample of each byte is represented by
the most significant bit.
:macro:`SANE_FRAME_GRAY`:
The frame contains a single channel of data that represents
sample values from a spectral band that covers the human visual
range. The image consists of this frame only.
.. attention::
:macro:`SANE_FRAME_RGB`:
The frame contains three channels of data that represent sample
values from the red, green, and blue spectral bands. The sample
values are interleaved in the order red, green, and blue. The
image consists of this frame only.
For gray channels at a bit depth of 1 only two sample values are
possible: 1 represents minimum intensity (black) and 0 represents
maximum intensity (white). For all other channel types and bit
depths a sample value of 0 represents minimum intensity and larger
values represent increasing intensity.
:macro:`SANE_FRAME_RED`:
The frame contains one channel of data that represents sample
values from the red spectral band. The complete image consists
of three frames: :macro:`SANE_FRAME_RED`,
:macro:`SANE_FRAME_GREEN`, and
:macro:`SANE_FRAME_BLUE`. The order in which the
frames are transmitted chosen by the backend.
Arbitrary data frames
~~~~~~~~~~~~~~~~~~~~~
:macro:`SANE_FRAME_GREEN`:
The frame contains one channel of data that represents sample
values from the green spectral band. The complete image consists
of three frames: :macro:`SANE_FRAME_RED`,
:macro:`SANE_FRAME_GREEN`, and
:macro:`SANE_FRAME_BLUE`. The order in which the
frames are transmitted chosen by the backend.
.. attention::
:macro:`SANE_FRAME_BLUE`:
The frame contains one channel of data that represents sample
values from the blue spectral band. The complete image consists
of three frames: :macro:`SANE_FRAME_RED`,
:macro:`SANE_FRAME_GREEN`, and
:macro:`SANE_FRAME_BLUE`. The order in which the
frames are transmitted chosen by the backend.
It also is possible to transmit arbitrary (not necessaryly pixel
oriented) data. This allows transmission of compressed images like
jpeg, tiff, etc.
In frames of type :macro:`SANE_FRAME_GRAY`, when the bit depth is 1 there are
only two sample values possible, 1 represents minimum intensity
(black) and 0 represents maximum intensity (white). For all other bit
depth and frame type combinations, a sample value of 0 represents
minimum intensity and larger values represent increasing intensity.
The combination of bit depth 1 and :macro:`SANE_FRAME_RGB (or
:macro:`SANE_FRAME_RED`, :macro:`SANE_FRAME_GREEN`, :macro:`SANE_FRAME_BLUE`)
is rarely used and may not be supported by every frontend.
The type of arbitrary data frames is :macro:`SANE_FRAME_MIME`. The
frame contains arbitrary data of the MIME (see RFC 1521/1522) type
that is given in the :member:`format_desc` member of the
:type:`SANE_Parameters` structured type (see See section
:numref:`sec:sanegetparameters`). As such, it is assumed to be
incomprehensible to the frontend, except for selected types the
frontend is specifically capable of handling internally. The
frontend is free to ignore those frames, or employ any appropriate
means to otherwise handle this data (like saving them to disk or
spawning an external viewer).

Wyświetl plik

@ -39,3 +39,8 @@ Typographic Conventions
Changes since the last revision of this document are highlighted like
this:
.. attention::
Paragraphs that changed since the last revision of the documention
are marked like this paragraph.